Skip to content

Commit 7a0015a

Browse files
committed
Work on packaging and installation
1 parent cc304e6 commit 7a0015a

File tree

24 files changed

+94
-132
lines changed

24 files changed

+94
-132
lines changed

Externals/OPCODE/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,3 @@ target_precompile_headers(xrOPCODE
9292
PRIVATE
9393
pch.hpp
9494
)
95-
96-
if (BUILD_SHARED_LIBS)
97-
install(TARGETS xrOPCODE LIBRARY
98-
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
99-
)
100-
endif()

Externals/ode/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,3 @@ set_target_properties(xrODE PROPERTIES
9696
PREFIX ""
9797
UNITY_BUILD OFF
9898
)
99-
100-
if (BUILD_SHARED_LIBS)
101-
install(TARGETS xrODE LIBRARY
102-
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
103-
)
104-
endif()

cmake/XRay.Build.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${XRAY_COMPILE_OUTPUT_FOLDER}")
1313
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${XRAY_COMPILE_OUTPUT_FOLDER}")
1414
set(CMAKE_PDB_OUTPUT_DIRECTORY "${XRAY_COMPILE_OUTPUT_FOLDER}")
1515

16+
include(GNUInstallDirs)
17+
1618
# Provide access to shared externals headers (e.g. submodule_check.hpp)
1719
include_directories(
1820
"${CMAKE_SOURCE_DIR}/Externals"
@@ -75,6 +77,9 @@ find_package(Theora REQUIRED)
7577

7678
find_package(JPEG)
7779

80+
set(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT OpenXRay)
81+
include(InstallRequiredSystemLibraries)
82+
7883
# https://gitlab.kitware.com/cmake/cmake/-/issues/25650
7984
if (CMAKE_VERSION VERSION_EQUAL "3.28.2" AND CMAKE_UNITY_BUILD)
8085
message(WARNING

cmake/XRay.Compiler.GNULike.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
1717
set(CMAKE_INSTALL_PREFIX "/usr")
1818
endif()
1919

20-
include(GNUInstallDirs)
21-
2220
if (DISABLE_PORTABLE_MODE)
2321
add_compile_definitions(DISABLE_PORTABLE_MODE)
2422
endif()

cmake/XRay.Compiler.MSVC.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ set(XRAY_SDK_BINARY_DIR "${XRAY_SDK_DIR}/binaries/${XRAY_PLATFORM}")
8989
list(APPEND CMAKE_PREFIX_PATH "${XRAY_SDK_DIR}")
9090
list(APPEND CMAKE_LIBRARY_PATH "${XRAY_SDK_LIBRARY_DIR}")
9191

92+
install(DIRECTORY "${XRAY_SDK_BINARY_DIR}/" TYPE BIN COMPONENT OpenXRay)
93+
9294
foreach(_xray_required_dir XRAY_SDK_DIR XRAY_SDK_INCLUDE_DIR XRAY_SDK_LIBRARY_DIR)
9395
if (NOT EXISTS "${${_xray_required_dir}}")
9496
message(FATAL_ERROR "${_xray_required_dir} not found at '${${_xray_required_dir}}'. Please point XRAY_SDK_DIR to a valid SDK installation.")

cmake/XRay.Packaging.cmake

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,24 @@ set(CPACK_SOURCE_IGNORE_FILES "/.gitattributes")
1111
set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
1212
set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/License.txt)
1313

14-
if (WIN32)
14+
# DEB
15+
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
16+
set(CPACK_DEBIAN_PACKAGE_SECTION "games")
17+
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
18+
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
19+
20+
# RPM
21+
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
22+
set(CPACK_RPM_PACKAGE_GROUP "Amusements/Games")
23+
# -- set(CPACK_RPM_PACKAGE_AUTOREQPROV ON)
24+
set(CPACK_RPM_PACKAGE_AUTOREQ ON)
25+
set(CPACK_RPM_PACKAGE_AUTOPROV YES)
26+
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
27+
28+
if (CPACK_GENERATOR)
29+
# do nothing, it's ok
30+
elseif (WIN32)
1531
set(CPACK_GENERATOR 7Z)
16-
include(CPack)
1732
elseif (UNIX)
1833
# Try to find specific OS files to determine type of linux distribution
1934
find_file(FEDORA_FOUND fedora-release PATHS /etc)
@@ -41,25 +56,27 @@ elseif (UNIX)
4156
# --- SELECT PROPER CPACK GENERATOR ---
4257
if (DEBIAN_FOUND)
4358
set(CPACK_GENERATOR DEB)
44-
45-
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
46-
47-
set(CPACK_DEBIAN_PACKAGE_SECTION "games")
48-
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
49-
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
59+
elseif (FEDORA_FOUND OR REDHAT_FOUND OR CENTOS_FOUND)
60+
set(CPACK_GENERATOR RPM)
5061
endif()
5162

52-
if (FEDORA_FOUND OR REDHAT_FOUND OR CENTOS_FOUND)
53-
set(CPACK_GENERATOR RPM)
63+
unset(FEDORA_FOUND)
64+
unset(REDHAT_FOUND)
65+
unset(CENTOS_FOUND)
66+
unset(DEBIAN_FOUND)
67+
endif()
5468

55-
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
69+
if (CPACK_GENERATOR)
70+
include(CPack)
5671

57-
set(CPACK_RPM_PACKAGE_GROUP "Amusements/Games")
58-
# -- set(CPACK_RPM_PACKAGE_AUTOREQPROV ON)
59-
set(CPACK_RPM_PACKAGE_AUTOREQ ON)
60-
set(CPACK_RPM_PACKAGE_AUTOPROV YES)
61-
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
62-
endif()
72+
cpack_add_component(OpenXRay
73+
DISPLAY_NAME "OpenXRay"
74+
DESCRIPTION "The main OpenXRay package that includes binary files to run the game."
75+
REQUIRED
76+
)
6377

64-
include(CPack)
78+
cpack_add_component(Debug
79+
DISPLAY_NAME "Debug"
80+
DESCRIPTION "Debug symbols for engine developers needs."
81+
)
6582
endif()

src/CMakeLists.txt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,55 @@ add_subdirectory(xrScriptEngine)
2323
add_subdirectory(xrSound)
2424
add_subdirectory(xrUICore)
2525
add_subdirectory(xr_3da)
26+
27+
install(
28+
TARGETS
29+
xr_3da
30+
xrAICore
31+
xrAPI
32+
xrCDB
33+
xrCore
34+
xrEngine
35+
xrGame
36+
xrGameSpy
37+
xrLuabind
38+
xrMaterialSystem
39+
xrNetServer
40+
xrODE
41+
xrOPCODE
42+
xrParticles
43+
xrPhysics
44+
xrRender_GL
45+
xrRender_R4
46+
xrScriptEngine
47+
xrSound
48+
xrUICore
49+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT OpenXRay
50+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT OpenXRay
51+
)
52+
53+
install(FILES
54+
$<TARGET_PDB_FILE:xr_3da>
55+
$<TARGET_PDB_FILE:xrAICore>
56+
$<TARGET_PDB_FILE:xrAPI>
57+
$<TARGET_PDB_FILE:xrCDB>
58+
$<TARGET_PDB_FILE:xrCore>
59+
$<TARGET_PDB_FILE:xrEngine>
60+
$<TARGET_PDB_FILE:xrGame>
61+
$<TARGET_PDB_FILE:xrGameSpy>
62+
$<TARGET_PDB_FILE:xrLuabind>
63+
$<TARGET_PDB_FILE:xrMaterialSystem>
64+
$<TARGET_PDB_FILE:xrNetServer>
65+
$<TARGET_PDB_FILE:xrODE>
66+
$<TARGET_PDB_FILE:xrOPCODE>
67+
$<TARGET_PDB_FILE:xrParticles>
68+
$<TARGET_PDB_FILE:xrPhysics>
69+
$<TARGET_PDB_FILE:xrRender_GL>
70+
$<TARGET_PDB_FILE:xrRender_R4>
71+
$<TARGET_PDB_FILE:xrScriptEngine>
72+
$<TARGET_PDB_FILE:xrSound>
73+
$<TARGET_PDB_FILE:xrUICore>
74+
DESTINATION "${CMAKE_INSTALL_BINDIR}"
75+
COMPONENT Debug
76+
OPTIONAL
77+
)

src/Layers/xrAPI/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,3 @@ target_precompile_headers(xrAPI
2424
PRIVATE
2525
stdafx.h
2626
)
27-
28-
if (BUILD_SHARED_LIBS)
29-
install(TARGETS xrAPI LIBRARY
30-
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
31-
)
32-
endif()

src/Layers/xrRenderPC_GL/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,3 @@ target_precompile_headers(xrRender_GL
431431
PRIVATE
432432
$<$<COMPILE_LANGUAGE:CXX>:stdafx.h>
433433
)
434-
435-
if (BUILD_SHARED_LIBS)
436-
install(TARGETS xrRender_GL LIBRARY
437-
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
438-
)
439-
endif()

src/Layers/xrRenderPC_R4/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,3 @@ target_precompile_headers(xrRender_R4
153153
PRIVATE
154154
stdafx.h
155155
)
156-
157-
if (BUILD_SHARED_LIBS)
158-
install(TARGETS xrRender_R4 LIBRARY
159-
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
160-
)
161-
endif()

0 commit comments

Comments
 (0)