Skip to content

Commit

Permalink
Add installation target to the CMake configuration (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekker1 authored and chschulte committed Dec 18, 2018
1 parent 0cea598 commit 0014735
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
58 changes: 57 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ foreach (lib support kernel search int set float
add_library(gecode${lib} ${sources} ${${libupper}HDR})
target_include_directories(gecode${lib}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND GECODE_INSTALL_TARGETS gecode${lib})
endif ()
endforeach ()

Expand Down Expand Up @@ -433,11 +434,31 @@ if (FLOATSRC)
target_link_libraries(gecodeminimodel gecodefloat)
endif ()

add_executable(gecode-test ${TESTSRC} ${TESTHDR})
add_executable(gecode-test EXCLUDE_FROM_ALL ${TESTSRC} ${TESTHDR})
target_link_libraries(gecode-test gecodeflatzinc gecodeminimodel)

add_executable(fzn-gecode ${FLATZINCEXESRC})
target_link_libraries(fzn-gecode gecodeflatzinc gecodeminimodel gecodedriver)
list(APPEND GECODE_INSTALL_TARGETS fzn-gecode)

set(prefix ${CMAKE_INSTALL_PREFIX})
set(datarootdir \${prefix}/share)
set(datadir \${datarootdir})
if(WIN32)
configure_file(
${PROJECT_SOURCE_DIR}/tools/flatzinc/mzn-gecode.bat.in
${PROJECT_BINARY_DIR}/tools/flatzinc/mzn-gecode.bat
@ONLY
)
set(MZN_SCRIPT ${PROJECT_BINARY_DIR}tools/flatzinc/mzn-gecode.bat)
else()
configure_file(
${PROJECT_SOURCE_DIR}/tools/flatzinc/mzn-gecode.in
${PROJECT_BINARY_DIR}/tools/flatzinc/mzn-gecode
@ONLY
)
set(MZN_SCRIPT ${PROJECT_BINARY_DIR}/tools/flatzinc/mzn-gecode)
endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand All @@ -454,3 +475,38 @@ add_test(test gecode-test
-test Int::Arithmetic::Mult::XYZ::Bnd::C
-test Int::Arithmetic::Mult::XYZ::Dom::A
-test Search::BAB::Sol::BalGr::Binary::Binary::Binary::1::1)

## Installation Target
# Install libraries and executables
install(
TARGETS ${GECODE_INSTALL_TARGETS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(
FILES ${MZN_SCRIPT}
DESTINATION bin
)
# Install include directory
install(
DIRECTORY gecode
DESTINATION include
FILES_MATCHING
PATTERN "**.hh"
PATTERN "**.hpp"
PATTERN "LICENSE_1_0.txt"
PATTERN "mznlib" EXCLUDE
PATTERN "exampleplugin" EXCLUDE
PATTERN "standalone-example" EXCLUDE
PATTERN "abi*" EXCLUDE
)
install(
FILES ${PROJECT_BINARY_DIR}/gecode/support/config.hpp
DESTINATION include/gecode/support/
)
# Install MiniZinc library
install(
DIRECTORY gecode/flatzinc/mznlib
DESTINATION share/gecode
)
8 changes: 8 additions & 0 deletions changelog.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ Date: ?-?-?
[DESCRIPTION]
New stuff!

[ENTRY]
Module: other
What: new
Rank: minor
Thanks: Jip J. Dekker
[DESCRIPTION]
Added installation target to the CMake configuration.

[ENTRY]
Module: kernel
What: new
Expand Down

0 comments on commit 0014735

Please sign in to comment.