-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from TcT2k/cmake_package
Add CPack support to provide Win32 binaries and github releases
- Loading branch information
Showing
9 changed files
with
219 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This is the EditorConfig (http://editorconfig.org/) coding style file for | ||
# openswe1r | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright 2017 OpenSWE1R Maintainers | ||
// Licensed under GPLv2 or any later version | ||
// Refer to the included LICENSE.txt file. | ||
|
||
// THIS FILE IS CREATE AUTOMATICALLY DO NOT EDIT | ||
|
||
#define APP_VERSION_STRING "@APP_VERSION@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This script will determine the current version based on git revision | ||
# or tag and create information files to be consumed during compile | ||
# and package time | ||
|
||
include(${CMAKE_SOURCE_DIR}/cmake/determine_app_version.cmake) | ||
|
||
# Write app version to header if changed | ||
set(APP_VERSION_FILE_NEEDS_UPDATE TRUE) | ||
set(APP_VERSION_FILE "${APP_VERSION_DIR}/app_version.h") | ||
if(EXISTS ${APP_VERSION_FILE}) | ||
file(READ ${APP_VERSION_FILE} VERSION_H_CONTENTS) | ||
string(REGEX MATCH "APP_VERSION_STRING[ \t]+\"(.+)\"" | ||
FILE_VERSION ${VERSION_H_CONTENTS}) | ||
string(REGEX MATCH "\"(.+)\"" | ||
FILE_VERSION ${FILE_VERSION}) | ||
string(REGEX MATCH "[^\"]+" | ||
FILE_VERSION ${FILE_VERSION}) | ||
if(FILE_VERSION STREQUAL APP_VERSION) | ||
set(APP_VERSION_FILE_NEEDS_UPDATE FALSE) | ||
endif() | ||
endif() | ||
|
||
if(APP_VERSION_FILE_NEEDS_UPDATE) | ||
configure_file("${CMAKE_SOURCE_DIR}/app_version.h.in" ${APP_VERSION_FILE} @ONLY) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This script will determine the current version based on git revision or tag | ||
|
||
# Determine version number | ||
|
||
# When AppVeyor builds a tag use that tags name as version | ||
if("$ENV{APPVEYOR_REPO_TAG}" STREQUAL "true") | ||
set(APP_VERSION $ENV{APPVEYOR_REPO_TAG_NAME}) | ||
else() | ||
# Default to git revision | ||
execute_process( | ||
COMMAND git show -s --format=%h | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE GIT_REVISION | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
set(APP_VERSION g${GIT_REVISION}) | ||
endif() | ||
|
||
# Determine if the current version is "dirty" | ||
execute_process( | ||
COMMAND git status --porcelain | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE GIT_STATUS | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
if(GIT_STATUS) | ||
string(APPEND APP_VERSION "-dirty") | ||
endif() | ||
|
||
if(APP_BUILD_CONFIG) | ||
string(APPEND APP_VERSION "-${APP_BUILD_CONFIG}") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Configure CPack variables before including CPack | ||
|
||
set(CPACK_PACKAGE_VENDOR OpenSWE1R) | ||
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt) | ||
|
||
if(NOT CPACK_GENERATOR) | ||
# Set default list of supported CPack generators if not specified by the user | ||
if(WIN32 OR APPLE) | ||
set(CPACK_GENERATOR "ZIP") | ||
else() | ||
set(CPACK_GENERATOR "TGZ") | ||
endif() | ||
endif() | ||
|
||
include(cmake/determine_app_version.cmake) | ||
set(CPACK_PACKAGE_VERSION ${APP_VERSION}) | ||
set(CPACK_PACKAGE_FILE_NAME OpenSWE1R-${APP_VERSION}) | ||
|
||
include(CPack) | ||
|
||
# Install required files | ||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ".") | ||
|
||
# Install main binaries | ||
install(TARGETS openswe1r | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION} | ||
) | ||
|
||
# Install documentation | ||
install(FILES README.md LICENSE.txt DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}) | ||
|
||
# Install additional binary modules | ||
if(MSVC) | ||
# Install required runtime libraries | ||
include(InstallRequiredSystemLibraries) | ||
|
||
# vcpkg will automatically move the required binaries to the build folder | ||
foreach(lib OpenAL32 unicorn SDL2) | ||
install(FILES $<TARGET_FILE_DIR:openswe1r>/${lib}.dll | ||
DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION} | ||
) | ||
endforeach() | ||
install(FILES $<TARGET_FILE_DIR:openswe1r>/glew32$<$<CONFIG:Debug>:d>.dll | ||
DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION} | ||
) | ||
endif() |