Merge pull request #72 from bkryza/add-windows-installer

Added Windows installer target using CPack and NSIS
This commit is contained in:
Bartek Kryza
2023-01-08 18:08:13 +01:00
committed by GitHub
3 changed files with 66 additions and 2 deletions

View File

@@ -28,7 +28,35 @@ set(UML_HEADERS_DIR ${PROJECT_SOURCE_DIR}/src/uml)
# #
option(LINK_LLVM_SHARED "Should LLVM be linked using shared libraries or statically" ON) option(LINK_LLVM_SHARED "Should LLVM be linked using shared libraries or statically" ON)
set(LLVM_VERSION CACHE STRING "Path to custom llvm-config executable") set(LLVM_VERSION CACHE STRING "Path to custom llvm-config executable")
set(GIT_VERSION "0.3.0" CACHE STRING "clang-uml version")
#
# Setup version string
#
find_package(Git)
if(NOT DEFINED GIT_VERSION)
if(GIT_EXECUTABLE)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags --always --abbrev=7
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION
RESULT_VARIABLE GIT_ERROR_CODE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif(GIT_EXECUTABLE)
endif(NOT DEFINED GIT_VERSION)
if(NOT DEFINED GIT_VERSION)
set(GIT_VERSION "0.0.0-unknown")
endif(NOT DEFINED GIT_VERSION)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.(.+)"
GIT_VERSION_MATCH ${GIT_VERSION})
set(GIT_VERSION_MAJOR ${CMAKE_MATCH_1})
set(GIT_VERSION_MINOR ${CMAKE_MATCH_2})
set(GIT_VERSION_PATCH ${CMAKE_MATCH_3})
message(STATUS "clang-uml version: ${GIT_VERSION_MAJOR}.${GIT_VERSION_MINOR}.${GIT_VERSION_PATCH}")
# #
# Setup LLVM # Setup LLVM
@@ -214,6 +242,32 @@ install(TARGETS clang-uml DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES LICENSE.md DESTINATION ${CMAKE_INSTALL_DOCDIR}) install(FILES LICENSE.md DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES README.md DESTINATION ${CMAKE_INSTALL_DOCDIR}) install(FILES README.md DESTINATION ${CMAKE_INSTALL_DOCDIR})
#
# Setup installer
#
set(CPACK_PACKAGE_NAME "clang-uml")
set(CPACK_PACKAGE_VENDOR "Bartek Kryza <bkryza@gmail.com>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "clang-uml - C++ UML diagram generator based on Clang")
set(CPACK_PACKAGE_VERSION "${GIT_VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${GIT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${GIT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${GIT_VERSION_PATCH}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "clang-uml")
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md)
if(MSVC)
set(CPACK_GENERATOR "NSIS")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_DISPLAY_NAME "clang-uml")
set(CPACK_NSIS_HELP_LINK "https://github.com/bkryza/clang-uml")
set(CPACK_NSIS_URL_INFO_ABOUT "https://github.com/bkryza/clang-uml")
set(CPACK_NSIS_CONTACT "Bartek Kryza <bkryza@gmail.com>")
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_SOURCE_GENERATOR "ZIP")
endif(MSVC)
include(CPack)
# #
# Enable testing via CTest # Enable testing via CTest
# #

View File

@@ -179,7 +179,7 @@ recommend that a file or class name and description of purpose be included on
the same “printed page” as the copyright notice for easier identification within the same “printed page” as the copyright notice for easier identification within
third-party archives. third-party archives.
Copyright [yyyy] [name of copyright owner] Copyright 2021-2023 Bartek Kryza <bkryza@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@@ -38,4 +38,14 @@ docker run --rm -v $PWD:$PWD continuumio/miniconda3 bash
conda install conda-build make conda install conda-build make
cd packaging cd packaging
make CONDA_TOKEN=<TOKEN> conda make CONDA_TOKEN=<TOKEN> conda
```
## Windows
First build release configuration using `cmake` and `msbuild` according
to the [documentation](../docs/installation.md#visual-studio-native-build).
```bash
cd <MSBUILD_BUILD_DIRECTORY>
cpack -C "Release" -G NSIS64
``` ```