Commit bb78cca9 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Parallel build system now works

Fix the problems that were appearing earlier
parent 8421745f
......@@ -16,7 +16,7 @@ build-intel-base:
- export MKLROOT=/home/runner/intel/oneapi/mkl/latest/
- export LD_LIBRARY_PATH=$I_MPI_ROOT/lib/:$I_MPI_ROOT/lib/release:$MKLROOT/lib/intel64:$INTEL_COMP_ROOT/lib/:$INTEL_COMP_ROOT/compiler/lib/intel64/:$LD_LIBRARY_PATH:$HOME/intel/oneapi/intelpython/latest/lib/:$HOME/intel/oneapi/intelpython/latest/lib/python3.7
- export PATH=$INTEL_COMP_ROOT/bin/:$INTEL_COMP_ROOT/bin/intel64:$I_MPI_ROOT/bin:$PATH
- cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_C_COMPILE=icc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=ON -DBUILD_PARAMS=OFF -DBUILD_PYTHON=OFF -DCMAKE_INSTALL_PREFIX=../intel_base/ ../
- cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=ON -DBUILD_PARAMS=OFF -DBUILD_PYTHON=OFF -DCMAKE_INSTALL_PREFIX=../intel_base/ ../
- make
- make install
- cd ../
......@@ -39,7 +39,7 @@ build-intel-py:
- export LD_LIBRARY_PATH=$I_MPI_ROOT/lib/:$I_MPI_ROOT/lib/release:$MKLROOT/lib/intel64:$INTEL_COMP_ROOT/lib/:$INTEL_COMP_ROOT/compiler/lib/intel64/:$LD_LIBRARY_PATH:$HOME/intel/oneapi/intelpython/latest/lib/:$HOME/intel/oneapi/intelpython/latest/lib/python3.7
- export PYTHONPATH=$HOME/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/:cpp_sisso_env_intel_py/lib/python3.7/site-packages/
- export PATH=$INTEL_COMP_ROOT/bin/:$INTEL_COMP_ROOT/bin/intel64:$I_MPI_ROOT/bin:$PATH
- cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_C_COMPILE=icc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=OFF -DBUILD_PARAMS=OFF -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../intel_py/ ../
- cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=OFF -DBUILD_PARAMS=OFF -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../intel_py/ ../
- make
- make install
- cd ../
......@@ -60,7 +60,7 @@ build-intel-param:
- export MKLROOT=/home/runner/intel/oneapi/mkl/latest/
- export LD_LIBRARY_PATH=$I_MPI_ROOT/lib/:$I_MPI_ROOT/lib/release:$MKLROOT/lib/intel64:$INTEL_COMP_ROOT/lib/:$INTEL_COMP_ROOT/compiler/lib/intel64/:$LD_LIBRARY_PATH:$HOME/intel/oneapi/intelpython/latest/lib/:$HOME/intel/oneapi/intelpython/latest/lib/python3.7
- export PATH=$INTEL_COMP_ROOT/bin/:$INTEL_COMP_ROOT/bin/intel64:$I_MPI_ROOT/bin:$PATH
- cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_C_COMPILE=icc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=ON -DBUILD_PARAMS=ON -DBUILD_PYTHON=OFF -DCMAKE_INSTALL_PREFIX=../intel_param/ ../
- cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=ON -DBUILD_PARAMS=ON -DBUILD_PYTHON=OFF -DCMAKE_INSTALL_PREFIX=../intel_param/ ../
- make
- make install
- cd ../
......@@ -83,7 +83,7 @@ build-intel-param-py:
- export LD_LIBRARY_PATH=$I_MPI_ROOT/lib/:$I_MPI_ROOT/lib/release:$MKLROOT/lib/intel64:$INTEL_COMP_ROOT/lib/:$INTEL_COMP_ROOT/compiler/lib/intel64/:$LD_LIBRARY_PATH:$HOME/intel/oneapi/intelpython/latest/lib/:$HOME/intel/oneapi/intelpython/latest/lib/python3.7
- export PYTHONPATH=$HOME/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/:cpp_sisso_env_intel_param_py/lib/python3.7/site-packages/
- export PATH=$INTEL_COMP_ROOT/bin/:$INTEL_COMP_ROOT/bin/intel64:$I_MPI_ROOT/bin:$PATH
- cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_C_COMPILE=icc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=OFF -DBUILD_PARAMS=ON -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../intel_param_py/ ../
- cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=OFF -DBUILD_PARAMS=ON -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../intel_param_py/ ../
- make
- make install
- cd ../
......@@ -196,7 +196,7 @@ build-gnu-base:
- export LD_LIBRARY_PATH=$HOME/intel/oneapi/intelpython/latest/lib/:$HOME/intel/oneapi/intelpython/latest/lib/python3.7:$LD_LIBRARY_PATH
- mkdir build_gnu_base/
- cd build_gnu_base/
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILE=gcc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=ON -DBUILD_PARAMS=OFF -DBUILD_PYTHON=OFF -DCMAKE_INSTALL_PREFIX=../gnu_base/ ../
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=ON -DBUILD_PARAMS=OFF -DBUILD_PYTHON=OFF -DCMAKE_INSTALL_PREFIX=../gnu_base/ ../
- make
- make install
- cd ../
......@@ -211,7 +211,7 @@ build-gnu-param:
- export LD_LIBRARY_PATH=$HOME/intel/oneapi/intelpython/latest/lib/:$HOME/intel/oneapi/intelpython/latest/lib/python3.7:$LD_LIBRARY_PATH
- mkdir build_gnu_param/
- cd build_gnu_param/
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILE=gcc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=ON -DBUILD_PARAMS=ON -DBUILD_PYTHON=OFF -DCMAKE_INSTALL_PREFIX=../gnu_param/ ../
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=ON -DBUILD_PARAMS=ON -DBUILD_PYTHON=OFF -DCMAKE_INSTALL_PREFIX=../gnu_param/ ../
- make
- make install
- cd ../
......@@ -229,7 +229,7 @@ build-gnu-py:
- export PYTHONPATH=$HOME/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/:cpp_sisso_gnu_py_env/lib/python3.7/site-packages/
- mkdir build_py/
- cd build_py/
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILE=gcc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=OFF -DBUILD_PARAMS=OFF -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../gnu_py/ ../
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=OFF -DBUILD_PARAMS=OFF -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../gnu_py/ ../
- make
- make install
- cd ../
......@@ -248,7 +248,7 @@ build-gnu-param-py:
- export PYTHONPATH=$HOME/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/:cpp_sisso_gnu_param_py_env/lib/python3.7/site-packages/
- mkdir build_param_py/
- cd build_param_py/
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILE=gcc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=OFF -DBUILD_PARAMS=ON -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../gnu_param_py/ ../
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_FLAGS="-O3" -DBUILD_TESTS=OFF -DBUILD_PARAMS=ON -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../gnu_param_py/ ../
- make
- make install
- cd ../
......@@ -337,7 +337,7 @@ build-gnu-gcov:
- export PYTHONPATH=$HOME/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/:`pwd`/cpp_sisso_gnu_gcov_env/lib/python3.7/site-packages/
- mkdir build_gcov/
- cd build_gcov/
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILE=gcc -DCMAKE_BUILD_TYPE="Coverage" -DMPIEXEC_EXECUTABLE=/usr/bin/mpiexec -DBUILD_TESTS=ON -DBUILD_PARAMS=ON -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../gnu_gcov/ ../
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE="Coverage" -DMPIEXEC_EXECUTABLE=/usr/bin/mpiexec -DBUILD_TESTS=ON -DBUILD_PARAMS=ON -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../gnu_gcov/ ../
- make install
- make coverage
- cd ../
......@@ -357,7 +357,7 @@ build-gnu-lcov:
- export PYTHONPATH=$HOME/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/:`pwd`/cpp_sisso_gnu_lcov_env/lib/python3.7/site-packages/
- mkdir build_lcov/
- cd build_lcov/
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILE=gcc -DCMAKE_BUILD_TYPE="Coverage" -DMPIEXEC_EXECUTABLE=/usr/bin/mpiexec -DBUILD_TESTS=ON -DBUILD_PARAMS=ON -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../gnu_lcov/ ../
- cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE="Coverage" -DMPIEXEC_EXECUTABLE=/usr/bin/mpiexec -DBUILD_TESTS=ON -DBUILD_PARAMS=ON -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=../gnu_lcov/ ../
- make install
- make coverage_html
- cd ../
......
......@@ -30,6 +30,10 @@ option(BUILD_PYTHON "Whether to compile with python binding support" ON)
option(BUILD_PARAMS "If true use non-linear parameterization" OFF)
option(BUILD_TESTS "Whether to compile with python binding support" OFF)
if(NOT ${EXTERNAL_BUILD_N_PROCS})
set(EXTERNAL_BUILD_N_PROCS "1")
endif()
if(BUILD_PARAMS)
message(STATUS "BUILD_PARAMS True")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPARAMETERIZE")
......@@ -59,10 +63,10 @@ if(EXTERNAL_BOOST)
message(STATUS "Using external boost")
set(EXTERNAL_BOOST TRUE)
else(EXTERNAL_BOOST)
if(NOT DEFINED BOOST_BUILD_N_PROCS)
set(BOOST_BUILD_N_PROCS 1 CACHE STRING "Number of processes to use when building Boost")
if(NOT DEFINED EXTERNAL_BUILD_N_PROCS)
set(EXTERNAL_BUILD_N_PROCS 1 CACHE STRING "Number of processes to use when building Boost")
endif()
message(STATUS "Building boost wth ${BOOST_BUILD_N_PROCS} process(es)")
message(STATUS "Building boost wth ${EXTERNAL_BUILD_N_PROCS} process(es)")
include( ExternalProject )
set(EXTERNAL_BOOST FALSE)
endif()
......@@ -134,6 +138,19 @@ if(BUILD_PYTHON)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${PYTHON_EXECUTABLE}
-c "import numpy; print(numpy.__version__)"
OUTPUT_VARIABLE NUMPY_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(LENGTH "${NUMPY_VERSION}" NPV_LEN)
if(NPV_LEN EQUAL "0")
message(FATAL_ERROR "numpy must be installed")
else()
message(STATUS "numpy version ${NUMPY_VERSION} ${NPV_LEN} found")
endif()
message(STATUS "PYTHON_LIBDIR = ${PYTHON_LIBDIR}")
message(STATUS "PYTHON_INSTDIR = ${PYTHON_INSTDIR}")
......@@ -263,8 +280,8 @@ else(EXTERNAL_BOOST)
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ${Boost_CONFIGURE_COMMAND}
BUILD_COMMAND
./b2 -j ${BOOST_BUILD_N_PROCS}
INSTALL_COMMAND ./b2 -j ${BOOST_BUILD_N_PROCS} install
./b2 -j ${EXTERNAL_BUILD_N_PROCS}
INSTALL_COMMAND ./b2 -j ${EXTERNAL_BUILD_N_PROCS} install
INSTALL_DIR ${Boost_INSTALL_DIR}
)
......@@ -272,42 +289,11 @@ else(EXTERNAL_BOOST)
set( Boost_LIBRARY_SUFFIX .so )
set( Boost_LIBRARY_PREFIX lib )
add_library( boost::mpi SHARED IMPORTED )
set_property( TARGET boost::mpi PROPERTY IMPORTED_LOCATION ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_mpi${Boost_LIBRARY_SUFFIX} )
set_property( TARGET boost::mpi PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS} )
add_dependencies(boost::mpi external_boost)
add_library( boost::serialization SHARED IMPORTED )
set_property( TARGET boost::serialization PROPERTY IMPORTED_LOCATION ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_serialization${Boost_LIBRARY_SUFFIX} )
set_property( TARGET boost::serialization PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS} )
add_dependencies(boost::serialization external_boost)
add_library( boost::system SHARED IMPORTED )
set_property( TARGET boost::system PROPERTY IMPORTED_LOCATION ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_system${Boost_LIBRARY_SUFFIX} )
set_property( TARGET boost::system PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS} )
add_dependencies(boost::system external_boost)
add_library( boost::filesystem SHARED IMPORTED )
set_property( TARGET boost::filesystem PROPERTY IMPORTED_LOCATION ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_filesystem${Boost_LIBRARY_SUFFIX} )
set_property( TARGET boost::filesystem PROPERTY INTERFACE_LINK_LIBRARIES boost::system )
set_property( TARGET boost::filesystem PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS} )
add_dependencies(boost::filesystem external_boost)
set(Boost_LIBRARIES ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_mpi${Boost_LIBRARY_SUFFIX})
list(APPEND Boost_LIBRARIES ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_serialization${Boost_LIBRARY_SUFFIX})
list(APPEND Boost_LIBRARIES ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_system${Boost_LIBRARY_SUFFIX})
list(APPEND Boost_LIBRARIES ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_filesystem${Boost_LIBRARY_SUFFIX})
if(BUILD_PYTHON)
add_library( boost::python${BOOST_PYTHON_VERSION} SHARED IMPORTED )
set_property( TARGET boost::python${BOOST_PYTHON_VERSION} PROPERTY IMPORTED_LOCATION ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_python${BOOST_PYTHON_VERSION}${Boost_LIBRARY_SUFFIX} )
set_property( TARGET boost::python${BOOST_PYTHON_VERSION} PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS} )
add_dependencies(boost::python${BOOST_PYTHON_VERSION} external_boost)
add_library( boost::numpy${BOOST_PYTHON_VERSION} SHARED IMPORTED )
set_property( TARGET boost::numpy${BOOST_PYTHON_VERSION} PROPERTY IMPORTED_LOCATION ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_numpy${BOOST_PYTHON_VERSION}${Boost_LIBRARY_SUFFIX} )
set_property( TARGET boost::numpy${BOOST_PYTHON_VERSION} PROPERTY INTERFACE_LINK_LIBRARIES boost::system )
set_property( TARGET boost::numpy${BOOST_PYTHON_VERSION} PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS} )
add_dependencies(boost::numpy${BOOST_PYTHON_VERSION} external_boost)
set(Boost_PYTHON_LIBRARIES ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_python${BOOST_PYTHON_VERSION}${Boost_LIBRARY_SUFFIX})
list(APPEND Boost_PYTHON_LIBRARIES ${Boost_LIBRARY_DIRS}/${Boost_LIBRARY_PREFIX}boost_numpy${BOOST_PYTHON_VERSION}${Boost_LIBRARY_SUFFIX})
endif()
......@@ -399,7 +385,7 @@ ExternalProject_Add(
GIT_REPOSITORY "https://github.com/coin-or/CoinUtils.git"
GIT_TAG "releases/2.11.4"
CONFIGURE_COMMAND "${COIN_UTILS_CONFIGURE_COMMAND}"
BUILD_COMMAND make -j ${BOOST_BUILD_N_PROCS}
BUILD_COMMAND make -j ${EXTERNAL_BUILD_N_PROCS}
INSTALL_COMMAND "${COIN_UTILS_MAKE_INSTALL_COMMAND}"
BINARY_DIR "${COIN_UTILS_BUILD_DIR}"
INSTALL_DIR "${COIN_UTILS_INSTALL_DIR}"
......@@ -411,12 +397,12 @@ ExternalProject_Add(
GIT_REPOSITORY "https://github.com/coin-or/Clp.git"
GIT_TAG "releases/1.17.6"
CONFIGURE_COMMAND "${COIN_CLP_CONFIGURE_COMMAND}"
BUILD_COMMAND make -j ${BOOST_BUILD_N_PROCS}
BUILD_COMMAND make -j ${EXTERNAL_BUILD_N_PROCS}
INSTALL_COMMAND ${COIN_CLP_MAKE_INSTALL_COMMAND}
BINARY_DIR "${COIN_CLP_BUILD_DIR}"
INSTALL_DIR "${COIN_CLP_INSTALL_DIR}"
)
add_dependencies(external_Clp external_CoinUtils)
ExternalProject_Add_StepDependencies(external_Clp build external_CoinUtils)
set(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY_DIRS}/libClp.so;${COIN_CLP_LIBRARY_DIRS}/libCoinUtils.so")
include_directories(${COIN_CLP_INCLUDE_DIRS})
......@@ -524,16 +510,22 @@ if (CMAKE_BUILD_TYPE STREQUAL "Coverage")
EXECUTABLE make test
DEPENDENCIES ${COV_DEPS}
BASE_DIRECTORY "${CMAKE_SOURCE_DIR}/"
EXCLUDE "${CMAKE_BINARY_DIR}/" "src/external/*" "src/mpi_interface/*" "/usr/*" "${PYTHON_INCLUDE_PATH}/*" "${MPI_CXX_INCLUDE_DIRS}/*" "src/utils/mkl_*" "tests/*"
EXCLUDE "${CMAKE_BINARY_DIR}/" "src/external/*" "/usr/*" "${PYTHON_INCLUDE_PATH}/*" "${MPI_CXX_INCLUDE_DIRS}/*" "src/utils/mkl_*" "tests/*"
)
setup_target_for_coverage_gcovr_html(
NAME "coverage-gcov-html"
EXECUTABLE make test
DEPENDENCIES ${COV_DEPS}
BASE_DIRECTORY "${CMAKE_SOURCE_DIR}/"
EXCLUDE "${CMAKE_BINARY_DIR}/" "src/external/*" "src/mpi_interface/*" "/usr/*" "${PYTHON_INCLUDE_PATH}/*" "${MPI_CXX_INCLUDE_DIRS}/*" "src/utils/mkl_*" "tests/*"
EXCLUDE "${CMAKE_BINARY_DIR}/" "src/external/*" "/usr/*" "${PYTHON_INCLUDE_PATH}/*" "${MPI_CXX_INCLUDE_DIRS}/*" "src/utils/mkl_*" "tests/*"
)
else()
message(STATUS "Unable to build coverage target for the current compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endif() #CMAKE_BUILD_TYPE STREQUAL "Coverage"
if(${CMAKE_VERSION} VERSION_LESS "3.15")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_INSTALL_PREFIX}/bin/" "${CMAKE_INSTALL_PREFIX}/lib/" "${CMAKE_INSTALL_PREFIX}/tests/" "${NLOPT_INSTALL_DIR}" "${COIN_UTILS_INSTALL_DIR}" "${COIN_CLP_INSTALL_DIR}" "${GTEST_INSTALL_DIR}" "${FMT_INSTALL_DIR}")
else()
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${CMAKE_INSTALL_PREFIX}/bin/" "${CMAKE_INSTALL_PREFIX}/lib/" "${CMAKE_INSTALL_PREFIX}/tests/" "${NLOPT_INSTALL_DIR}" "${COIN_UTILS_INSTALL_DIR}" "${COIN_CLP_INSTALL_DIR}" "${GTEST_INSTALL_DIR}" "${FMT_INSTALL_DIR}")
endif()
......@@ -102,6 +102,12 @@ Define the flags used by the compiler to build the C++ source files. It is recom
Define the flags used by the compiler to build the C source files (GTest and {fmt}). It is recommended to use `-O2` or `-O3` level of optimizations, but it can be changed to match the compiler.
#### `CMAKE_INSTALL_PREFIX`
Default: SISSO++ Source Directory
Path to where the final library and executable files will be placed
### Installation Settings
#### `BUILD_PARAMS`
......@@ -129,14 +135,10 @@ Default: OFF
If `EXTERNAL_BOOST` is ON then use the pre-built Boost Libraries currently in your path or in `$ENV{BOOST_ROOT}`
Here the `-O3` flag is for optimizations, it is recommended to stay as `-O3` or `-O2`, but it can be changed to match compiler requirements.
When building Boost from source (`EXTERNAL_BOOST OFF`) the number of processes used when building Boost may be set using the
`BOOST_BUILD_N_PROCS` flag in CMake. For example, to build Boost using 4 processes, the following flag should be included in the
`initial_config.cmake` file:
We recommend to use `-DEXTERNAL_BOOST=OFF` if you are building the python bindings with an anaconda environment or if you are using non-standard C++ or MPI libraries. If the boost libraries have already been built with the same C++ compiler, MPI library, and Python environment, then `EXTERNAL_BOOST=ON` can be used.
```
#set(BOOST_BUILD_N_PROCS 4 CACHE STRING "")
```
#### EXTERNAL_BUILD_N_PROCS
This flag will have no effect when linking against external boost, i.e. `EXTERNAL_BOOST ON`.
Default: 1
We recommend to use `-DEXTERNAL_BOOST=OFF` if you are building the python bindings with an anaconda environment or if you are using non-standard C++ or MPI libraries. If the boost libraries have already been built with the same C++ compiler, MPI library, and Python environment, then `EXTERNAL_BOOST=ON` can be used.
The number of processes passed to make when building external libraries.
......@@ -35,6 +35,14 @@ set_target_properties(libsisso
target_link_libraries(libsisso ${LAPACK_LIBRARIES} ${MPI_LIBRARIES} -Wl,--rpath=${Boost_LIB_DIR} -Wl,--rpath=${LAPACK_DIR} ${Boost_LIBRARIES} ${COIN_CLP_LIBRARIES} ${OPENMP_LIBRARIES} ${FMT_LIBRARIES})
install(TARGETS libsisso DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/)
add_dependencies(libsisso external_fmt external_CoinUtils external_Clp)
if(BUILD_PARAMS)
add_dependencies(libsisso external_nlopt)
endif()
if(NOT EXTERNAL_BOOST)
add_dependencies(libsisso external_boost)
endif()
add_executable(sisso++ ${CMAKE_CURRENT_LIST_DIR}/main.cpp)
set_target_properties(sisso++
......@@ -43,6 +51,7 @@ set_target_properties(sisso++
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
add_dependencies(sisso++ libsisso)
target_link_libraries(sisso++ libsisso ${LAPACK_LIBRARIES} ${MPI_LIBRARIES} -Wl,--rpath=${Boost_LIB_DIR} -Wl,--rpath=${LAPACK_DIR} ${Boost_LIBRARIES} ${COIN_CLP_LIBRARIES} ${NLOPT_LIBRARIES} ${OPENMP_LIBRARIES} ${FMT_LIBRARIES})
install(TARGETS sisso++ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/)
......@@ -128,6 +137,7 @@ if(BUILD_PYTHON)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPY_BINDINGS")
add_library(_sisso SHARED ${SISSOLIB_SOURCES})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/python/__init__.py ${CMAKE_CURRENT_LIST_DIR}/python/__init__.py COPYONLY)
add_dependencies(_sisso libsisso)
set_target_properties(_sisso
PROPERTIES
......
......@@ -3,6 +3,12 @@ set(CMAKE_INSTALL_RPATH ${Boost_LIBRARY_DIRS};${LAPACK_DIR};${MPI_DIR};${COIN_CL
file(GLOB_RECURSE SISSO_TEST_SOURCES *.cc)
add_executable(sisso_test ${SISSO_TEST_SOURCES})
add_dependencies(sisso_test libsisso)
string(LENGTH "${GTEST_BUILD_DIR}" GT_LEN)
if(${GT_LEN} GREATER "0")
add_dependencies(sisso_test external_gtest)
endif()
set_target_properties(sisso_test
PROPERTIES
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment