Skip to content
Snippets Groups Projects
Commit 7a7f7e09 authored by mkirsz's avatar mkirsz
Browse files

Build update

parent edaac214
No related branches found
No related tags found
1 merge request!14Develop
Pipeline #48649 failed
...@@ -7,8 +7,8 @@ project(Tadah.MLIP) ...@@ -7,8 +7,8 @@ project(Tadah.MLIP)
get_filename_component(MODULE_TEST ${CMAKE_BINARY_DIR} NAME) get_filename_component(MODULE_TEST ${CMAKE_BINARY_DIR} NAME)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}
OR ${MODULE_TEST} STREQUAL "MLIP" OR ${MODULE_TEST} STREQUAL "MLIP"
) )
message(FATAL_ERROR " message(FATAL_ERROR "
In-source builds not allowed. In-source builds not allowed.
Please make a new directory (called a build directory) and run CMake from there. Please make a new directory (called a build directory) and run CMake from there.
You may need to remove CMakeCache.txt and CMakeFiles dir. ") You may need to remove CMakeCache.txt and CMakeFiles dir. ")
...@@ -19,39 +19,39 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) ...@@ -19,39 +19,39 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif() endif()
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
# Always full RPATH # Always full RPATH
# use, i.e. don't skip the full RPATH for the build tree # use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already # when building, don't use the install RPATH already
# (but later on when installing) # (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH # add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH # which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory # the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1") if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif("${isSystemDir}" STREQUAL "-1") endif("${isSystemDir}" STREQUAL "-1")
endif() endif()
include(FetchContent) include(FetchContent)
if(DEFINED ENV{CI_COMMIT_REF_NAME}) if(DEFINED ENV{CI_COMMIT_REF_NAME})
set(GIT_BRANCH "$ENV{CI_COMMIT_REF_NAME}") set(GIT_BRANCH "$ENV{CI_COMMIT_REF_NAME}")
elseif(DEFINED ENV{READTHEDOCS}) elseif(DEFINED ENV{READTHEDOCS})
set(GIT_BRANCH "$ENV{READTHEDOCS_PROJECT}") set(GIT_BRANCH "$ENV{READTHEDOCS_VERSION}")
else() else()
execute_process( execute_process(
COMMAND git rev-parse --symbolic-full-name --abbrev-ref HEAD COMMAND git rev-parse --symbolic-full-name --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH OUTPUT_VARIABLE GIT_BRANCH
...@@ -63,7 +63,7 @@ FetchContent_Declare( ...@@ -63,7 +63,7 @@ FetchContent_Declare(
Tadah.MODELS Tadah.MODELS
GIT_REPOSITORY https://git.ecdf.ed.ac.uk/tadah/models.git GIT_REPOSITORY https://git.ecdf.ed.ac.uk/tadah/models.git
GIT_TAG origin/${GIT_BRANCH} GIT_TAG origin/${GIT_BRANCH}
) )
FetchContent_MakeAvailable(Tadah.MODELS) FetchContent_MakeAvailable(Tadah.MODELS)
...@@ -78,20 +78,20 @@ target_include_directories(tadah.mlip PUBLIC ${Tadah.CORE_SOURCE_DIR}/include) ...@@ -78,20 +78,20 @@ target_include_directories(tadah.mlip PUBLIC ${Tadah.CORE_SOURCE_DIR}/include)
target_include_directories(tadah.mlip PUBLIC ${Tadah.CORE_SOURCE_DIR}/external/toml11) target_include_directories(tadah.mlip PUBLIC ${Tadah.CORE_SOURCE_DIR}/external/toml11)
if(TADAH_ENABLE_OPENMP) if(TADAH_ENABLE_OPENMP)
find_package(OpenMP REQUIRED) find_package(OpenMP REQUIRED)
target_link_libraries(tadah.mlip PUBLIC OpenMP::OpenMP_CXX) target_link_libraries(tadah.mlip PUBLIC OpenMP::OpenMP_CXX)
endif() endif()
if (TADAH_BUILD_MPI) if (TADAH_BUILD_MPI)
find_package(MPI REQUIRED) find_package(MPI REQUIRED)
target_link_libraries(tadah.mlip PUBLIC MPI::MPI_CXX) target_link_libraries(tadah.mlip PUBLIC MPI::MPI_CXX)
add_compile_definitions(TADAH_BUILD_MPI) add_compile_definitions(TADAH_BUILD_MPI)
endif() endif()
if(TADAH_BUILD_TESTS) if(TADAH_BUILD_TESTS)
include(CTest) include(CTest)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
# Installation rules # Installation rules
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment