forked from alariq/mc2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
196 lines (170 loc) · 5.97 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
cmake_minimum_required (VERSION 3.10)
# select GLVND versus legacy OpenGL libraries
cmake_policy(SET CMP0072 NEW) # cmake --help-policy CMP0072
project(mc2)
include(CMakeToolsHelpers OPTIONAL)
# Set a default build type for single-configuration
# CMake generators if no build type is set.
#IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
# SET(CMAKE_BUILD_TYPE RelWithDebInfo)
#ENDIF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
message("CMAKE library architecture: ${CMAKE_LIBRARY_ARCHITECTURE}")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
message(STATUS "Target is 64 bits")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
else("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
message(STATUS "Target is 32 bits")
endif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
# may have to help find_package bydetting path to FindSDL2.cmake
#set(SDL2_DIR "${CMAKE_PREFIX_PATH}/cmake")
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs -Werror=array-bounds -Wno-switch -Wwrite-strings -Wno-unknown-warning-option -Wunused-variable -fpermissive") # -fsanitize=address -fno-omit-frame-pointer")
endif()
# -Wno-unused-local-typedefs - to disable "typedef was ignored on this declaration"
if(MSVC)
add_definitions(-DPLATFORM_WINDOWS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
message("Compiling on M$ Windows")
endif()
# to support windows sln file generator as well
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_ARMOR -D_DEBUG -DBUGLOG -DLAB_ONLY")
#set(CMAKE_CXX_FLAGS_RELWITHDEBINFO" ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DSOME_STUFF")
if(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
add_definitions(-DUSE_ASSEMBLER_CODE=0)
add_definitions(-DLINUX_BUILD)
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer REQUIRED)
#required by text_tool
find_package(SDL2_ttf REQUIRED)
find_package(GLEW REQUIRED)
find_package(OpenGL REQUIRED)
find_package(ZLIB REQUIRED)
message("Found SDL2 package ${SDL_LIBS}" )
message("SDL2 prefix: ${SDL2_PREFIX}")
message("OPENGL library found in ${OPENGL}")
message("GLEW library found in ${GLEW}")
message("Zlib library found in ${ZLIB}")
message("OpenGL library linking: ${OPENGL_gl_LIBRARY}")
message("OpenGL library include: ${OPENGL_INCLUDE_DIR}")
get_filename_component(COM_PATH1 "./GameOS/include" ABSOLUTE)
get_filename_component(COM_PATH2 "./GameOS/gameos" ABSOLUTE)
set(COMMON_INCLUDE_DIRS ${COM_PATH1} ${COM_PATH2})
add_subdirectory("./mclib/" "./out/mclib")
add_subdirectory("./mclib/mlr" "./out/mclib/mlr")
add_subdirectory("./mclib/gosfx" "./out/mclib/gosfx")
add_subdirectory("./mclib/stuff" "./out/mclib/stuff")
add_subdirectory("./gui" "./out/gui")
add_subdirectory("./GameOS/gameos" "./out/GameOS/gameos")
add_subdirectory("./GameOS/src" "./out/windows")
set(SOURCES
"code/dw.cpp"
"code/mechcmd2.cpp"
"code/artlry.cpp"
"code/bldng.cpp"
"code/carnage.cpp"
"code/collsn.cpp"
"code/comndr.cpp"
"code/contact.cpp"
"code/gameobj.cpp"
"code/gate.cpp"
"code/goal.cpp"
"code/group.cpp"
"code/gvehicl.cpp"
"code/light.cpp"
"code/mech.cpp"
"code/mover.cpp"
"code/objmgr.cpp"
"code/objtype.cpp"
"code/tacordr.cpp"
"code/team.cpp"
"code/terrobj.cpp"
"code/turret.cpp"
"code/warrior.cpp"
"code/weaponbolt.cpp"
"code/ablmc2.cpp"
"code/gamecam.cpp"
"code/mission.cpp"
"code/mission2.cpp"
"code/objective.cpp"
"code/saveload.cpp"
"code/trigger.cpp"
"code/weather.cpp"
"gui/aanimobject.cpp"
"gui/aedit.cpp"
"code/attributemeter.cpp"
"code/controlgui.cpp"
"code/forcegroupbar.cpp"
"code/gametacmap.cpp"
"code/infowindow.cpp"
"code/keyboardref.cpp"
"code/mechicon.cpp"
"code/missiongui.cpp"
"code/mpconnectiontype.cpp"
"code/mpgamebrowser.cpp"
"code/mphostgame.cpp"
"code/mploadmap.cpp"
"code/mpparameterscreen.cpp"
"code/mpsetuparea.cpp"
"code/optionsarea.cpp"
"code/optionsscreenwrapper.cpp"
"code/pausewindow.cpp"
"code/prefs.cpp"
"code/simplecamera.cpp"
"code/componentlistbox.cpp"
"code/loadscreen.cpp"
"code/logistics.cpp"
"code/logisticscomponent.cpp"
"code/logisticsdata.cpp"
"code/logisticsdialog.cpp"
"code/logisticsmech.cpp"
"code/logisticsmechdisplay.cpp"
"code/logisticsmechicon.cpp"
"code/logisticsmissioninfo.cpp"
"code/logisticspilot.cpp"
"code/logisticspilotlistbox.cpp"
"gui/logisticsscreen.cpp"
"code/logisticsvariant.cpp"
"code/mainmenu.cpp"
"code/mechbayscreen.cpp"
"code/mechlabscreen.cpp"
"code/mechlistbox.cpp"
"code/mechlopedia.cpp"
"code/mechpurchasescreen.cpp"
"code/missionbegin.cpp"
"code/missionbriefingscreen.cpp"
"code/missionresults.cpp"
"code/missionselectionscreen.cpp"
"code/mpprefs.cpp"
"code/pilotreadyscreen.cpp"
"code/pilotreviewarea.cpp"
"code/salvagemecharea.cpp"
"code/simplecomponentlistbox.cpp"
"code/gamesound.cpp"
"code/radio.cpp"
"code/movemgr.cpp"
"code/chatwindow.cpp"
"code/mpstats.cpp"
"code/multplyr.cpp"
"code/mc2movie.cpp"
)
include_directories(${COMMON_INCLUDE_DIRS} "./mclib" "./gui" "./code" "./netlib")
if(NOT WIN32)
set(ADDITIONAL_LIBS dl)
message("Not win32 system")
else()
# winmm for timeGetTime, maybe switch to GetTickCount to remove this dependency
set(ADDITIONAL_LIBS winmm)
endif()
add_executable(mc2 ${SOURCES} ${MAIN_SRC})
target_link_libraries(mc2 mclib gosfx mlr stuff gui gameos gameos_main windows ZLIB::ZLIB SDL2::Main GLEW::GLEW SDL2::Mixer ${ADDITIONAL_LIBS} OpenGL::GL)
add_subdirectory("./res" "./out/res")
add_subdirectory("./data_tools" "./out/data_tools")
add_subdirectory("./text_tool" "./out/text_tool")
add_subdirectory("./Viewer" "./out/Viewer")