From: Erwin Janssen Date: Fri, 31 Mar 2017 07:27:56 +0000 (+0200) Subject: Add Windows installer using NSIS and CPack X-Git-Tag: 2.42.0~183^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00b6f33adbc17f99355f04feca50c0aa1649e15e;p=graphviz Add Windows installer using NSIS and CPack Create a Windows Installer using CPack and the NSIS generator. The CMake build on Appveyor now installs Graphviz using this installer and runs the tests using ctest. The installer is added as an artifact to the Release build. Also switched the order of cmake and msbuild in Appveyor and added `clone_depth: 25` for faster cloning. --- diff --git a/appveyor.yml b/appveyor.yml index cc5330511..068a0525b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,11 +1,14 @@ version: 2.41.{build} +clone_depth: 25 image: Visual Studio 2015 environment: + CTEST_OUTPUT_ON_FAILURE: TRUE + graphviz_install_dir: C:\Graphviz matrix: - - build_system: msbuild - build_system: cmake + - build_system: msbuild configuration: - Debug @@ -52,8 +55,16 @@ build_script: # Test - ps: >- - if($env:build_system -eq "cmake") { - # No tests yet + if($env:build_system -eq "cmake" -and $env:configuration -eq "Release") { + mv Graphviz-*.exe Graphviz-install.exe; + # Install using installer and add bin directory to path. + # Piping the output of the installer to Out-Null, makes the script wait + # for the .exe to exit, instead continuing to the next command (which + # will then fail because the install hasn't finished) + ./Graphviz-install.exe /S /D=$env:graphviz_install_dir | Out-Null; + $env:Path += ";" + $env:graphviz_install_dir + "\bin" + dot -c; + ctest -C $env:configuration; } elseif($env:build_system -eq "msbuild") { # Append build destination to the PATH, configure dot and execute regression tests @@ -68,3 +79,5 @@ artifacts: name: graphviz-windows - path: Debug name: graphviz-windows-debug + - path: build/Graphviz-install.exe + name: Graphviz-Windows-install diff --git a/cmake/FindNSIS.cmake b/cmake/FindNSIS.cmake new file mode 100644 index 000000000..d5600d221 --- /dev/null +++ b/cmake/FindNSIS.cmake @@ -0,0 +1,10 @@ +# CMake does not allow for braces in $ENV{}, so a temporary variable must be used. +set(PROGRAMFILES_X86 "ProgramFiles(x86)") + +find_program(NSIS_MAKE + NAMES makensis + PATHS $ENV{PROGRAMFILES}/NSIS $ENV{${PROGRAMFILES_X86}}/NSIS +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(NSIS DEFAULT_MSG NSIS_MAKE) diff --git a/cmake/package_info.cmake b/cmake/package_info.cmake index 8260abd73..c415ca2c8 100644 --- a/cmake/package_info.cmake +++ b/cmake/package_info.cmake @@ -9,3 +9,14 @@ set(CPACK_RESOURCE_FILE_LICENSE "${TOP_SOURCE_DIR}/LICENSE" ) set(CPACK_RESOURCE_FILE_README "${TOP_SOURCE_DIR}/README.md" ) set(CPACK_GENERATOR ZIP) + +find_package(NSIS) +if(NSIS_FOUND) + set(CPACK_NSIS_MUI_ICON "${TOP_SOURCE_DIR}/windows/build/Graphviz.ico" ) + set(CPACK_NSIS_MUI_UNIICON "${TOP_SOURCE_DIR}/windows/build/Graphviz.ico" ) + set(CPACK_NSIS_INSTALLED_ICON_NAME "Uninstall.exe" ) + set(CPACK_NSIS_HELP_LINK "http://www.graphviz.org" ) + set(CPACK_NSIS_URL_INFO_ABOUT "http://www.graphviz.org" ) + set(CPACK_NSIS_MODIFY_PATH ON ) + LIST(APPEND CPACK_GENERATOR NSIS) +endif()