diff --git a/.gitmodules b/.gitmodules index d7f4710..769c3ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "deps/ipasir2"] path = deps/ipasir2 url = https://github.com/ipasir2/ipasir2 +[submodule "testdeps/ipasir2_solver_lingeling"] + path = testdeps/ipasir2_solver_lingeling + url = https://github.com/ipasir2/ipasir2_solver_lingeling diff --git a/CMakeLists.txt b/CMakeLists.txt index 097fb23..9d4fcb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ target_link_libraries(ipasir2cpp INTERFACE ipasir2) # is deliberately light on compiler options to make sure that the headers don't force # clients to set any. if (MSVC) - add_compile_options( + set(IPASIR2CPP_CXX_OPTS /DNOMINMAX # Keep Windows.h from #defining min() and max() /permissive- # Be strict about C++ conformance /W4 # Use highest warning level @@ -53,7 +53,7 @@ if (MSVC) ) else() # Assume GCC or clang: - add_compile_options( + set(IPASIR2CPP_CXX_OPTS -Wall -Wextra -Wunused diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 39a4b62..630effa 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,13 +1,9 @@ if(WIN32) - # Currently the minisat dependency can't be built in cross-compilation + # Lingeling can't be built on Windows currently return() endif() -include(${CMAKE_CURRENT_LIST_DIR}/../deps/ipasir2/buildutils/load_solvers.cmake) - -load_minisat() - add_executable(examples-all 01_readme.cpp 02_trivial_portfolio.cpp @@ -18,7 +14,8 @@ add_executable(examples-all main.cpp ) -target_link_libraries(examples-all PRIVATE ipasir2cpp minisat) +target_compile_options(examples-all PRIVATE ${IPASIR2CPP_CXX_OPTS}) +target_link_libraries(examples-all PRIVATE ipasir2cpp lingeling-static) if (NOT WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") @@ -34,6 +31,7 @@ add_executable(example-utils-testsuite example_utils_tests.cpp ) +target_compile_options(example-utils-testsuite PRIVATE ${IPASIR2CPP_CXX_OPTS}) target_link_libraries(example-utils-testsuite PRIVATE Catch2::Catch2WithMain) add_test(NAME example-utils-testsuite COMMAND example-utils-testsuite) diff --git a/testdeps/CMakeLists.txt b/testdeps/CMakeLists.txt index eefa977..5b51dfa 100644 --- a/testdeps/CMakeLists.txt +++ b/testdeps/CMakeLists.txt @@ -1,5 +1,11 @@ -if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/Catch2/CMakeLists.txt) +if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/Catch2/CMakeLists.txt + OR NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/ipasir2_solver_lingeling/CMakeLists.txt) message(FATAL_ERROR "git submodules have not been set up yet. Run git submodule update --init") endif() add_subdirectory(Catch2) + +if (NOT WIN32) + set(LGL_BUILD_TOOLS OFF) + add_subdirectory(ipasir2_solver_lingeling) +endif() diff --git a/testdeps/ipasir2_solver_lingeling b/testdeps/ipasir2_solver_lingeling new file mode 160000 index 0000000..9a22a17 --- /dev/null +++ b/testdeps/ipasir2_solver_lingeling @@ -0,0 +1 @@ +Subproject commit 9a22a17279b05607b20d421701fe214bb7dfc4ad diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fc5265b..892909b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,6 +19,7 @@ function(add_test_executables BASENAME) endif() target_include_directories(${name} PRIVATE ${test_base_dir}) + target_compile_options(${name} PRIVATE ${IPASIR2CPP_CXX_OPTS}) target_link_libraries(${name} PRIVATE ipasir2cpp Catch2::Catch2WithMain) add_test(NAME ${name} COMMAND ${name} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) diff --git a/tests/mock/CMakeLists.txt b/tests/mock/CMakeLists.txt index 3732a28..067b8cf 100644 --- a/tests/mock/CMakeLists.txt +++ b/tests/mock/CMakeLists.txt @@ -1,6 +1,7 @@ # The IPASIR2 mock is built as a shared library so it can be used to test # the dynamic-loading functions of the IPASIR2 wrapper: add_library(ipasir2mock SHARED ipasir2_mock.cpp ipasir2_mock.h) +target_compile_options(ipasir2mock PRIVATE ${IPASIR2CPP_CXX_OPTS}) target_link_libraries(ipasir2mock PRIVATE ipasir2) target_compile_definitions(ipasir2mock PRIVATE BUILDING_IPASIR_SHARED_LIB) target_compile_definitions(ipasir2mock INTERFACE IPASIR_SHARED_LIB)