-
Notifications
You must be signed in to change notification settings - Fork 212
/
CMakeLists.txt
79 lines (64 loc) · 2.12 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
CMAKE_MINIMUM_REQUIRED(VERSION 3.14.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 99)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release"
CACHE STRING "Possible values are empty, Debug, Release, RelWithDebInfo, MinSizeRel, ..."
FORCE
)
endif()
project(BLS)
if(MSVC)
enable_language(ASM_MASM)
else()
enable_language(ASM)
endif()
set(BUILD_BLS_PYTHON_BINDINGS "1" CACHE STRING "")
set(BUILD_BLS_TESTS "1" CACHE STRING "")
set(BUILD_BLS_BENCHMARKS "1" CACHE STRING "")
message(STATUS "Build python bindings: ${BUILD_BLS_PYTHON_BINDINGS}")
message(STATUS "Build tests: ${BUILD_BLS_TESTS}")
message(STATUS "Build benchmarks: ${BUILD_BLS_BENCHMARKS}")
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules
)
include(FetchContent)
FetchContent_Declare(Sodium
GIT_REPOSITORY https://github.com/AmineKhaldi/libsodium-cmake.git
# Latest commit at the moment this was added here
# Anchored to libsodium v1.0.18
GIT_TAG f73a3fe1afdc4e37ac5fe0ddd401bf521f6bba65
)
set(SODIUM_PCH "on" CACHE STRING "")
set(SODIUM_DISABLE_TESTS "on" CACHE STRING "")
set(SODIUM_CHIA_MINIMAL "on" CACHE STRING "")
FetchContent_MakeAvailable(Sodium)
if (DEFINED ENV{BLST_MAIN})
set(BLST_GIT_TAG "origin/master")
else ()
# This is currently anchored to upstream 3dd0f804b1819e5d03fb22ca2e6fac105932043a dated 2023-08-09 v0.3.11
set(BLST_GIT_TAG "3dd0f804b1819e5d03fb22ca2e6fac105932043a")
endif ()
set(BLST_REPOSITORY "https://github.com/supranational/blst.git")
message(STATUS "blst will be built from: ${BLST_GIT_TAG} and repository ${BLST_REPOSITORY}")
FetchContent_Declare(
blst
GIT_REPOSITORY ${BLST_REPOSITORY}
GIT_TAG ${BLST_GIT_TAG}
)
FetchContent_MakeAvailable(blst)
add_subdirectory(src)
if(EMSCRIPTEN)
add_subdirectory(js-bindings)
else()
# emscripten can't build python bindings, it produces only javascript
# add_subdirectory(contrib/pybind11)
if(BUILD_BLS_PYTHON_BINDINGS)
add_subdirectory(python-bindings)
endif()
endif()