1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00

Merge pull request #503 from madebr/cpack

Use CPack to create archives on appveyor
This commit is contained in:
darkf 2018-06-08 21:11:43 -05:00 committed by GitHub
commit e17f17cbce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 61 additions and 14 deletions

View File

@ -38,3 +38,8 @@ init:
build_script:
- ctest -VV -S cmake/ctest/script_ci.ctest
after_build:
- cd "%APPVEYOR_BUILD_FOLDER%\build"
- cpack -C Release -G TXZ
- appveyor PushArtifact OpenRW-%APPVEYOR_REPO_COMMIT:~0,8%.tar.xz

17
CMakeCPack.cmake Normal file
View File

@ -0,0 +1,17 @@
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenRW 'Open ReWrite' is an un-official open source recreation of the classic Grand Theft Auto III game executable")
set(CPACK_PACKAGE_VENDOR "openrw")
# FIXME: better description of the project
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
string(SUBSTRING "${GIT_SHA1}" 0 8 GIT_SHA1_SHORT)
set(CPACK_PACKAGE_VERSION "${GIT_SHA1_SHORT}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${GIT_SHA1_SHORT}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${GIT_SHA1_SHORT}")
# set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CMakeCPackOptions.cmake")
include(CPack)

View File

@ -2,12 +2,19 @@ cmake_minimum_required(VERSION 3.2.2)
project(OpenRW)
include(GNUInstallDirs)
# Read the configuration arguments
include("${PROJECT_SOURCE_DIR}/cmake_options.cmake")
# Create a rw_interface TARGET that holds all compiler options
include("${PROJECT_SOURCE_DIR}/cmake_configure.cmake")
# Include git hash in source
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
message(STATUS "Building ${CMAKE_PROJECT_NAME} GIT SHA1: ${GIT_SHA1}")
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)
find_package(OpenAL REQUIRED)
@ -20,10 +27,6 @@ if(CHECK_CLANGTIDY)
find_package(ClangTidy REQUIRED)
endif()
# Include git hash in source
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
add_subdirectory(rwlib)
add_subdirectory(rwengine)
add_subdirectory(rwgame)
@ -38,13 +41,13 @@ if(BUILD_TESTS)
endif()
# Copy the license to the install directory
if(CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD")
install(FILES COPYING
DESTINATION "${DOC_DIR}"
)
endif()
install(FILES COPYING
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
)
# Copy the license to the build directory (for CI)
file(COPY COPYING
DESTINATION "${PROJECT_BINARY_DIR}"
)
include(CMakeCPack.cmake)

View File

@ -14,9 +14,6 @@ set_property(CACHE FAILED_CHECK_ACTION PROPERTY STRINGS "IGNORE" "ABORT" "BREAKP
set(FILESYSTEM_LIBRARY "BOOST" CACHE STRING "Which filesystem library to use")
set_property(CACHE FILESYSTEM_LIBRARY PROPERTY STRINGS "CXX17" "CXXTS" "BOOST")
set(BIN_DIR "bin" CACHE STRING "Prefix subdirectory to put the binaries in.")
set(DOC_DIR "share/doc/openrw" CACHE STRING "Prefix subdirectory to put the documentation in.")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: Debug Release")
endif()

View File

@ -159,3 +159,10 @@ target_include_directories(rwengine
)
openrw_target_apply_options(TARGET rwengine)
if(BUILD_SHARED_LIBS)
install(TARGETS rwengine
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()

View File

@ -65,4 +65,6 @@ target_link_libraries(rwgame
openrw_target_apply_options(TARGET rwgame)
install(TARGETS rwgame RUNTIME DESTINATION "${BIN_DIR}")
install(TARGETS rwgame
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)

View File

@ -63,4 +63,16 @@ target_link_libraries(rwlib
OpenGL::GL
)
set_target_properties(rwlib
PROPERTIES
OUTPUT_NAME rw
)
openrw_target_apply_options(TARGET rwlib)
if(BUILD_SHARED_LIBS)
install(TARGETS rwlib
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()

View File

@ -35,5 +35,5 @@ target_link_libraries(rwviewer
openrw_target_apply_options(TARGET rwviewer)
install(TARGETS rwviewer
RUNTIME DESTINATION "${BIN_DIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)

View File

@ -114,3 +114,7 @@ else()
TIMEOUT 300
)
endif()
install(TARGETS rwtests
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)