From fedfae9505faefb83de6b0e8aeeda13bcad2d1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kr=C3=A4mer?= Date: Tue, 26 May 2020 08:41:56 +0200 Subject: [PATCH 1/3] update cmake files for conda build --- CMakeLists.txt | 1 - python/CMakeLists.txt | 7 ++++++- tests/CMakeLists.txt | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1599ad10..ba32cedf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,6 @@ option (USE_OPENMP "Use OpenMP for multithreading" ON) option (ENABLE_SURROG "support for surrogates" ON) set (HAVE_SURROG ${ENABLE_SURROG}) option (USE_COMPILE_FEATURES "use cmake>=3.1 cxx11 detection" ON) -option (LINK_PYTHON "link python libraries" ON) # Offer the user the choice of overriding the installation directories set (INSTALL_LIB_DIR lib${LIB_SUFFIX} CACHE PATH "Installation directory for libraries") diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 8c391c24..0c6dc2b6 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -6,11 +6,16 @@ include_directories (${NUMPY_INCLUDE_DIRS}) include_directories (${Boost_INCLUDE_DIRS}) python_add_module (lcmaes lcmaes.cc) + target_link_libraries(lcmaes cmaes ${Boost_LIBRARIES}) -if (LINK_PYTHON) + +if (WIN32) target_link_libraries(lcmaes ${PYTHON_LIBRARIES}) +elseif (APPLE) + set_target_properties(lcmaes PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif () + install (TARGETS lcmaes DESTINATION ${PYTHON_SITE_PACKAGES}) set (PYINSTALLCHECK_ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 331cd2cd..1894bb11 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,7 +7,7 @@ macro (cmaes_add_test name) target_link_libraries (t_${name} cmaes) add_test (NAME ${name} COMMAND t_${name}) if (WIN32) - set_tests_properties (${name} PROPERTIES ENVIRONMENT "PATH=${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE};$ENV{PATH}") # to load dll + set_tests_properties (${name} PROPERTIES ENVIRONMENT "PATH=${PROJECT_BINARY_DIR}\\src;${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE};$ENV{PATH}") # to load dll endif () endmacro () From 5ce15c7169b3e612f4c8edd4d4eb19fc14ccd259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kr=C3=A4mer?= <30830507+Olllom@users.noreply.github.com> Date: Tue, 26 May 2020 13:27:20 +0200 Subject: [PATCH 2/3] try without path change --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1894bb11..331cd2cd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,7 +7,7 @@ macro (cmaes_add_test name) target_link_libraries (t_${name} cmaes) add_test (NAME ${name} COMMAND t_${name}) if (WIN32) - set_tests_properties (${name} PROPERTIES ENVIRONMENT "PATH=${PROJECT_BINARY_DIR}\\src;${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE};$ENV{PATH}") # to load dll + set_tests_properties (${name} PROPERTIES ENVIRONMENT "PATH=${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE};$ENV{PATH}") # to load dll endif () endmacro () From 9aad782ec918b886b7a8282fa6a3b574bfe778be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kr=C3=A4mer?= Date: Wed, 27 May 2020 09:07:55 +0200 Subject: [PATCH 3/3] swap paths in windows cmake --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 331cd2cd..cc2d0110 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,7 +7,7 @@ macro (cmaes_add_test name) target_link_libraries (t_${name} cmaes) add_test (NAME ${name} COMMAND t_${name}) if (WIN32) - set_tests_properties (${name} PROPERTIES ENVIRONMENT "PATH=${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE};$ENV{PATH}") # to load dll + set_tests_properties (${name} PROPERTIES ENVIRONMENT "PATH=${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE};${PROJECT_BINARY_DIR}\\src;$ENV{PATH}") # to load dll endif () endmacro ()