diff --git a/CMakeLists.txt b/CMakeLists.txt index ddacab297..5a8b9046a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,13 @@ option(ENABLE_MINIMAL "Compile EXP support libraries only" OFF) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) option(BUILD_DOCS "Build documentation" OFF) option(DISABLE_PYTHON "Disable the Python development environment" OFF) +if(DISABLE_PYTHON) + message(STATUS "Python development environment is disabled. pyEXP will not be built.") + if(ENABLE_PYEXP_ONLY) + message(FATAL_ERROR "DISABLE_PYTHON=ON is incompatible with ENABLE_PYEXP_ONLY=ON.") + endif() + set(ENABLE_PYEXP OFF CACHE BOOL "Enable the Python bindings" FORCE) +endif() # Metaflag for minimal build @@ -259,14 +266,18 @@ execute_process( ) include_directories(${PROJECT_SOURCE_DIR}/extern/yaml-cpp/include) -include_directories(${PROJECT_SOURCE_DIR}/extern/pybind11/include) +if (NOT DISABLE_PYTHON) + include_directories(${PROJECT_SOURCE_DIR}/extern/pybind11/include) +endif() include_directories(${PROJECT_SOURCE_DIR}/extern/QuickDigest5/include) # Report to the user message("Configuring build for ${GIT_BRANCH}/${GIT_COMMIT} at ${COMPILE_TIME}") add_subdirectory(extern/yaml-cpp) -add_subdirectory(extern/pybind11) +if (NOT DISABLE_PYTHON) + add_subdirectory(extern/pybind11) +endif() # Set options for the HighFive git submodule in extern set(HIGHFIVE_EXAMPLES OFF CACHE BOOL "Do not build the examples") diff --git a/exputil/CMakeLists.txt b/exputil/CMakeLists.txt index 3f8862a7b..ba785f48c 100644 --- a/exputil/CMakeLists.txt +++ b/exputil/CMakeLists.txt @@ -62,7 +62,11 @@ set(common_INCLUDE_DIRS $ set(common_LINKLIB ${DEP_LIB} OpenMP::OpenMP_CXX MPI::MPI_CXX yaml-cpp ${VTK_LIBRARIES} ${HDF5_CXX_LIBRARIES} ${HDF5_LIBRARIES} - ${HDF5_HL_LIBRARIES} ${FFTW_DOUBLE_LIB} pybind11::embed) + ${HDF5_HL_LIBRARIES} ${FFTW_DOUBLE_LIB}) +if(NOT DISABLE_PYTHON) + list(APPEND common_LINKLIB pybind11::embed) +endif() + if(ENABLE_CUDA) list(APPEND common_LINKLIB CUDA::toolkit CUDA::cudart) diff --git a/exputil/realize_model.cc b/exputil/realize_model.cc index c79dcea61..af45d9d16 100644 --- a/exputil/realize_model.cc +++ b/exputil/realize_model.cc @@ -33,6 +33,7 @@ #include #include #include +#include #include "localmpi.H" #include "massmodel.H" diff --git a/utils/Test/CMakeLists.txt b/utils/Test/CMakeLists.txt index cc735fe08..c24e60f47 100644 --- a/utils/Test/CMakeLists.txt +++ b/utils/Test/CMakeLists.txt @@ -1,6 +1,10 @@ set(bin_PROGRAMS testBarrier expyaml orthoTest testDeproj - testEmpDeproj testEmp testED testmd5) + testEmpDeproj testED testmd5) + +if(NOT DISABLE_PYTHON) + list(APPEND bin_PROGRAMS testEmp) +endif() set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX expui exputil yaml-cpp ${VTK_LIBRARIES}) @@ -37,7 +41,9 @@ add_executable(orthoTest orthoTest.cc Biorth2Ortho.cc) add_executable(testDeproj testDeproject.cc CubicSpline.cc Deprojector.cc) add_executable(testEmpDeproj testEmpDeproj.cc CubicSpline.cc Deprojector.cc EmpDeproj.cc) -add_executable(testEmp testEmp.cc EmpDeproj.cc) +if(NOT DISABLE_PYTHON) + add_executable(testEmp testEmp.cc EmpDeproj.cc) +endif() add_executable(testmd5 testmd5.cc) add_executable(testED testED.cc EmpDeproj.cc) @@ -49,6 +55,8 @@ foreach(program ${bin_PROGRAMS}) endforeach() # For Python interpreter... -target_link_libraries(testEmp ${common_LINKLIB} pybind11::embed) +if(NOT DISABLE_PYTHON) + target_link_libraries(testEmp ${common_LINKLIB} pybind11::embed) +endif() install(TARGETS expyaml DESTINATION bin)