From 74afcb5194e3e4d182f5564d40ea6abf8c3c00b8 Mon Sep 17 00:00:00 2001 From: Erwin Janssen Date: Thu, 29 Dec 2016 12:41:06 +0100 Subject: [PATCH] Add install target and initial packaging to CMake The installation locations are identical to the Autotools install step, but the pdf version of the manpages aren't generated yet. With CPack, packages can be generated based on the `install` commands. For now only the basic ZIP package generator is added. Added the new CMake commands to the Travis and Appveyor scripts. --- CMakeLists.txt | 16 ++++++++++++++++ appveyor.yml | 3 +++ ci/cmake-build_and_test.sh | 14 ++++++++++++++ lib/cdt/CMakeLists.txt | 20 ++++++++++++++++++++ 4 files changed, 53 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d03de7b1..709f687ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,4 +32,20 @@ message(STATUS "Graphviz version: ${GRAPHVIZ_VERSION_MAJROR}.${GRAPHVIZ_VERSION_ find_package(BISON REQUIRED) find_package(FLEX REQUIRED) +# Convenient values for CMake configuration +# ========================================= +set(BINARY_INSTALL_DIR bin) +set(LIBRARY_INSTALL_DIR lib) +set(HEADER_INSTALL_DIR include/graphviz) +set(MAN_INSTALL_DIR share/man/man3) +# TODO: Find a way to check for groff and ps2pdf for manpage pdf generation +# set(MAN_PDF_INSTALL_DIR share/graphviz/doc/pdf) + + +# Packaging information +# ===================== +set(CPACK_GENERATOR ZIP) + +include(CPack) + add_subdirectory(lib) diff --git a/appveyor.yml b/appveyor.yml index e0d0763e4..fd7f45632 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -59,6 +59,9 @@ build_script: cd build; cmake ..; cmake --build . --config $env:configuration; + if($env:configuration -eq "Release") { + cpack; + } } if ($env:build_system -eq "msys2" -Or $env:compiler -eq "cygwin") { diff --git a/ci/cmake-build_and_test.sh b/ci/cmake-build_and_test.sh index 0e8a18620..ca938c9d9 100755 --- a/ci/cmake-build_and_test.sh +++ b/ci/cmake-build_and_test.sh @@ -19,3 +19,17 @@ else echo "Error: 'cmake --build .' failed." >&2 exit 1 fi + +if cpack ; then + echo "'cpack' succesfull." +else + echo "Error: 'cpack' failed." >&2 + exit 1 +fi + +if make install ; then + echo "'make install' succesfull." +else + echo "Error: 'make install' failed." >&2 + exit 1 +fi diff --git a/lib/cdt/CMakeLists.txt b/lib/cdt/CMakeLists.txt index 36827c053..b96326587 100644 --- a/lib/cdt/CMakeLists.txt +++ b/lib/cdt/CMakeLists.txt @@ -28,3 +28,23 @@ add_library(cdt SHARED # Link definition file for Windows cdt.def ) + +# Installation location of library files +install( + TARGETS cdt + RUNTIME DESTINATION ${BINARY_INSTALL_DIR} + LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} +) + +# Installation location of header files +install( + FILES cdt.h + DESTINATION ${HEADER_INSTALL_DIR} +) + +# Installation location of man page +install( + FILES cdt.3 + DESTINATION ${MAN_INSTALL_DIR} +) -- 2.40.0