Skip to content

Commit

Permalink
CMake update. Python bindings are now optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaybro committed Feb 13, 2021
1 parent b522b37 commit c1437b0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
37 changes: 19 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,38 @@ if(NOT SKBUILD)
add_subdirectory(examples)
endif()

include(CTest)
find_package(GTest QUIET)
if(GTEST_FOUND)
include(CTest)
message(STATUS "GTest found. Unit test build: ${BUILD_TESTING}.")
if(BUILD_TESTING)
if(BUILD_TESTING)
if (GTEST_FOUND)
# Tests are dependent on some common code.
if(NOT TARGET pico_common)
add_subdirectory(examples/pico_common)
endif()

enable_testing()
add_subdirectory(test/pico_tree)
message(STATUS "GTest found. Building unit tests.")
else()
message(STATUS "GTest not found. Unit tests will not be build.")
endif()
else()
message(STATUS "GTest not found. Unit tests will not be build.")
endif()

find_package(Doxygen QUIET)
include(CMakeDependentOption)
CMAKE_DEPENDENT_OPTION(BUILD_DOCUMENTATION "Build documentation with Doxygen." ON "DOXYGEN_FOUND" OFF)
if(BUILD_DOCUMENTATION)
set(DOC_TARGET_NAME ${PROJECT_NAME}_doc)
# Hide the internal namespace from the documentation.
# set(DOXYGEN_EXCLUDE_SYMBOLS "internal")
option(BUILD_DOCS "Build documentation with Doxygen." ON)
if(BUILD_DOCS)
if(DOXYGEN_FOUND)
set(DOC_TARGET_NAME ${PROJECT_NAME}_doc)
# Hide the internal namespace from the documentation.
# set(DOXYGEN_EXCLUDE_SYMBOLS "internal")

doxygen_add_docs(
${DOC_TARGET_NAME}
src/pico_tree)
doxygen_add_docs(
${DOC_TARGET_NAME}
src/pico_tree)

message(STATUS "Doxygen found. Documentation can be build as: make ${DOC_TARGET_NAME}")
else()
message(STATUS "Doxygen not found. Documentation cannot be build.")
message(STATUS "Doxygen found. Documentation can be build as: make ${DOC_TARGET_NAME}")
else()
message(STATUS "Doxygen not found. Documentation cannot be build.")
endif()
endif()
endif()
14 changes: 8 additions & 6 deletions src/pyco_tree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ if(NOT SKBUILD)
find_package(Python COMPONENTS Interpreter Development QUIET)
find_package(pybind11 CONFIG QUIET)
find_package(OpenMP QUIET)

if (Python_FOUND AND pybind11_FOUND AND OpenMP_FOUND)
add_subdirectory(pico_tree)
message(STATUS "Python, pybind11 and OpenMP found. Building PycoTree Python Module.")
else()
message(STATUS "Python, pybind11 or OpenMP not found. PycoTree Python Module skipped.")
option(BUILD_BINDINGS "Enable the creation of PicoTree Python bindings." ON)
if(BUILD_BINDINGS)
if(Python_FOUND AND pybind11_FOUND AND OpenMP_FOUND)
add_subdirectory(pico_tree)
message(STATUS "Python, pybind11 and OpenMP found. Building PycoTree Python Module.")
else()
message(STATUS "Python, pybind11 or OpenMP not found. PycoTree Python Module skipped.")
endif()
endif()
else()
# scikit-build incorrectly detects Python under MSYS2 / MinGW which it then
Expand Down

0 comments on commit c1437b0

Please sign in to comment.