Skip to content
Snippets Groups Projects
Commit e5aedcdc authored by Martin Heistermann's avatar Martin Heistermann
Browse files

Merge branch 'dev' into 'master'

Add test programs nad compile them in CI; fix gurobi finder

See merge request CGG-public/cmake-library!1
parents 0b53d569 5cd89df6
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,8 @@ test-linux:
script:
- mkdir build
- cd build
- cmake ../CI
- cmake ../CI -G Ninja
- ninja
test-windows:
......@@ -18,5 +19,7 @@ test-windows:
script:
- mkdir build
- cd build
- cmake ../CI
- cmake ../CI -G "NMake Makefiles"
- nmake
allow_failure: true
......@@ -21,3 +21,6 @@ find_package(Gurobi )
find_package(GMM REQUIRED)
find_package(Gurobi REQUIRED)
add_subdirectory(tests)
file(GLOB tests
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/*")
foreach(test ${tests})
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${test}")
message(STATUS "add_subdirectory(${test})")
add_subdirectory("${test}")
endif()
endforeach()
add_executable(test_c "test_c.c")
target_link_libraries(test_c Gurobi::Gurobi)
add_executable(test_cxx "test_cxx.cc")
target_link_libraries(test_cxx Gurobi::GurobiCXX)
#include <gurobi_c.h>
int main(int argc, char *argv[])
{
int major, minor, technical;
GRBversion(&major, &minor, &technical);
return 0;
}
#include <gurobi_c++.h>
int main(int argc, char *argv[])
{
GRBEnv env;
GRBModel model {env};
return 0;
}
......@@ -79,7 +79,8 @@ if(NOT TARGET Gurobi::GurobiCXX)
target_compile_definitions(GurobiCXX PRIVATE "WIN64")
endif()
target_include_directories(GurobiCXX PRIVATE ${GUROBI_INCLUDE_DIR})
target_include_directories(GurobiCXX PUBLIC ${GUROBI_INCLUDE_DIR})
target_link_libraries(GurobiCXX PUBLIC ${GUROBI_LIBRARY})
# We need to be able to link this into a shared library:
set_target_properties(GurobiCXX PROPERTIES POSITION_INDEPENDENT_CODE ON)
......@@ -103,7 +104,7 @@ mark_as_advanced(GUROBI_INCLUDE_DIR GUROBI_LIBRARY GUROBI_CXX_LIBRARY GUROBI_BIN
if(GUROBI_FOUND AND NOT TARGET Gurobi::Gurobi)
add_library(Gurobi::GurobiC INTERFACE IMPORTED)
target_include_directories(Gurobi::GurobiC INTERFACE ${GMM_INCLUDE_DIR})
target_include_directories(Gurobi::GurobiC INTERFACE ${GUROBI_INCLUDE_DIR})
target_link_libraries(Gurobi::GurobiC INTERFACE ${GUROBI_LIBRARY})
add_library(Gurobi::Gurobi INTERFACE IMPORTED)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment