|
1 | 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.14 FATAL_ERROR)
|
2 | 2 | option(BUILD_CHIAVDFC "Build the chiavdfc shared library" OFF)
|
| 3 | +option(BUILD_PYTHON "Build the python bindings for chiavdf" ON) |
3 | 4 |
|
4 | 5 | set(CMAKE_CXX_STANDARD 17)
|
5 | 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
@@ -52,28 +53,32 @@ endif()
|
52 | 53 | # CMake 3.14+
|
53 | 54 | include(FetchContent)
|
54 | 55 |
|
55 |
| -FetchContent_Declare( |
56 |
| - pybind11-src |
57 |
| - GIT_REPOSITORY https://github.com/pybind/pybind11.git |
58 |
| - GIT_TAG v2.11.1 |
59 |
| -) |
60 |
| -FetchContent_MakeAvailable(pybind11-src) |
| 56 | +if(BUILD_PYTHON) |
| 57 | + FetchContent_Declare( |
| 58 | + pybind11-src |
| 59 | + GIT_REPOSITORY https://github.com/pybind/pybind11.git |
| 60 | + GIT_TAG v2.11.1 |
| 61 | + ) |
| 62 | + FetchContent_MakeAvailable(pybind11-src) |
61 | 63 |
|
62 |
| -pybind11_add_module(chiavdf |
63 |
| - ${CMAKE_CURRENT_SOURCE_DIR}/python_bindings/fastvdf.cpp |
64 |
| - ${CMAKE_CURRENT_SOURCE_DIR}/refcode/lzcnt.c |
65 |
| -) |
| 64 | + pybind11_add_module(chiavdf |
| 65 | + ${CMAKE_CURRENT_SOURCE_DIR}/python_bindings/fastvdf.cpp |
| 66 | + ${CMAKE_CURRENT_SOURCE_DIR}/refcode/lzcnt.c |
| 67 | + ) |
| 68 | + |
| 69 | + target_link_libraries(chiavdf PRIVATE ${GMP_LIBRARIES} ${GMPXX_LIBRARIES}) |
| 70 | + if(UNIX) |
| 71 | + target_link_libraries(chiavdf PRIVATE -pthread) |
| 72 | + endif() |
| 73 | +endif() |
66 | 74 |
|
67 | 75 | add_executable(verifier_test
|
68 | 76 | ${CMAKE_CURRENT_SOURCE_DIR}/verifier_test.cpp
|
69 | 77 | ${CMAKE_CURRENT_SOURCE_DIR}/refcode/lzcnt.c
|
70 | 78 | )
|
71 |
| - |
72 |
| -target_link_libraries(chiavdf PRIVATE ${GMP_LIBRARIES} ${GMPXX_LIBRARIES}) |
73 | 79 | target_link_libraries(verifier_test PRIVATE ${GMP_LIBRARIES} ${GMPXX_LIBRARIES})
|
74 | 80 |
|
75 | 81 | if(UNIX)
|
76 |
| - target_link_libraries(chiavdf PRIVATE -pthread) |
77 | 82 | target_link_libraries(verifier_test PRIVATE -pthread)
|
78 | 83 | endif()
|
79 | 84 |
|
|
0 commit comments