summaryrefslogtreecommitdiff
path: root/src/common/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/CMakeLists.txt')
-rw-r--r--src/common/CMakeLists.txt46
1 files changed, 15 insertions, 31 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 68436a4bc..c0555f840 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -14,34 +14,11 @@ if (DEFINED ENV{DISPLAYVERSION})
14 set(DISPLAY_VERSION $ENV{DISPLAYVERSION}) 14 set(DISPLAY_VERSION $ENV{DISPLAYVERSION})
15endif () 15endif ()
16 16
17# Pass the path to git to the GenerateSCMRev.cmake as well 17include(GenerateSCMRev)
18find_package(Git QUIET)
19
20add_custom_command(OUTPUT scm_rev.cpp
21 COMMAND ${CMAKE_COMMAND}
22 -DSRC_DIR=${PROJECT_SOURCE_DIR}
23 -DBUILD_REPOSITORY=${BUILD_REPOSITORY}
24 -DTITLE_BAR_FORMAT_IDLE=${TITLE_BAR_FORMAT_IDLE}
25 -DTITLE_BAR_FORMAT_RUNNING=${TITLE_BAR_FORMAT_RUNNING}
26 -DBUILD_TAG=${BUILD_TAG}
27 -DBUILD_ID=${DISPLAY_VERSION}
28 -DGIT_REF_SPEC=${GIT_REF_SPEC}
29 -DGIT_REV=${GIT_REV}
30 -DGIT_DESC=${GIT_DESC}
31 -DGIT_BRANCH=${GIT_BRANCH}
32 -DBUILD_FULLNAME=${BUILD_FULLNAME}
33 -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
34 -P ${PROJECT_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake
35 DEPENDS
36 # Check that the scm_rev files haven't changed
37 "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in"
38 "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h"
39 # technically we should regenerate if the git version changed, but its not worth the effort imo
40 "${PROJECT_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
41 VERBATIM
42)
43 18
44add_library(common STATIC 19add_library(common STATIC
20 address_space.cpp
21 address_space.h
45 algorithm.h 22 algorithm.h
46 alignment.h 23 alignment.h
47 announce_multiplayer_room.h 24 announce_multiplayer_room.h
@@ -106,6 +83,8 @@ add_library(common STATIC
106 microprofile.cpp 83 microprofile.cpp
107 microprofile.h 84 microprofile.h
108 microprofileui.h 85 microprofileui.h
86 multi_level_page_table.cpp
87 multi_level_page_table.h
109 nvidia_flags.cpp 88 nvidia_flags.cpp
110 nvidia_flags.h 89 nvidia_flags.h
111 page_table.cpp 90 page_table.cpp
@@ -117,7 +96,7 @@ add_library(common STATIC
117 quaternion.h 96 quaternion.h
118 reader_writer_queue.h 97 reader_writer_queue.h
119 ring_buffer.h 98 ring_buffer.h
120 scm_rev.cpp 99 ${CMAKE_CURRENT_BINARY_DIR}/scm_rev.cpp
121 scm_rev.h 100 scm_rev.h
122 scope_exit.h 101 scope_exit.h
123 settings.cpp 102 settings.cpp
@@ -177,12 +156,13 @@ if (MSVC)
177 ) 156 )
178 target_compile_options(common PRIVATE 157 target_compile_options(common PRIVATE
179 /W4 158 /W4
180 /WX 159
160 /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
161 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
162 /we4800 # Implicit conversion from 'type' to bool. Possible information loss
181 ) 163 )
182else() 164else()
183 target_compile_options(common PRIVATE 165 target_compile_options(common PRIVATE
184 -Werror
185
186 $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation> 166 $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>
187 ) 167 )
188endif() 168endif()
@@ -190,7 +170,11 @@ endif()
190create_target_directory_groups(common) 170create_target_directory_groups(common)
191 171
192target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) 172target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
193target_link_libraries(common PRIVATE lz4::lz4) 173if (TARGET lz4::lz4)
174 target_link_libraries(common PRIVATE lz4::lz4)
175else()
176 target_link_libraries(common PRIVATE LZ4::lz4_shared)
177endif()
194if (TARGET zstd::zstd) 178if (TARGET zstd::zstd)
195 target_link_libraries(common PRIVATE zstd::zstd) 179 target_link_libraries(common PRIVATE zstd::zstd)
196else() 180else()