-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCMakeLists.txt
139 lines (111 loc) · 3.06 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
cmake_minimum_required(VERSION 3.1)
project(Chasm-Reverse)
set(CMAKE_CXX_STANDARD 11)
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_NO_WARNINGS /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _CRT_SECURE_NO_WARNINGS /MP")
endif()
option(BUILD_TOOLS "Enable compilation of tools" YES)
include(CheckCXXSourceCompiles)
include(GNUInstallDirs)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src/ ${CMAKE_CURRENT_SOURCE_DIR}/src/panzer_ogl_lib)
# Source and header files
file(GLOB_RECURSE CHASM_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
file(GLOB_RECURSE CHASM_HEADERS
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.inl")
# Detect MMX support
set(SAFE_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmmx")
endif()
CHECK_CXX_SOURCE_COMPILES("#include <mmintrin.h>
int main(void) { __m64 v = _m_from_int(0); }"
HAVE_MMX)
if(HAVE_MMX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPC_MMX_INSTRUCTIONS")
else()
set(CMAKE_CXX_FLAGS "${SAFE_CMAKE_CXX_FLAGS}")
endif()
# Configure libraries
set(CHASM_LIBS
${SDL2_LIBRARY}
)
if(WIN32)
set(CHASM_LIBS
${CHASM_LIBS}
opengl32
ws2_32
)
set(CHASM_RESOURCES
res/PanzerChasm.rc
)
elseif(APPLE)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
set(CHASM_LIBS
${CHASM_LIBS}
${OPENGL_LIBRARIES}
)
else()
set(CHASM_LIBS
${CHASM_LIBS}
GL
)
endif()
# Configure executable
add_executable(PanzerChasm ${CHASM_SOURCES} ${CHASM_HEADERS} ${CHASM_RESOURCES})
target_link_libraries(PanzerChasm ${CHASM_LIBS})
if(BUILD_TOOLS)
file(GLOB_RECURSE COMMON_FILES src/common/files.*)
file(GLOB_RECURSE COMMON_PALETTE src/common/palette.*)
file(GLOB_RECURSE COMMON_TGA src/common/tga.*)
add_executable(ArchiveDepacker
${CMAKE_CURRENT_SOURCE_DIR}/tools/ArchiveDepacker/main.cpp
${COMMON_FILES}
)
add_executable(BlendtabAnalyzer
${CMAKE_CURRENT_SOURCE_DIR}/tools/BlendtabAnalyzer/main.cpp
${COMMON_FILES}
${COMMON_PALETTE}
${COMMON_TGA}
)
add_executable(CarToTGAConverter
${CMAKE_CURRENT_SOURCE_DIR}/tools/CarToTGAConverter/main.cpp
${COMMON_FILES}
${COMMON_PALETTE}
${COMMON_TGA}
)
add_executable(CelDepacker
${CMAKE_CURRENT_SOURCE_DIR}/tools/CelDepacker/main.cpp
${COMMON_FILES}
${COMMON_TGA}
)
add_executable(FloorsExtractor
${CMAKE_CURRENT_SOURCE_DIR}/tools/FloorsExtractor/main.cpp
${COMMON_FILES}
${COMMON_PALETTE}
${COMMON_TGA}
)
add_executable(MapToTGAConverter
${CMAKE_CURRENT_SOURCE_DIR}/tools/MapToTGAConverter/main.cpp
${COMMON_FILES}
${COMMON_TGA}
)
add_executable(ObjToTGAConverter
${CMAKE_CURRENT_SOURCE_DIR}/tools/ObjToTGAConverter/main.cpp
${COMMON_FILES}
${COMMON_PALETTE}
${COMMON_TGA}
)
add_executable(PaletteExtractor
${CMAKE_CURRENT_SOURCE_DIR}/tools/PaletteExtractor/main.cpp
${COMMON_FILES}
${COMMON_PALETTE}
${COMMON_TGA}
)
endif(BUILD_TOOLS)