-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
120 lines (105 loc) · 3.19 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
cmake_minimum_required(VERSION 3.0)
project(openRBRVR)
set(CMAKE_CXX_STANDARD 23)
set(SOURCES
"src/API.cpp"
"src/Dx.cpp"
"src/Globals.cpp"
"src/Menu.cpp"
"src/OpenVR.cpp"
"src/OpenXR.cpp"
"src/RBR.cpp"
"src/RenderTarget.cpp"
"src/VR.cpp"
"src/Vertex.cpp"
"src/openRBRVR.cpp"
"src/openRBRVR.cpp"
"src/Util.cpp"
)
set(HEADERS
"src/API.hpp"
"src/Config.hpp"
"src/D3D.hpp"
"src/Dx.hpp"
"src/Globals.hpp"
"src/Hook.hpp"
"src/IPlugin.h"
"src/Licenses.hpp"
"src/Menu.hpp"
"src/OpenVR.hpp"
"src/OpenXR.hpp"
"src/Quaternion.hpp"
"src/RBR.hpp"
"src/RenderTarget.hpp"
"src/Util.hpp"
"src/VR.hpp"
"src/Vertex.hpp"
"src/openRBRVR.def"
"src/openRBRVR.hpp"
)
set(openRBRVR_Major 1)
set(openRBRVR_Minor 1)
set(openRBRVR_Patch 1)
set(openRBRVR_Tweak 0)
#set(openRBRVR_TweakStr "-rc${openRBRVR_Tweak}")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/Version.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/Version.hpp
@ONLY
)
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
target_compile_options(${PROJECT_NAME} PRIVATE /arch:AVX)
target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32 _WINDOWS _USRDLL _MBCS)
target_include_directories(${PROJECT_NAME} PRIVATE
"${CMAKE_SOURCE_DIR}/thirdparty"
"${CMAKE_SOURCE_DIR}/thirdparty/dxvk/include/vulkan/include"
"${CMAKE_SOURCE_DIR}/thirdparty/dxvk/src/d3d9"
"${CMAKE_SOURCE_DIR}/thirdparty/glm"
"${CMAKE_SOURCE_DIR}/thirdparty/minhook/include"
"${CMAKE_SOURCE_DIR}/thirdparty/openvr"
"${CMAKE_SOURCE_DIR}/thirdparty/openxr"
"${CMAKE_CURRENT_BINARY_DIR}"
)
target_link_directories(${PROJECT_NAME} PUBLIC
${CMAKE_SOURCE_DIR}/thirdparty/lib
${CMAKE_SOURCE_DIR}/thirdparty/minhook/bin
)
target_link_libraries(${PROJECT_NAME} PUBLIC
d3d9
d3d11
dxgi
d3dcompiler
libminhook.x86
openvr_api
openxr_loader
)
cmake_path(NATIVE_PATH CMAKE_INSTALL_PREFIX NATIVE_CMAKE_INSTALL_PREFIX)
set_target_properties(${PROJECT_NAME}
PROPERTIES
VS_DEBUGGER_COMMAND "${NATIVE_CMAKE_INSTALL_PREFIX}\\RichardBurnsRally_SSE.exe"
VS_DEBUGGER_COMMAND_ARGUMENTS "$<TARGET_FILE:${PROJECT_NAME}>"
)
# Set the output directory for Windows
set_target_properties(${PROJECT_NAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug"
PDB_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Release"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release"
PDB_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release"
)
add_custom_target(fmt
COMMAND clang-format -i ${SOURCES} ${HEADERS}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_custom_target(build_and_copy
COMMAND copy ${CMAKE_BUILD_TYPE}\\openRBRVR.dll ${NATIVE_CMAKE_INSTALL_PREFIX}\\Plugins
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_dependencies(build_and_copy ${PROJECT_NAME})