Skip to content

Commit c1437b0

Browse files
committed
CMake update. Python bindings are now optional.
1 parent b522b37 commit c1437b0

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed

CMakeLists.txt

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,38 @@ if(NOT SKBUILD)
2828
add_subdirectory(examples)
2929
endif()
3030

31+
include(CTest)
3132
find_package(GTest QUIET)
32-
if(GTEST_FOUND)
33-
include(CTest)
34-
message(STATUS "GTest found. Unit test build: ${BUILD_TESTING}.")
35-
if(BUILD_TESTING)
33+
if(BUILD_TESTING)
34+
if (GTEST_FOUND)
3635
# Tests are dependent on some common code.
3736
if(NOT TARGET pico_common)
3837
add_subdirectory(examples/pico_common)
3938
endif()
4039

4140
enable_testing()
4241
add_subdirectory(test/pico_tree)
42+
message(STATUS "GTest found. Building unit tests.")
43+
else()
44+
message(STATUS "GTest not found. Unit tests will not be build.")
4345
endif()
44-
else()
45-
message(STATUS "GTest not found. Unit tests will not be build.")
4646
endif()
4747

4848
find_package(Doxygen QUIET)
49-
include(CMakeDependentOption)
50-
CMAKE_DEPENDENT_OPTION(BUILD_DOCUMENTATION "Build documentation with Doxygen." ON "DOXYGEN_FOUND" OFF)
51-
if(BUILD_DOCUMENTATION)
52-
set(DOC_TARGET_NAME ${PROJECT_NAME}_doc)
53-
# Hide the internal namespace from the documentation.
54-
# set(DOXYGEN_EXCLUDE_SYMBOLS "internal")
49+
option(BUILD_DOCS "Build documentation with Doxygen." ON)
50+
if(BUILD_DOCS)
51+
if(DOXYGEN_FOUND)
52+
set(DOC_TARGET_NAME ${PROJECT_NAME}_doc)
53+
# Hide the internal namespace from the documentation.
54+
# set(DOXYGEN_EXCLUDE_SYMBOLS "internal")
5555

56-
doxygen_add_docs(
57-
${DOC_TARGET_NAME}
58-
src/pico_tree)
56+
doxygen_add_docs(
57+
${DOC_TARGET_NAME}
58+
src/pico_tree)
5959

60-
message(STATUS "Doxygen found. Documentation can be build as: make ${DOC_TARGET_NAME}")
61-
else()
62-
message(STATUS "Doxygen not found. Documentation cannot be build.")
60+
message(STATUS "Doxygen found. Documentation can be build as: make ${DOC_TARGET_NAME}")
61+
else()
62+
message(STATUS "Doxygen not found. Documentation cannot be build.")
63+
endif()
6364
endif()
6465
endif()

src/pyco_tree/CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ if(NOT SKBUILD)
22
find_package(Python COMPONENTS Interpreter Development QUIET)
33
find_package(pybind11 CONFIG QUIET)
44
find_package(OpenMP QUIET)
5-
6-
if (Python_FOUND AND pybind11_FOUND AND OpenMP_FOUND)
7-
add_subdirectory(pico_tree)
8-
message(STATUS "Python, pybind11 and OpenMP found. Building PycoTree Python Module.")
9-
else()
10-
message(STATUS "Python, pybind11 or OpenMP not found. PycoTree Python Module skipped.")
5+
option(BUILD_BINDINGS "Enable the creation of PicoTree Python bindings." ON)
6+
if(BUILD_BINDINGS)
7+
if(Python_FOUND AND pybind11_FOUND AND OpenMP_FOUND)
8+
add_subdirectory(pico_tree)
9+
message(STATUS "Python, pybind11 and OpenMP found. Building PycoTree Python Module.")
10+
else()
11+
message(STATUS "Python, pybind11 or OpenMP not found. PycoTree Python Module skipped.")
12+
endif()
1113
endif()
1214
else()
1315
# scikit-build incorrectly detects Python under MSYS2 / MinGW which it then

0 commit comments

Comments
 (0)