Skip to content

Commit

Permalink
Add CMake config for out-of-tree build
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Apr 16, 2024
1 parent 7bc0970 commit 5a0fc39
Showing 1 changed file with 22 additions and 128 deletions.
150 changes: 22 additions & 128 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,141 +1,35 @@
# Autogenerated by tools/build/setup_cmake.py
# from tools/build/cmake_templates/Module.cmake
# Do not edit - any changes will be lost!
# Are we running cmake from this directory (out of tree build) ?
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
cmake_minimum_required(VERSION 2.8.12...3.6.0)
project(imp_module)

project(IMP.nestor)
if(POLICY CMP0058)
cmake_policy(SET CMP0058 NEW)
endif(POLICY CMP0058)

if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
endif(POLICY CMP0053)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/tools)

if(DEFINED IMP_nestor_IS_CUDA OR DEFINED IMP_IS_CUDA)
set(CUDA_DEFINES ":IMP_NESTOR_CUDA_LIB")
else()
set(CUDA_DEFINES "")
endif()

imp_get_process_exit_code("Setting up module nestor" status ${CMAKE_BINARY_DIR}
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_SOURCE_DIR}/tools/build/setup_module.py
--name=nestor
--datapath=${IMP_DATAPATH}
--defines=${IMP_nestor_CONFIG}:${CUDA_DEFINES}
--source=${CMAKE_SOURCE_DIR}
)

if(${status} EQUAL 0)
imp_execute_process("setup_swig_wrappers nestor" ${CMAKE_BINARY_DIR}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/build/setup_swig_wrappers.py
--module=nestor
--datapath=${IMP_DATAPATH}
--source=${CMAKE_SOURCE_DIR})

# for warning control
add_definitions(-DIMPNESTOR_COMPILATION)

if(0 EQUAL 0)
set(allh_command "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/tools/dev_tools/make_all_header.py" "${CMAKE_BINARY_DIR}/include/IMP/nestor.h" "IMP/nestor" "${PROJECT_SOURCE_DIR}/include/" ${IMP_nestor_EXTRA_HEADERS})
# for swig
imp_execute_process("IMP.nestor making all header" ${PROJECT_BINARY_DIR}
COMMAND ${allh_command})
set(SWIG_EXECUTABLE swig CACHE STRING "Swig program")

add_custom_target(IMP.nestor-all-header
COMMAND ${allh_command}
DEPENDS "${CMAKE_SOURCE_DIR}/tools/dev_tools/make_all_header.py")
set_property(TARGET "IMP.nestor-all-header" PROPERTY FOLDER "IMP.nestor")
list(APPEND IMP_nestor_LIBRARY_EXTRA_DEPENDENCIES IMP.nestor-all-header)
endif()
find_package(IMP REQUIRED)
include(${IMP_USE_FILE})


if(IMP_DOXYGEN_FOUND)
# documentation
file(GLOB headers ${CMAKE_BINARY_DIR}/include/IMP/nestor/*.h)
file(GLOB docs ${CMAKE_SOURCE_DIR}/modules/nestor/doc/*.dox
${CMAKE_SOURCE_DIR}/modules/nestor/doc/*.md)
file(GLOB examples ${CMAKE_BINARY_DIR}/doc/examples/nestor/*.py
${CMAKE_BINARY_DIR}/doc/examples/nestor/*.cpp)
enable_testing()

if(NOT IMP_STATIC)
set(IMP_nestor_TAG_DEPENDS "${IMP.nestor-python}")
endif()
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)

add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/doxygen/nestor/tags ${CMAKE_BINARY_DIR}/doxygen/nestor/xml/index.xml
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/doc/html
COMMAND ln -s -f ../../include
COMMAND ln -s -f ../../doc/examples
COMMAND ln -s -f ../../lib
COMMAND ${IMP_DOXYGEN_EXECUTABLE} ../../doxygen/nestor/Doxyfile 2>&1 /dev/null
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/build/doxygen_patch_tags.py --module=nestor --file=../../doxygen/nestor/tags
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/build/doxygen_show_warnings.py --warn=../../doxygen/nestor/warnings.txt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/build/doxygen_spell_check.py xml ${CMAKE_SOURCE_DIR}/modules/nestor/test/standards_exceptions
DEPENDS ${IMP_kernel_DOC}
${IMP_cgal_DOC}
${IMP_mmcif_DOC}
${IMP_algebra_DOC}
${IMP_display_DOC}
${IMP_score_functor_DOC}
${IMP_statistics_DOC}
${IMP_core_DOC}
${IMP_container_DOC}
${IMP_atom_DOC}
${IMP_em_DOC}
${IMP_saxs_DOC}
${IMP_isd_DOC} ${headers} ${docs} ${examples} ${CMAKE_SOURCE_DIR}/modules/nestor/README.md ${IMP_nestor_TAG_DEPENDS}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doxygen/nestor/
COMMENT "Running doxygen on nestor")
# Don't set MACOSX_RPATH by default
set(CMAKE_MACOSX_RPATH 0)

add_custom_target("IMP.nestor-doc" ALL DEPENDS ${CMAKE_BINARY_DIR}/doxygen/nestor/tags)
set_property(TARGET "IMP.nestor-doc" PROPERTY FOLDER "IMP.nestor")
set(IMP_nestor_DOC "IMP.nestor-doc" CACHE INTERNAL "" FORCE)
include_directories(SYSTEM ${IMP_INCLUDE_DIR})
include_directories("${CMAKE_BINARY_DIR}/include")

if(NOT IMP_STATIC)
list(APPEND IMP_DOC_DEPENDS "${IMP.nestor-python}")
endif()
list(REMOVE_DUPLICATES IMP_DOC_DEPENDS)
set(IMP_DOC_DEPENDS ${IMP_DOC_DEPENDS} CACHE INTERNAL "" FORCE)
else()
set(IMP_nestor_DOC "" CACHE INTERNAL "" FORCE)
endif(IMP_DOXYGEN_FOUND)
imp_build_module(${CMAKE_SOURCE_DIR} nestor)

if(0 EQUAL 0)
list(APPEND imp_nestor_libs ${IMP_kernel_LIBRARY};${IMP_cgal_LIBRARY};${IMP_mmcif_LIBRARY};${IMP_algebra_LIBRARY};${IMP_display_LIBRARY};${IMP_score_functor_LIBRARY};${IMP_statistics_LIBRARY};${IMP_core_LIBRARY};${IMP_container_LIBRARY};${IMP_atom_LIBRARY};${IMP_em_LIBRARY};${IMP_saxs_LIBRARY};${IMP_isd_LIBRARY})
list(APPEND imp_nestor_libs ${BOOST.FILESYSTEM_LIBRARIES};${BOOST.PROGRAMOPTIONS_LIBRARIES};${BOOST.SYSTEM_LIBRARIES};${GPERFTOOLS_LIBRARIES};${TCMALLOC_HEAPPROFILER_LIBRARIES};${TCMALLOC_HEAPCHECKER_LIBRARIES};${BOOST.RANDOM_LIBRARIES};${NUMPY_LIBRARIES};${CGAL_LIBRARIES};${ANN_LIBRARIES};${HDF5_LIBRARIES};${PYTHON-IHM_LIBRARIES};${ROBIN_MAP_LIBRARIES};${GOOGLE_DENSE_HASH_MAP_LIBRARIES};${BOOST.REGEX_LIBRARIES})
list(REMOVE_DUPLICATES imp_nestor_libs)

add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/lib/IMP/nestor/_version_check.py
${CMAKE_BINARY_DIR}/src/nestor_config.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/build/make_module_version.py
--name=nestor --datapath=${IMP_DATAPATH}
--source=${CMAKE_SOURCE_DIR}
DEPENDS IMP-version
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/
COMMENT "Building module version info")

add_custom_target("IMP.nestor-version" ALL DEPENDS
${CMAKE_BINARY_DIR}/lib/IMP/nestor/_version_check.py
${CMAKE_BINARY_DIR}/src/nestor_config.cpp)
set_property(TARGET "IMP.nestor-version" PROPERTY FOLDER "IMP.nestor")
install(FILES "${CMAKE_BINARY_DIR}/lib/IMP/nestor/_version_check.py"
DESTINATION "${CMAKE_INSTALL_PYTHONDIR}/IMP/nestor/")
endif()

add_subdirectory(${CMAKE_SOURCE_DIR}/modules/nestor/src)
add_subdirectory(${CMAKE_SOURCE_DIR}/modules/nestor/test)
add_subdirectory(${CMAKE_SOURCE_DIR}/modules/nestor/examples)
add_subdirectory(${CMAKE_SOURCE_DIR}/modules/nestor/benchmark)
add_subdirectory(${CMAKE_SOURCE_DIR}/modules/nestor/bin)
add_subdirectory(${CMAKE_SOURCE_DIR}/modules/nestor/utility)
set(IMP_nestor "IMP.nestor" CACHE INTERNAL "" FORCE)
else()

# make sure it is empty
set(IMP_nestor_DOC "" CACHE INTERNAL "" FORCE)
set(IMP_nestor_PYTHON "" CACHE INTERNAL "" FORCE)
set(IMP_nestor "" CACHE INTERNAL "" FORCE)

if(${status} EQUAL 1)
message(STATUS "Module IMP.nestor disabled")
else()
message(FATAL_ERROR "setup_module returned ${status}")
endif()
set(IMP_nestor_LIBRARY CACHE INTERNAL "" FORCE)
include(ModuleBuild.cmake)
endif()

0 comments on commit 5a0fc39

Please sign in to comment.