]> granicus.if.org Git - graphviz/commitdiff
Add install target and initial packaging to CMake
authorErwin Janssen <erwinjanssen@outlook.com>
Thu, 29 Dec 2016 11:41:06 +0000 (12:41 +0100)
committerErwin Janssen <erwinjanssen@outlook.com>
Thu, 19 Jan 2017 11:53:49 +0000 (12:53 +0100)
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
appveyor.yml
ci/cmake-build_and_test.sh
lib/cdt/CMakeLists.txt

index 8d03de7b1c03b64a7cd4d367fcd0baa7b06f5113..709f687efe1716acb6ee11030b9521037c353ca8 100644 (file)
@@ -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)
index e0d0763e4153d9ecfc793a9b0995e34e3b335bde..fd7f45632c52c8d46a9b8ea6dd53a6065b8585ee 100644 (file)
@@ -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") {
index 0e8a186206ebf8775653823c4e18ff8c2122311d..ca938c9d9c7b4d4e3b758fb0d525711475fba676 100755 (executable)
@@ -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
index 36827c05387ca7d95c63c51839f6e0671bcb4eaa..b96326587e58b91c9c2a3fdcf91bb49b87893bf4 100644 (file)
@@ -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}
+)