Skip to content

Commit d623b1e

Browse files
committed
feat: add ncrypto dep
1 parent 93012d2 commit d623b1e

24 files changed

+7557
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build
2+
cmake-build-debug-coverage
3+
cmake-build-debug
4+
cmake-build-release
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
common --enable_workspace
2+
build --cxxopt="-std=c++20"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.0.0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BasedOnStyle: Google
2+
SortIncludes: Never
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cmake-build-debug
2+
build
3+
.idea
4+
bazel-*
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cc_library(
2+
name = "ncrypto",
3+
srcs = glob(["src/*.cpp"]),
4+
hdrs = glob(["include/*.h"]),
5+
includes = ["include"],
6+
visibility = ["//visibility:public"],
7+
deps = [
8+
"@ssl"
9+
]
10+
)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
cmake_minimum_required(VERSION 3.28)
2+
project(ncrypto)
3+
4+
include(CTest)
5+
include(GNUInstallDirs)
6+
include(FetchContent)
7+
include(cmake/ncrypto-flags.cmake)
8+
9+
if (NOT CMAKE_BUILD_TYPE)
10+
message(STATUS "No build type selected, default to Release")
11+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
12+
endif()
13+
14+
include(cmake/CPM.cmake)
15+
16+
CPMAddPackage(
17+
NAME boringssl
18+
VERSION 0.20250114.0
19+
GITHUB_REPOSITORY google/boringssl
20+
GIT_TAG 0.20250114.0
21+
OPTIONS "BUILD_SHARED_LIBS OFF" "BUILD_TESTING OFF"
22+
)
23+
add_subdirectory(src)
24+
add_library(ncrypto::ncrypto ALIAS ncrypto)
25+
26+
include_directories(${boringssl_SOURCE_DIR}/include)
27+
28+
if (NCRYPTO_TESTING)
29+
CPMAddPackage(
30+
NAME GTest
31+
GITHUB_REPOSITORY google/googletest
32+
VERSION 1.15.2
33+
OPTIONS "BUILD_GMOCK OFF" "INSTALL_GTEST OFF"
34+
)
35+
# For Windows: Prevent overriding the parent project's compiler/linker settings
36+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
37+
enable_testing()
38+
add_subdirectory(tests)
39+
endif()
40+
41+
install(
42+
FILES include/ncrypto.h
43+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
44+
COMPONENT ncrypto_development
45+
)
46+
47+
install(
48+
TARGETS ncrypto
49+
EXPORT ncrypto_targets
50+
RUNTIME COMPONENT ncrypto_runtime
51+
LIBRARY COMPONENT ncrypto_runtime
52+
NAMELINK_COMPONENT ncrypto_development
53+
ARCHIVE COMPONENT ncrypto_development
54+
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
55+
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Node.js
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bazel_dep(name = "googletest", version = "1.15.2")

0 commit comments

Comments
 (0)