Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 1233 lines (1043 sloc) 37.859 kB
6dd3c00 @dscharrer [cmake] Relax minimum CMake version requirement for non-MSVC compilers.
dscharrer authored
1 project(ArxLibertatis)
2
3 if(MSVC)
4 # CMake 2.8.5 or newer is needed for CMAKE_LIBRARY_ARCHITECTURE support.
5 cmake_minimum_required(VERSION 2.8.5)
6 # Change CMAKE_LIBRARY_ARCHITECTURE to ensure the right libs are used
7 if(CMAKE_CL_64)
8 set(CMAKE_LIBRARY_ARCHITECTURE "x64")
9 else()
10 set(CMAKE_LIBRARY_ARCHITECTURE "x86")
11 endif(CMAKE_CL_64)
12 else()
13 cmake_minimum_required(VERSION 2.8)
14 endif()
9c3e84d @lubosz stubby cmake build
lubosz authored
15
cbf67dd @dscharrer Use boost::filesystem to load non-packed asset files.
dscharrer authored
16 # For custom cmake modules.
17 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
18
12825f4 @dscharrer Check size of char in CMakeLists.txt
dscharrer authored
19 include(CheckTypeSize)
7fa9f82 @dscharrer Write configure options to a header instead of passing them on the co…
dscharrer authored
20 include(CheckSymbolExists)
21 include(CheckCXXSourceCompiles)
22
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
23 include(BuildSystem)
cbf67dd @dscharrer Use boost::filesystem to load non-packed asset files.
dscharrer authored
24 include(CompileCheck)
1ea3ead @dscharrer Automatically generate a version string at build time.
dscharrer authored
25 include(VersionString)
4cd5bf1 @dscharrer CMake: Move helper functions and macros out of the main CMakeLists.txt
dscharrer authored
26 include(StyleCheck)
27 include(PrintConfiguration)
28 include(CreateSourceGroups)
5c2d73a @SebastienLussier Fixed VC2010 warnings/errors/projects
SebastienLussier authored
29
1f84e23 @SebastienLussier Added support for unity build (set env var "ARX_USE_UNITYBUILD=1" to …
SebastienLussier authored
30 ##############################################################################
31
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
32 option(BUILD_TESTS "Build tests" OFF)
33 option(BUILD_TOOLS "Build tools" ON)
f32b444 @dscharrer CMake: Disable the crash reporter by default for APPLE.
dscharrer authored
34 if(APPLE)
35 option(BUILD_CRASHREPORTER "Build the crash reporter" OFF)
36 else(APPLE)
37 option(BUILD_CRASHREPORTER "Build the crash reporter" ON)
38 endif(APPLE)
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
39 option(BUILD_EDITOR "Build editor" OFF)
40 option(BUILD_EDIT_LOADSAVE "Build save/load functions only used by the editor" ON)
41 option(UNITY_BUILD "Unity build" OFF)
42 option(DEBUG_EXTRA "Expensive debug options" OFF)
43 option(USE_OPENAL "Build the OpenAL audio backend." ON)
44 option(USE_DSOUND "Build the DirectSound audio backend." ON)
45 option(USE_OPENGL "Build the OpenGL renderer backend." ON)
46 option(USE_D3D9 "Build the Direct3D 9 renderer backend." ON)
47 option(USE_SDL "Build the SDL windowing backend." ON)
48 option(USE_DINPUT8 "Build the DirectInput 8 input backend." ON)
6d193a3 @dscharrer Add a USE_NATIVE_FS cmake flag to allow testing the boost::filesystem…
dscharrer authored
49 option(USE_NATIVE_FS "Use the native (POSIX / Win32) filesystem backend instead of boost." ON)
e067d34 @dscharrer Add a ARX_FORCE_32BIT option to force a 32-bit build on 64-bit systems.
dscharrer authored
50
01870c4 @dscharrer Fix configure errors with CMake < 2.8.5.
dscharrer authored
51
d7406f7 @dscharrer Add man pages for arx, arxsavetool and arxupak and cleanup `make doc`.
dscharrer authored
52 if(NOT WIN32)
01870c4 @dscharrer Fix configure errors with CMake < 2.8.5.
dscharrer authored
53 if(CMAKE_VERSION VERSION_LESS 2.8.5)
54 set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE
55 STRING "read-only architecture-independent data root (share) (relative to prefix).")
56 mark_as_advanced(CMAKE_INSTALL_DATAROOTDIR)
57 set(CMAKE_INSTALL_BINDIR "bin" CACHE
58 STRING "user executables (bin) (relative to prefix).")
59 mark_as_advanced(CMAKE_INSTALL_BINDIR)
60 set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE
61 STRING "program executables (libexec) (relative to prefix).")
62 mark_as_advanced(CMAKE_INSTALL_LIBEXECDIR)
63 set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man" CACHE
64 STRING "man documentation (DATAROOTDIR/man) (relative to prefix).")
65 mark_as_advanced(CMAKE_INSTALL_MANDIR)
66 foreach(dir BINDIR LIBEXECDIR DATAROOTDIR MANDIR)
67 if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
68 set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
69 else()
70 set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
71 endif()
72 endforeach()
73 else()
74 include(GNUInstallDirs)
75 endif()
d7406f7 @dscharrer Add man pages for arx, arxsavetool and arxupak and cleanup `make doc`.
dscharrer authored
76 set(ICONDIR "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps" CACHE
77 STRING "Install location for icons (relative to prefix).")
78 mark_as_advanced(ICONDIR)
79 set(APPDIR "${CMAKE_INSTALL_DATAROOTDIR}/applications" CACHE
80 STRING "Install location for .desktop files (relative to prefix).")
81 mark_as_advanced(APPDIR)
68d5ffc @dscharrer CMake: Support a separate install directory for games binaries.
dscharrer authored
82 set(GAMESBINDIR "${CMAKE_INSTALL_BINDIR}" CACHE
83 STRING "Install location for game executables (relative to prefix).")
84 mark_as_advanced(GAMESBINDIR)
d7406f7 @dscharrer Add man pages for arx, arxsavetool and arxupak and cleanup `make doc`.
dscharrer authored
85 endif()
031bf07 @dscharrer Document install options.
dscharrer authored
86
01870c4 @dscharrer Fix configure errors with CMake < 2.8.5.
dscharrer authored
87
7de379a @dscharrer Disable DirectX backends on linux; remove the ARX_FORCE_32BIT option;…
dscharrer authored
88 if((NOT LAST_CMAKE_CXX_FLAGS STREQUAL CMAKE_CXX_FLAGS) OR (NOT LAST_CMAKE_CXX_COMPILER STREQUAL CMAKE_CXX_COMPILER))
e067d34 @dscharrer Add a ARX_FORCE_32BIT option to force a 32-bit build on 64-bit systems.
dscharrer authored
89 force_recheck_library(DevIL IL)
90 force_recheck_library(ZLIB)
91 force_recheck_library(Freetype)
92 force_recheck_library(Threads)
3d874d1 @dscharrer Check if we can actually link against teh found OpenAL library.
dscharrer authored
93 force_recheck_library(OpenAL)
aa36bda @dscharrer Revert "CMakeLists.txt: Don't use find_package(OpenGL)"
dscharrer authored
94 force_recheck_library(OpenGL)
d140a05 @dscharrer Start implementing OpenGLRenderer.
dscharrer authored
95 force_recheck_library(GLEW)
519b7f1 @dscharrer Add Boost as a dependency.
dscharrer authored
96 force_recheck_library(Boost)
276f796 @dscharrer CMake: Check for OpenSSL and Qt library architecture compatibility on…
dscharrer authored
97 force_recheck_library(QtCore QT_QTCORE)
98 force_recheck_library(QtGui QT_QTGUI)
4d7cf61 @SebastienLussier Crash reporter now creates issues on the bug tracker
SebastienLussier authored
99 force_recheck_library(QtNetwork QT_QTNETWORK)
519b7f1 @dscharrer Add Boost as a dependency.
dscharrer authored
100 unset(Boost_INCLUDE_DIR CACHE)
7de379a @dscharrer Disable DirectX backends on linux; remove the ARX_FORCE_32BIT option;…
dscharrer authored
101 set(LAST_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE INTERNAL "The last C++ compiler flags.")
102 set(LAST_CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER}" CACHE INTERNAL "The last C++ compiler.")
e067d34 @dscharrer Add a ARX_FORCE_32BIT option to force a 32-bit build on 64-bit systems.
dscharrer authored
103 endif()
a36e2b1 @SebastienLussier Sort the unity build files list + changed ARX_USE_UNITYBUILD to a cma…
SebastienLussier authored
104
29f1a61 @dscharrer Remove winelib support
dscharrer authored
105 if(WIN32)
e544dd3 @dscharrer Fix mingw32 build.
dscharrer authored
106 if(NOT MSVC)
107 # We need to define WINVER for MinGW32 when requiring anything newer than Win95 / WinNT
108 add_definitions(-DWINVER=0x0500) # Require at least Windows 2000
109 endif()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
110 set(ARX_HAVE_WINAPI 1)
8a115ab @dscharrer Don't check for OpenGL libraries when using winelib.
dscharrer authored
111 else()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
112 set(ARX_HAVE_WINAPI 0)
8a115ab @dscharrer Don't check for OpenGL libraries when using winelib.
dscharrer authored
113 endif()
114
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
115 if(NOT ARX_HAVE_WINAPI)
8a115ab @dscharrer Don't check for OpenGL libraries when using winelib.
dscharrer authored
116 # The is no DirectX under linux
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
117 set(USE_D3D9 OFF)
118 set(USE_DSOUND OFF)
119 set(USE_DINPUT8 OFF)
365d73b @SebastienLussier First working implementation of Arx using DirectX 9 (D3D9 & DInput8)
SebastienLussier authored
120 else()
7c025c3 @dscharrer Relax backend selection in CMake: don't fail if a backend that was en…
dscharrer authored
121 if(USE_D3D9 OR USE_DINPUT8)
365d73b @SebastienLussier First working implementation of Arx using DirectX 9 (D3D9 & DInput8)
SebastienLussier authored
122 find_package(DirectX REQUIRED)
123 endif()
8a115ab @dscharrer Don't check for OpenGL libraries when using winelib.
dscharrer authored
124 endif()
125
9ca39c4 @SebastienLussier Added freetype using find_package() in CMakeList.txt
SebastienLussier authored
126 find_package(Freetype REQUIRED)
734fab0 @dscharrer Use find_package in CMakeLists.txt instead of hardcoding library name…
dscharrer authored
127 find_package(DevIL REQUIRED)
128 find_package(ZLIB REQUIRED)
dbb8ca7 @dscharrer CMake: Prefer pthreads over native functions for non-windows systems.
dscharrer authored
129 set(CMAKE_THREAD_PREFER_PTHREAD 1)
734fab0 @dscharrer Use find_package in CMakeLists.txt instead of hardcoding library name…
dscharrer authored
130 find_package(Threads REQUIRED)
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
131 if(USE_OPENGL)
aa36bda @dscharrer Revert "CMakeLists.txt: Don't use find_package(OpenGL)"
dscharrer authored
132 find_package(OpenGL)
7c025c3 @dscharrer Relax backend selection in CMake: don't fail if a backend that was en…
dscharrer authored
133 find_package(GLEW)
c105d07 @dscharrer Make building the OpenGLRenderer optional, disabled by default.
dscharrer authored
134 endif()
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
135 if(USE_OPENAL)
7c025c3 @dscharrer Relax backend selection in CMake: don't fail if a backend that was en…
dscharrer authored
136 find_package(OpenAL 1.1)
b43b234 @dscharrer Make the OpenAL effect extension optional so we can build against old…
dscharrer authored
137 find_package(OpenALEFX)
41d57f0 @dscharrer Make building the OpenAL and DirectSound backends optional.
dscharrer authored
138 endif()
734fab0 @dscharrer Use find_package in CMakeLists.txt instead of hardcoding library name…
dscharrer authored
139 find_package(Doxygen)
140 find_package(PythonInterp)
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
141 if(USE_SDL)
7def37a @SebastienLussier Data/User/Config variables now set for Mac
SebastienLussier authored
142 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
143 else()
a27a089 @dscharrer audio: Fix use of uninitialized pointer in OpenALBackend.cpp.
dscharrer authored
144 # Required to avoid linking with SDLmain except for OS X where it is necessary
145 # due to the need to have NSApplication correctly setup by SDLmain.
146 set(SDL_BUILDING_LIBRARY 1)
147 endif()
148 find_package(SDL 1.2 EXACT)
ec98148 @dscharrer Add stub SDL Window and InputBackend and OpenGL Renderer implementati…
dscharrer authored
149 endif()
734fab0 @dscharrer Use find_package in CMakeLists.txt instead of hardcoding library name…
dscharrer authored
150
8c6e31b @SebastienLussier Link statically with Boost under msvc
SebastienLussier authored
151 if(MSVC)
152 # Link statically with Boost under Windows
153 set(Boost_USE_STATIC_LIBS ON)
154 endif(MSVC)
b574763 @dscharrer Add a POSIX filesystem implementation that will be used if Boost file…
dscharrer authored
155
b2c3ef7 @dscharrer Add a separate fs::path class for filesystem paths.
dscharrer authored
156 set(BOOST_COMPONENTS program_options)
bde3224 @dscharrer Clarify required boost version.
dscharrer authored
157 find_package(Boost 1.39 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
734fab0 @dscharrer Use find_package in CMakeLists.txt instead of hardcoding library name…
dscharrer authored
158
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
159 set(ARX_HAVE_CRASHREPORTER 0)
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
160 if(BUILD_CRASHREPORTER)
161 # Needed by the crash reporter
01cf618 @dscharrer CMake: Remove OpenSSL dependency.
dscharrer authored
162 find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork)
163 if(QT_FOUND)
164 if(MSVC)
165 find_package(DbgHelp)
166 if(DBGHELP_FOUND)
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
167 set(ARX_HAVE_CRASHREPORTER 1)
a9fc7cf @dscharrer CMake: Fix and cleanup capability checking for the POSIX crash handle…
dscharrer authored
168 endif()
ecb1080 @SebastienLussier Use "CrashBot" and ${BUGTRACKER_PASSWD} for the tracker login
SebastienLussier authored
169 else()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
170 set(ARX_HAVE_CRASHREPORTER 1)
01cf618 @dscharrer CMake: Remove OpenSSL dependency.
dscharrer authored
171 endif()
ecb1080 @SebastienLussier Use "CrashBot" and ${BUGTRACKER_PASSWD} for the tracker login
SebastienLussier authored
172 endif()
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
173 endif()
174
734fab0 @dscharrer Use find_package in CMakeLists.txt instead of hardcoding library name…
dscharrer authored
175 mark_as_advanced(IL_INCLUDE_DIR)
176 mark_as_advanced(ILUT_LIBRARIES)
177 mark_as_advanced(ILU_LIBRARIES)
178 mark_as_advanced(IL_LIBRARIES)
3e661ac @lubosz options for not buildings tests and tools
lubosz authored
179
7a4b058 @lubosz fixed formatting and include folder
lubosz authored
180 set(SRC_DIR src)
5c2d73a @SebastienLussier Fixed VC2010 warnings/errors/projects
SebastienLussier authored
181
1c49525 @SebastienLussier Updated CMakeLists.txt to add 64-bit support under Windows + misc cha…
SebastienLussier authored
182 if(MSVC)
9c8ee72 Now builds under Windows with MSVC. Removed a lot of warnings, but a …
slussier authored
183 # Disable deprecation warnings
90b2db2 @SebastienLussier Updated CMakeLists.txt to generate nicer vs project
SebastienLussier authored
184 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
9c8ee72 Now builds under Windows with MSVC. Removed a lot of warnings, but a …
slussier authored
185 add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
a918ef4 @SebastienLussier Fixed sources groups to fit new folder structure
SebastienLussier authored
186 add_definitions(-D_SCL_SECURE_NO_WARNINGS)
4ef1483 @SebastienLussier Use boost auto linking feature when building with MSVC
SebastienLussier authored
187 add_definitions(/wd4995) # 'func': name was marked as #pragma deprecated
517854a @SebastienLussier Enable multiprocess build (/MP)
SebastienLussier authored
188
d0d4145 @SebastienLussier * Switched to lowercase types (ex: s32 instead of S32)
SebastienLussier authored
189 # TEMP - disable warning caused by the F2L removal
4ef1483 @SebastienLussier Use boost auto linking feature when building with MSVC
SebastienLussier authored
190 add_definitions(/wd4244) # Conversion from 'float' to 'long', possible loss of data
517854a @SebastienLussier Enable multiprocess build (/MP)
SebastienLussier authored
191
1c49525 @SebastienLussier Updated CMakeLists.txt to add 64-bit support under Windows + misc cha…
SebastienLussier authored
192 # TEMP - disable warning caused by conversion from a 64-bit type to a 32-bit one...
193 if(CMAKE_CL_64)
e06a3ea @SebastienLussier Disable warning C4201: nonstandard extension used : nameless struct/u…
SebastienLussier authored
194 add_definitions(/wd4267) # Conversion from 'size_t' to 'xxx', possible loss of data
1c49525 @SebastienLussier Updated CMakeLists.txt to add 64-bit support under Windows + misc cha…
SebastienLussier authored
195 endif()
0a51801 @SebastienLussier msvc - Removed some costly checks when building without ARX_DEBUG_EXTRA
SebastienLussier authored
196
43e7630 @SebastienLussier Disabled warning C4127: conditional expression is constant
SebastienLussier authored
197 add_definitions(/wd4127) # warning C4127: conditional expression is constant
e06a3ea @SebastienLussier Disable warning C4201: nonstandard extension used : nameless struct/u…
SebastienLussier authored
198 add_definitions(/wd4201) # warning C4201: nonstandard extension used : nameless struct/union
f2175e5 @SebastienLussier Disable warning related to long decorated name
SebastienLussier authored
199 add_definitions(/wd4503) # warning C4503: 'xxx' : decorated name length exceeded, name was truncated
43e7630 @SebastienLussier Disabled warning C4127: conditional expression is constant
SebastienLussier authored
200
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
201 if(NOT DEBUG_EXTRA)
0a51801 @SebastienLussier msvc - Removed some costly checks when building without ARX_DEBUG_EXTRA
SebastienLussier authored
202 add_definitions(-D_HAS_ITERATOR_DEBUGGING=0)
203 add_definitions(-D_SECURE_SCL=0)
204 add_definitions(-D_SECURE_SCL_THROWS=0)
205 add_definitions(-D_ITERATOR_DEBUG_LEVEL=0)
206 endif()
517854a @SebastienLussier Enable multiprocess build (/MP)
SebastienLussier authored
207
1d0faae @SebastienLussier Disabled exception handling and RTTI
SebastienLussier authored
208 # Disable exceptions & rtti
517854a @SebastienLussier Enable multiprocess build (/MP)
SebastienLussier authored
209 add_definitions(/GR-) # No RTTI
210
211 # Enable multiprocess build
212 add_definitions(/MP)
43619b9 @SebastienLussier Define _WIN32_WINNT=0x502 so that we get errors when trying to use so…
SebastienLussier authored
213
214 # Ensure we aren't using functionalities not found under Window XP SP1
215 add_definitions(-D_WIN32_WINNT=0x0502)
517854a @SebastienLussier Enable multiprocess build (/MP)
SebastienLussier authored
216
9b4702b @SebastienLussier Modified options when building the release target with MSVC
SebastienLussier authored
217 foreach(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE)
fd62179 @SebastienLussier Disable run time checks when building with MSVC
SebastienLussier authored
218 # Disable Run time checks
219 string(REGEX REPLACE "/RTC1" "" ${flag_var} "${${flag_var}}")
517854a @SebastienLussier Enable multiprocess build (/MP)
SebastienLussier authored
220
1c49525 @SebastienLussier Updated CMakeLists.txt to add 64-bit support under Windows + misc cha…
SebastienLussier authored
221 # Change runtime library from "Multi-threaded Debug DLL" to "Multi-threaded DLL"
4ef1483 @SebastienLussier Use boost auto linking feature when building with MSVC
SebastienLussier authored
222 string(REGEX REPLACE "/MDd" "/MD" ${flag_var} "${${flag_var}}")
517854a @SebastienLussier Enable multiprocess build (/MP)
SebastienLussier authored
223
224 # Remove definition of _DEBUG as it might conflict with libs we're linking with
5004296 @dscharrer Fix some mingw32 compile issues.
dscharrer authored
225 string(REGEX REPLACE "/D_DEBUG" "/DNDEBUG" ${flag_var} "${${flag_var}}")
34f6a24 @SebastienLussier MSVC now builds with warning level 4
SebastienLussier authored
226
030b662 @SebastienLussier [MSVC] Reverted back to warning level 3 to avoid warnings in Qt heade…
SebastienLussier authored
227 # Force to always compile with warning level 3
228 string(REGEX REPLACE "/W[0-4]" "/W3" ${flag_var} "${${flag_var}}")
1c49525 @SebastienLussier Updated CMakeLists.txt to add 64-bit support under Windows + misc cha…
SebastienLussier authored
229 endforeach(flag_var)
517854a @SebastienLussier Enable multiprocess build (/MP)
SebastienLussier authored
230
1c49525 @SebastienLussier Updated CMakeLists.txt to add 64-bit support under Windows + misc cha…
SebastienLussier authored
231 # Avoid warning during link
6088737 @SebastienLussier Windows crash reports now created with a valid title "[CallstackCRC] …
SebastienLussier authored
232 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:LIBCMT")
233
234 # Disable randomized base address (for better callstack matching)
235 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DYNAMICBASE:NO")
332e585 @SebastienLussier Always generate PDB files
SebastienLussier authored
236
237 # Always generate a PDB file
238 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG")
517854a @SebastienLussier Enable multiprocess build (/MP)
SebastienLussier authored
239
9b4702b @SebastienLussier Modified options when building the release target with MSVC
SebastienLussier authored
240 # Enable compiler optimization in release
241 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox /Oi /Ot /GL /arch:SSE2 /GS- /fp:fast")
242
c044508 @dscharrer Remove trailing whitespace from cmake files.
dscharrer authored
243 # Always build with debug information
a97692a @SebastienLussier Always build with debug information to generate a PDB
SebastienLussier authored
244 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
245
9b4702b @SebastienLussier Modified options when building the release target with MSVC
SebastienLussier authored
246 # Enable linker optimization in release
247 # /OPT:REF Eliminate unreferenced code
248 # /OPT:ICF COMDAT folding (merge functions generating the same code)
249 set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /LTCG")
250
c12620a @SebastienLussier Workaround for strange logic in FindOpenSSL (Windows only)
SebastienLussier authored
251 # This is needed to use ZLIB
1c49525 @SebastienLussier Updated CMakeLists.txt to add 64-bit support under Windows + misc cha…
SebastienLussier authored
252 add_definitions(-DZLIB_WINAPI)
517854a @SebastienLussier Enable multiprocess build (/MP)
SebastienLussier authored
253
ab07b50 @dscharrer Use consistent casing in CMakeLists.txt
dscharrer authored
254 else(MSVC)
ec98148 @dscharrer Add stub SDL Window and InputBackend and OpenGL Renderer implementati…
dscharrer authored
255
8449180 @dscharrer Fix compile errors in 64-bit build.
dscharrer authored
256 # Check the dependencies so there won't by cryptic link errors later on when found libraries have the wrong architecture (32- vs. 64-bit)
822c9c0 @dscharrer Fix support for non-wine, non-msvc compilers (like mingw) in CMakeLis…
dscharrer authored
257 if(CMAKE_THREAD_LIBS_INIT)
258 check_link_library(Threads CMAKE_THREAD_LIBS_INIT)
259 endif()
26f3a28 @dscharrer If we cannot link to the exact libraries found by cmake try linking a…
dscharrer authored
260 check_link_library(DevIL IL_LIBRARIES IL)
261 check_link_library(ZLIB ZLIB_LIBRARIES)
262 check_link_library(Freetype FREETYPE_LIBRARIES)
7c025c3 @dscharrer Relax backend selection in CMake: don't fail if a backend that was en…
dscharrer authored
263 if(USE_OPENAL AND OPENAL_FOUND)
41d57f0 @dscharrer Make building the OpenAL and DirectSound backends optional.
dscharrer authored
264 check_link_library(OpenAL OPENAL_LIBRARY)
265 endif()
c5330e5 @dscharrer Add missing GLEW_FOUND check in CMakeLists.txt
dscharrer authored
266 if(USE_OPENGL AND OPENGL_FOUND AND GLEW_FOUND)
aa36bda @dscharrer Revert "CMakeLists.txt: Don't use find_package(OpenGL)"
dscharrer authored
267 check_link_library(OpenGL OPENGL_gl_LIBRARY)
d140a05 @dscharrer Start implementing OpenGLRenderer.
dscharrer authored
268 check_link_library(GLEW GLEW_LIBRARIES)
c105d07 @dscharrer Make building the OpenGLRenderer optional, disabled by default.
dscharrer authored
269 endif()
7c025c3 @dscharrer Relax backend selection in CMake: don't fail if a backend that was en…
dscharrer authored
270 if(USE_SDL AND SDL_FOUND)
ec98148 @dscharrer Add stub SDL Window and InputBackend and OpenGL Renderer implementati…
dscharrer authored
271 check_link_library(SDL SDL_LIBRARY)
272 endif()
734fab0 @dscharrer Use find_package in CMakeLists.txt instead of hardcoding library name…
dscharrer authored
273
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
274 if(ARX_HAVE_CRASHREPORTER)
276f796 @dscharrer CMake: Check for OpenSSL and Qt library architecture compatibility on…
dscharrer authored
275 check_link_library(QtCore QT_QTCORE_LIBRARY_RELEASE QT_QTCORE)
276 check_link_library(QtGui QT_QTGUI_LIBRARY_RELEASE QT_QTGUI)
4d7cf61 @SebastienLussier Crash reporter now creates issues on the bug tracker
SebastienLussier authored
277 check_link_library(QtNetwork QT_QTNETWORK_LIBRARY_RELEASE QT_QTNETWORK)
276f796 @dscharrer CMake: Check for OpenSSL and Qt library architecture compatibility on…
dscharrer authored
278 endif()
279
069bd2b @dscharrer CMake: Only define _POSIX_C_SOURCE and _XOPEN_SOURCE on glibc systems…
dscharrer authored
280 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "GNU"
281 OR ${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD")
282 set(CMAKE_REQUIRED_DEFINITIONS "-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=600")
283 add_definitions(-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=600)
284 if(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD")
285 set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_BSD_SOURCE")
286 add_definitions(-D_BSD_SOURCE)
287 endif()
b7a059a @SebastienLussier Mac OS X - Handle filesystem case-insensitivity in fs::rename()
SebastienLussier authored
288 endif()
d61b3e8 @dscharrer CMake: Always define -D_POSIX_C_SOURCE=200809L and -D_XOPEN_SOURCE=60…
dscharrer authored
289
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
290 check_symbol_exists(nanosleep "time.h" ARX_HAVE_NANOSLEEP)
8460870 @dscharrer [cmake] Don't try to link -lrt when looking for nanosleep.
dscharrer authored
291
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
292 check_symbol_exists(pthread_setname_np "pthread.h" ARX_HAVE_PTHREAD_SETNAME_NP)
293 check_symbol_exists(pthread_set_name_np "pthread.h" ARX_HAVE_PTHREAD_SET_NAME_NP)
294 check_symbol_exists(prctl "sys/prctl.h" ARX_HAVE_PRCTL)
295 check_symbol_exists(PR_SET_NAME "linux/prctl.h" ARX_HAVE_PR_SET_NAME)
8ed9392 @dscharrer Implement setting the thread name under non-windows systems and inclu…
dscharrer authored
296
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
297 check_symbol_exists(uname "sys/utsname.h" ARX_HAVE_UNAME)
298 check_symbol_exists(getrusage "sys/resource.h" ARX_HAVE_GETRUSAGE)
8ed9392 @dscharrer Implement setting the thread name under non-windows systems and inclu…
dscharrer authored
299
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
300 check_symbol_exists(popen "stdio.h" ARX_HAVE_POPEN)
301 check_symbol_exists(pclose "stdio.h" ARX_HAVE_PCLOSE)
4e54df0 @dscharrer crash reporter: Include the linux distribution name and version in th…
dscharrer authored
302
b42ee3e @dscharrer Improve getExecutablePath() on some systems
dscharrer authored
303 check_symbol_exists(getexecname "stdlib.h" ARX_HAVE_GETEXECNAME)
304
a27a7da @dscharrer Link the crash reporter against the rt library if available as it is …
dscharrer authored
305 find_library(LIBRT_LIBRARY rt)
306
307 if(LIBRT_LIBRARY)
308 set(CMAKE_REQUIRED_LIBRARIES "${LIBRT_LIBRARY}")
309 endif()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
310 check_symbol_exists(clock_gettime "time.h" ARX_HAVE_CLOCK_GETTIME)
a27a7da @dscharrer Link the crash reporter against the rt library if available as it is …
dscharrer authored
311 if(LIBRT_LIBRARY)
312 unset(CMAKE_REQUIRED_LIBRARIES)
313 endif()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
314 if(NOT ARX_HAVE_CLOCK_GETTIME AND NOT ARX_HAVE_WINAPI)
315 check_include_files("mach/clock.h;mach/clock_types.h;mach/mach_host.h" ARX_HAVE_MACH_CLOCK)
7fa9f82 @dscharrer Write configure options to a header instead of passing them on the co…
dscharrer authored
316 endif()
317
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
318 check_include_file("wordexp.h" ARX_HAVE_WORDEXP_H)
3ebc8d6 @dscharrer Fix mingw32 build.
dscharrer authored
319
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
320 check_symbol_exists(fork "unistd.h" ARX_HAVE_FORK)
321 check_symbol_exists(readlink "unistd.h" ARX_HAVE_READLINK)
322 check_symbol_exists(dup2 "unistd.h" ARX_HAVE_DUP2)
323 check_symbol_exists(execl "unistd.h" ARX_HAVE_EXECL)
324 check_symbol_exists(execlp "unistd.h" ARX_HAVE_EXECLP)
69c6305 @dscharrer Fix mingw32 build.
dscharrer authored
325 if(NOT WIN32)
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
326 check_symbol_exists(isatty "unistd.h" ARX_HAVE_ISATTY)
69c6305 @dscharrer Fix mingw32 build.
dscharrer authored
327 endif()
fbfbc3d @dscharrer Add missing #cmakedefine HAVE_FPATHCONF in Configure.h.cmake and clea…
dscharrer authored
328
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
329 check_symbol_exists(sched_getscheduler "sched.h" ARX_HAVE_SCHED_GETSCHEDULER)
f48b658 @dscharrer Check for sched_getscheduler in CMakeLists.txt
dscharrer authored
330
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
331 check_symbol_exists(kill "signal.h" ARX_HAVE_KILL)
fbfbc3d @dscharrer Add missing #cmakedefine HAVE_FPATHCONF in Configure.h.cmake and clea…
dscharrer authored
332
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
333 check_symbol_exists(backtrace "execinfo.h" ARX_HAVE_BACKTRACE)
9490540 @dscharrer Add a crash handler that prints very detailed stack traces if gdb is …
dscharrer authored
334
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
335 check_include_file("sys/types.h" ARX_HAVE_SYS_TYPES_H)
336 check_symbol_exists(getpid "unistd.h" ARX_HAVE_GETPID)
6c773aa @dscharrer crash handler: Don't use internal boost types and functions.
dscharrer authored
337
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
338 check_symbol_exists(sysconf "unistd.h" ARX_HAVE_SYSCONF)
b522cd1 @dscharrer crash reporter: Fix process running time and memory usage stats under…
dscharrer authored
339
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
340 check_symbol_exists(sigaction "signal.h" ARX_HAVE_SIGACTION)
c7ff004 @dscharrer crash handler: Use sigaction if available, use SIGKILL to terminate t…
dscharrer authored
341
b42ee3e @dscharrer Improve getExecutablePath() on some systems
dscharrer authored
342 check_symbol_exists(sysctl "sys/sysctl.h" ARX_HAVE_SYSCTL)
343
6d193a3 @dscharrer Add a USE_NATIVE_FS cmake flag to allow testing the boost::filesystem…
dscharrer authored
344 if(USE_NATIVE_FS)
345
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
346 check_include_file("sys/stat.h" ARX_HAVE_SYS_STAT_H)
347 check_include_file("sys/errno.h" ARX_HAVE_SYS_ERRNO_H)
348 check_include_file("dirent.h" ARX_HAVE_DIRENT_H)
6d193a3 @dscharrer Add a USE_NATIVE_FS cmake flag to allow testing the boost::filesystem…
dscharrer authored
349
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
350 check_symbol_exists(readdir_r "dirent.h" ARX_HAVE_READDIR_R)
8792bba @dscharrer FilesystemPOSIX: Add support for systems without dirfd and fstatat.
dscharrer authored
351
66f06ab @dscharrer Improve data directory detection and handling
dscharrer authored
352 check_symbol_exists(getcwd "unistd.h" ARX_HAVE_GETCWD)
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
353 check_symbol_exists(fpathconf "unistd.h" ARX_HAVE_FPATHCONF)
354 check_symbol_exists(pathconf "unistd.h" ARX_HAVE_PATHCONF)
355 check_symbol_exists(_PC_NAME_MAX "unistd.h" ARX_HAVE_PC_NAME_MAX)
356 check_symbol_exists(_PC_CASE_SENSITIVE "unistd.h" ARX_HAVE_PC_CASE_SENSITIVE)
e566beb @dscharrer Fix whitespace in CMakeLists.txt
dscharrer authored
357
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
358 check_symbol_exists(dirfd "dirent.h" ARX_HAVE_DIRFD)
6d193a3 @dscharrer Add a USE_NATIVE_FS cmake flag to allow testing the boost::filesystem…
dscharrer authored
359
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
360 check_symbol_exists(fstatat "sys/stat.h" ARX_HAVE_FSTATAT)
6d193a3 @dscharrer Add a USE_NATIVE_FS cmake flag to allow testing the boost::filesystem…
dscharrer authored
361
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
362 check_symbol_exists(NAME_MAX "dirent.h" ARX_HAVE_NAME_MAX)
6d193a3 @dscharrer Add a USE_NATIVE_FS cmake flag to allow testing the boost::filesystem…
dscharrer authored
363
66f06ab @dscharrer Improve data directory detection and handling
dscharrer authored
364 if(ARX_HAVE_SYS_STAT_H AND ARX_HAVE_SYS_ERRNO_H AND ARX_HAVE_DIRENT_H
365 AND ARX_HAVE_READDIR_R AND ARX_HAVE_GETCWD
366 AND ((((ARX_HAVE_DIRFD AND ARX_HAVE_FPATHCONF) OR ARX_HAVE_PATHCONF)
367 AND ARX_HAVE_PC_NAME_MAX) OR ARX_HAVE_NAME_MAX))
368 set(ARX_HAVE_POSIX_FILESYSTEM 1)
fbfbc3d @dscharrer Add missing #cmakedefine HAVE_FPATHCONF in Configure.h.cmake and clea…
dscharrer authored
369 endif()
6d193a3 @dscharrer Add a USE_NATIVE_FS cmake flag to allow testing the boost::filesystem…
dscharrer authored
370
fbfbc3d @dscharrer Add missing #cmakedefine HAVE_FPATHCONF in Configure.h.cmake and clea…
dscharrer authored
371 endif()
372
5c954b9 @dscharrer Enable more warnings on gcc.
dscharrer authored
373 # Warning level
13ce969 @dscharrer Check if compiler options are supported in CMakeLists.txt
dscharrer authored
374 add_cxxflag("-Wall")
375 add_cxxflag("-Wextra")
376 add_cxxflag("-Wformat=2")
377 add_cxxflag("-Wundef")
378 add_cxxflag("-Wpointer-arith")
379 add_cxxflag("-Wcast-qual")
380 add_cxxflag("-Woverloaded-virtual")
381 add_cxxflag("-Wlogical-op")
382
383 add_cxxflag("-Wliteral-conversion")
384 add_cxxflag("-Wshift-overflow")
ec867ea @dscharrer Add more warning switches.
dscharrer authored
385 add_cxxflag("-Woverflow")
386 add_cxxflag("-Wbool-conversions")
13ce969 @dscharrer Check if compiler options are supported in CMakeLists.txt
dscharrer authored
387
c044508 @dscharrer Remove trailing whitespace from cmake files.
dscharrer authored
388 # TODO enable:
13ce969 @dscharrer Check if compiler options are supported in CMakeLists.txt
dscharrer authored
389 # add_cxxflag("-Wconversion") # very noisy
390 # add_cxxflag("-Wsign-conversion") # very noisy
391 # add_cxxflag("-Wmissing-declarations") # to catch functions that should be marked as static
392 # add_cxxflag("-Wredundant-decls") # to catch extern definitions in .cpp files (with UNITYBUILD)
7a9b106 @dscharrer Add debug option in CMakeLists.txt
dscharrer authored
393
618c743 @dscharrer CMake: Set the build type to Release if empty.
dscharrer authored
394 if(CMAKE_BUILD_TYPE STREQUAL "")
395 set(CMAKE_BUILD_TYPE "Release")
396 endif()
397
398 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
68f8415 @dscharrer [cmake] Make sure there is always only one -g* compiler option.
dscharrer authored
399
7a9b106 @dscharrer Add debug option in CMakeLists.txt
dscharrer authored
400 #Debug
5c2d73a @SebastienLussier Fixed VC2010 warnings/errors/projects
SebastienLussier authored
401 add_definitions(-D_DEBUG)
68f8415 @dscharrer [cmake] Make sure there is always only one -g* compiler option.
dscharrer authored
402
403 check_compiler_flag(RESULT "-g3")
404 if(NOT RESULT STREQUAL "")
405 string(REGEX REPLACE "-g(|[0-9]|gdb)" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
406 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${RESULT}")
407 endif()
408
409 check_compiler_flag(RESULT "-O0")
410 string(REGEX REPLACE "-O[0-9]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
411 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${RESULT}")
412
d7cfff2 @dscharrer CMake: else is not elseif and linux is not mac ;-)
dscharrer authored
413 elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
96b0eb5 @dscharrer CMake: Add debug symbols to the release build unless explicitly disab…
dscharrer authored
414
415 if((NOT CMAKE_CXX_FLAGS MATCHES "-g(|[0-9]|gdb)")
416 AND (NOT CMAKE_CXX_FLAGS_RELEASE MATCHES "-g(|[0-9]|gdb)"))
417 add_cxxflag("-g2")
418 endif()
419
7a9b106 @dscharrer Add debug option in CMakeLists.txt
dscharrer authored
420 endif()
f9b122d @lubosz define HAVE_PTHREADS in cmake
lubosz authored
421
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
422 if(DEBUG_EXTRA)
b8f5ed0 @dscharrer Enable more runtime checks for ARX_DEBUG_EXTRA.
dscharrer authored
423 add_cxxflag("-ftrapv") # to add checks for (undefined) signed integer overflow
ec867ea @dscharrer Add more warning switches.
dscharrer authored
424 add_cxxflag("-fbounds-checking")
7a9d913 @dscharrer CMake: remove explicit checks for clang
dscharrer authored
425 add_cxxflag("-fcatch-undefined-behavior")
1741740 @dscharrer CMake: Add aggressive strict aluasing warnings to the DEBUG_EXTRA build.
dscharrer authored
426 add_cxxflag("-Wstrict-aliasing=1")
0c66651 @dscharrer Remove the _WIN32 added by winegcc so that headers of native librarie…
dscharrer authored
427 else()
cfffed9 @dscharrer Disable unitialized variable warnings on normal builds because of fa…
dscharrer authored
428 # -Wuninitialized causes too many false positives
13ce969 @dscharrer Check if compiler options are supported in CMakeLists.txt
dscharrer authored
429 add_cxxflag("-Wno-uninitialized")
621a4e1 @dscharrer [clang] Ignore -Wconstant-logical-operand warnings.
dscharrer authored
430 # (clang only) Conflicts with using const variables for configuration.
7a9d913 @dscharrer CMake: remove explicit checks for clang
dscharrer authored
431 add_cxxflag("-Wno-constant-logical-operand")
7a9b106 @dscharrer Add debug option in CMakeLists.txt
dscharrer authored
432 endif()
bc5eff0 @dscharrer Add -fwhole-program for unity build on gcc.
dscharrer authored
433
1e89e00 @dscharrer CMake: Use -Wl,--as-needed so the linker will drop libraries that are…
dscharrer authored
434 # Because we are lazy
0a1b7ca @dscharrer CMake: Don't include linker flags in CMAKE_CXX_FLAGS or older gcc ver…
dscharrer authored
435 add_ldflag("-Wl,--as-needed")
42e750d @SebastienLussier Xcode does not support -isystem yet
SebastienLussier authored
436
437 # Xcode does not support -isystem yet
438 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
439 add_cxxflag("-Wno-undef")
c044508 @dscharrer Remove trailing whitespace from cmake files.
dscharrer authored
440 endif()
1e89e00 @dscharrer CMake: Use -Wl,--as-needed so the linker will drop libraries that are…
dscharrer authored
441
024ff74 @dscharrer Use __attribute__((format(printf))) if supported
dscharrer authored
442 # check support for __attribute__((format(printf, i, j)))
443 check_cxx_source_compiles(
444 "void my_printf(const char *, ...) __attribute__((format(printf, 1, 2))); int main() { return 0; };\n"
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
445 ARX_HAVE_ATTRIBUTE_FORMAT_PRINTF
024ff74 @dscharrer Use __attribute__((format(printf))) if supported
dscharrer authored
446 )
447
ab07b50 @dscharrer Use consistent casing in CMakeLists.txt
dscharrer authored
448 endif(MSVC)
c058032 @lubosz build debug
lubosz authored
449
29f1a61 @dscharrer Remove winelib support
dscharrer authored
450 if(WIN32)
c74b937 @SebastienLussier Use "%FOLDERID_SavedGames%\Arx Libertatis" as the default user/data d…
SebastienLussier authored
451 # Define default user and data directories.
452 if(NOT DEFINED USER_DIR)
453 set(USER_DIR "Arx Libertatis")
454 endif()
4db4d9c @dscharrer Detect user/data directory locations.
dscharrer authored
455 if(NOT DEFINED USER_DIR_PREFIXES)
38eaeb0 @SebastienLussier Changed default user directories on Windows to better match the stand…
SebastienLussier authored
456 set(USER_DIR_PREFIXES "%FOLDERID_SavedGames%")
4db4d9c @dscharrer Detect user/data directory locations.
dscharrer authored
457 endif()
d7cfff2 @dscharrer CMake: else is not elseif and linux is not mac ;-)
dscharrer authored
458 elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
7def37a @SebastienLussier Data/User/Config variables now set for Mac
SebastienLussier authored
459 # Define default user and data directories.
460 if(NOT DEFINED DATA_DIR)
461 set(DATA_DIR "ArxLibertatis")
462 endif()
463 if(NOT DEFINED USER_DIR)
464 set(USER_DIR "ArxLibertatis")
465 endif()
466 if(NOT DEFINED DATA_DIR_PREFIXES)
467 set(DATA_DIR_PREFIXES "/Applications")
468 endif()
469 if(NOT DEFINED USER_DIR_PREFIXES)
470 set(USER_DIR_PREFIXES "~/Library/Application Support")
471 endif()
4db4d9c @dscharrer Detect user/data directory locations.
dscharrer authored
472 else()
c74b937 @SebastienLussier Use "%FOLDERID_SavedGames%\Arx Libertatis" as the default user/data d…
SebastienLussier authored
473 # Define default user and data directories.
474 if(NOT DEFINED DATA_DIR)
f544c3d @dscharrer Add 'arx' as a data dir suffix besides 'games/arx'
dscharrer authored
475 set(DATA_DIR "games/arx:arx")
c74b937 @SebastienLussier Use "%FOLDERID_SavedGames%\Arx Libertatis" as the default user/data d…
SebastienLussier authored
476 endif()
477 if(NOT DEFINED USER_DIR)
478 set(USER_DIR "arx")
479 endif()
c0729e4 @dscharrer Support separate config and user directories to be fully XDG complian…
dscharrer authored
480 if(NOT DEFINED CONFIG_DIR)
481 set(CONFIG_DIR "arx")
482 endif()
4db4d9c @dscharrer Detect user/data directory locations.
dscharrer authored
483 if(NOT DEFINED DATA_DIR_PREFIXES)
5f8d696 @dscharrer Add /opt as a data dir prefix after $XDG_DATA_DIRS
dscharrer authored
484 set(DATA_DIR_PREFIXES "$XDG_DATA_DIRS:/opt")
4db4d9c @dscharrer Detect user/data directory locations.
dscharrer authored
485 endif()
486 if(NOT DEFINED USER_DIR_PREFIXES)
487 set(USER_DIR_PREFIXES "$XDG_DATA_HOME")
488 endif()
c0729e4 @dscharrer Support separate config and user directories to be fully XDG complian…
dscharrer authored
489 if(NOT DEFINED CONFIG_DIR_PREFIXES)
490 set(CONFIG_DIR_PREFIXES "$XDG_CONFIG_HOME")
491 endif()
6784f9b @dscharrer Add the executable path as a data dir
dscharrer authored
492 if(NOT DEFINED IGNORE_EXE_DIR)
493 set(IGNORE_EXE_DIR "/usr/bin:/usr/games:/usr/games/bin:/usr/local/bin:/usr/local/games:/usr/local/games/bin")
494 endif()
0ffea62 @dscharrer Time(linux): Fallback to CLOCK_REALTIME if CLOCK_MONOTONIC is not ava…
dscharrer authored
495 endif()
4db4d9c @dscharrer Detect user/data directory locations.
dscharrer authored
496
7fa9f82 @dscharrer Write configure options to a header instead of passing them on the co…
dscharrer authored
497 # Check that all required functionality is available.
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
498 if(CMAKE_USE_PTHREADS_INIT AND ARX_HAVE_SYS_TYPES_H AND ARX_HAVE_GETPID)
499 set(ARX_HAVE_PTHREADS 1)
7fa9f82 @dscharrer Write configure options to a header instead of passing them on the co…
dscharrer authored
500 endif()
20b0067 @lubosz added mingw as option, removed wine header include for wine gcc, updated
lubosz authored
501
90b2db2 @SebastienLussier Updated CMakeLists.txt to generate nicer vs project
SebastienLussier authored
502 # Preprocessor definitions
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
503 if(ARX_HAVE_WINAPI)
66d2e6d @dscharrer Don't add windows.h-specific defines under linux.
dscharrer authored
504 add_definitions(-DNOMINMAX)
505 add_definitions(-DWIN32_LEAN_AND_MEAN)
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
506 endif(ARX_HAVE_WINAPI)
d86c3fb @dscharrer Enable debug output and fix related errors.
dscharrer authored
507
f748b9d @dscharrer Fix unity build.
dscharrer authored
508 # Sources
509 set(AI_SOURCES
510 src/ai/PathFinder.cpp
511 src/ai/PathFinderManager.cpp
512 src/ai/Paths.cpp
513 )
514
515 set(ANIMATION_SOURCES
516 src/animation/Animation.cpp
517 src/animation/AnimationRender.cpp
518 src/animation/Cinematic.cpp
519 src/animation/CinematicKeyframer.cpp
520 src/animation/Intro.cpp
521 )
522
523 set(AUDIO_SOURCES
524 src/audio/Ambiance.cpp
525 src/audio/Audio.cpp
526 src/audio/AudioEnvironment.cpp
527 src/audio/AudioGlobal.cpp
528 src/audio/AudioResource.cpp
529 src/audio/AudioSource.cpp
530 src/audio/Mixer.cpp
531 src/audio/Sample.cpp
532 src/audio/Stream.cpp
533 src/audio/codec/ADPCM.cpp
534 src/audio/codec/RAW.cpp
535 src/audio/codec/WAV.cpp
536 )
537
538 set(AUDIO_OPENAL_SOURCES
539 src/audio/openal/OpenALBackend.cpp
540 src/audio/openal/OpenALSource.cpp
0cd1d4c @dscharrer Improve OpenAL error messages.
dscharrer authored
541 src/audio/openal/OpenALUtils.cpp
f748b9d @dscharrer Fix unity build.
dscharrer authored
542 )
543
544 set(AUDIO_DSOUND_SOURCES
545 src/audio/dsound/DSoundBackend.cpp
546 src/audio/dsound/DSoundSource.cpp
547 )
548
549 set(CORE_SOURCES
550 src/core/Application.cpp
a97d5de @dscharrer Rename Win32Application.{cpp,h} to ArxGame.{cpp,h}
dscharrer authored
551 src/core/ArxGame.cpp
f748b9d @dscharrer Fix unity build.
dscharrer authored
552 src/core/Config.cpp
553 src/core/Core.cpp
554 src/core/GameTime.cpp
555 src/core/Localisation.cpp
844cfbe @dscharrer Store savegames in the user directory.
dscharrer authored
556 src/core/SaveGame.cpp
4db4d9c @dscharrer Detect user/data directory locations.
dscharrer authored
557 src/core/Startup.cpp
ec98148 @dscharrer Add stub SDL Window and InputBackend and OpenGL Renderer implementati…
dscharrer authored
558 )
559
f748b9d @dscharrer Fix unity build.
dscharrer authored
560 set(EDITOR_SOURCES
561 src/core/Dialog.cpp
562 src/script/ScriptDebugger.cpp
563 src/script/ScriptDebuggerDialog.cpp
564 )
565
566 set(GAME_SOURCES
567 src/game/Damage.cpp
568 src/game/Equipment.cpp
569 src/game/Inventory.cpp
570 src/game/Levels.cpp
571 src/game/Map.cpp
572 src/game/Missile.cpp
573 src/game/NPC.cpp
574 src/game/Player.cpp
575 src/game/Spells.cpp
576 )
577
578 set(GRAPHICS_SOURCES
579 src/graphics/Draw.cpp
580 src/graphics/GraphicsModes.cpp
581 src/graphics/GraphicsUtility.cpp
582 src/graphics/Math.cpp
583 src/graphics/Renderer.cpp
584 src/graphics/data/CinematicTexture.cpp
585 src/graphics/data/FTL.cpp
586 src/graphics/data/Mesh.cpp
587 src/graphics/data/MeshManipulation.cpp
588 src/graphics/data/Progressive.cpp
589 src/graphics/data/TextureContainer.cpp
590 src/graphics/effects/CinematicEffects.cpp
591 src/graphics/effects/DrawEffects.cpp
592 src/graphics/effects/Fog.cpp
593 src/graphics/effects/SpellEffects.cpp
594 src/graphics/font/Font.cpp
595 src/graphics/font/FontCache.cpp
596 src/graphics/image/Image.cpp
597 src/graphics/particle/Particle.cpp
598 src/graphics/particle/ParticleEffects.cpp
599 src/graphics/particle/ParticleManager.cpp
600 src/graphics/particle/ParticleSystem.cpp
601 src/graphics/spells/Spells01.cpp
602 src/graphics/spells/Spells02.cpp
603 src/graphics/spells/Spells03.cpp
604 src/graphics/spells/Spells04.cpp
605 src/graphics/spells/Spells05.cpp
606 src/graphics/spells/Spells06.cpp
607 src/graphics/spells/Spells07.cpp
608 src/graphics/spells/Spells08.cpp
609 src/graphics/spells/Spells09.cpp
610 src/graphics/spells/Spells10.cpp
611 src/graphics/texture/PackedTexture.cpp
612 src/graphics/texture/Texture.cpp
613 src/graphics/texture/TextureStage.cpp
614 )
a996870 @SebastienLussier [DX7] Removed all dx7 backends (please don't cry)
SebastienLussier authored
615
365d73b @SebastienLussier First working implementation of Arx using DirectX 9 (D3D9 & DInput8)
SebastienLussier authored
616 set(GRAPHICS_D3D9_SOURCES
617 src/graphics/d3d9/D3D9Renderer.cpp
618 src/graphics/d3d9/D3D9Texture2D.cpp
619 src/graphics/d3d9/D3D9TextureStage.cpp
620 )
f748b9d @dscharrer Fix unity build.
dscharrer authored
621 set(GRAPHICS_OPENGL_SOURCES
ec98148 @dscharrer Add stub SDL Window and InputBackend and OpenGL Renderer implementati…
dscharrer authored
622 src/graphics/opengl/GLTexture2D.cpp
623 src/graphics/opengl/GLTextureStage.cpp
f748b9d @dscharrer Fix unity build.
dscharrer authored
624 src/graphics/opengl/OpenGLRenderer.cpp
625 )
626
627 set(GUI_SOURCES
628 src/gui/Credits.cpp
629 src/gui/Interface.cpp
630 src/gui/Menu.cpp
631 src/gui/MenuPublic.cpp
632 src/gui/MenuWidgets.cpp
633 src/gui/MiniMap.cpp
6b335d4 @dscharrer gui: Cleanup note and quest book rendering. (fixes bug #206 and parts…
dscharrer authored
634 src/gui/Note.cpp
f748b9d @dscharrer Fix unity build.
dscharrer authored
635 src/gui/Speech.cpp
636 src/gui/Text.cpp
637 src/gui/TextManager.cpp
638 )
639
640 set(INPUT_SOURCES src/input/Input.cpp)
365d73b @SebastienLussier First working implementation of Arx using DirectX 9 (D3D9 & DInput8)
SebastienLussier authored
641 set(INPUT_DINPUT8_SOURCES src/input/DInput8Backend.cpp)
ec98148 @dscharrer Add stub SDL Window and InputBackend and OpenGL Renderer implementati…
dscharrer authored
642 set(INPUT_SDL_SOURCES src/input/SDLInputBackend.cpp)
b175ff2 @dscharrer Only build one of FilesystemPOSIX.cpp, FilesystemWindows.cpp, Filesys…
dscharrer authored
643
644 set(IO_SOURCES
645 src/io/CinematicLoad.cpp
646 src/io/Implode.cpp
647 src/io/IniReader.cpp
648 src/io/IniSection.cpp
649 src/io/IniWriter.cpp
650 src/io/IO.cpp
651 src/io/SaveBlock.cpp
652 src/io/Screenshot.cpp
f748b9d @dscharrer Fix unity build.
dscharrer authored
653 )
9c928c0 @dscharrer Support log backends, add a file log backend.
dscharrer authored
654 set(IO_LOGGER_SOURCES
655 src/io/log/ConsoleLogger.cpp
52aaad0 @dscharrer [log] Share formatting between ConsoleLogger, FileLogger and MsvcLogger.
dscharrer authored
656 src/io/log/LogBackend.cpp
9c928c0 @dscharrer Support log backends, add a file log backend.
dscharrer authored
657 src/io/log/Logger.cpp
658 )
6ff6a73 @dscharrer Never display error doalogs for console-only applications (arxunpak, …
dscharrer authored
659 set(IO_LOGGER_EXTRA_SOURCES
660 src/io/log/FileLogger.cpp
661 src/io/log/CriticalLogger.cpp
662 )
b69d7b3 @dscharrer Rename fs::path to res::path.
dscharrer authored
663 set(IO_RESOURCE_SOURCES
090a859 @dscharrer CMake: Don't link the CrashHandler in the crash reporter to avoid pul…
dscharrer authored
664 src/io/Blast.cpp
b69d7b3 @dscharrer Rename fs::path to res::path.
dscharrer authored
665 src/io/resource/PakEntry.cpp
666 src/io/resource/PakReader.cpp
667 src/io/resource/ResourcePath.cpp
668 )
9c928c0 @dscharrer Support log backends, add a file log backend.
dscharrer authored
669 set(IO_LOGGER_POSIX_SOURCES src/io/log/ColorLogger.cpp)
670 set(IO_LOGGER_WINDOWS_SOURCES src/io/log/MsvcLogger.cpp)
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
671 set(IO_FILESYSTEM_SOURCES
b2c3ef7 @dscharrer Add a separate fs::path class for filesystem paths.
dscharrer authored
672 src/io/fs/FilePath.cpp
673 src/io/fs/FileStream.cpp
674 src/io/fs/Filesystem.cpp
66f06ab @dscharrer Improve data directory detection and handling
dscharrer authored
675 src/io/fs/SystemPaths.cpp
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
676 )
b2c3ef7 @dscharrer Add a separate fs::path class for filesystem paths.
dscharrer authored
677 set(IO_FILESYSTEM_BOOST_SOURCES src/io/fs/FilesystemBoost.cpp)
678 set(IO_FILESYSTEM_POSIX_SOURCES src/io/fs/FilesystemPOSIX.cpp)
679 set(IO_FILESYSTEM_WINDOWS_SOURCES src/io/fs/FilesystemWindows.cpp)
f748b9d @dscharrer Fix unity build.
dscharrer authored
680
c044508 @dscharrer Remove trailing whitespace from cmake files.
dscharrer authored
681 set(MATH_SOURCES
3e3d00b @SebastienLussier Moved platform/Random.h|cpp to math/Random.h|cpp
SebastienLussier authored
682 src/math/Angle.cpp
683 src/math/Random.cpp
684 )
f748b9d @dscharrer Fix unity build.
dscharrer authored
685
686 set(PHYSICS_SOURCES
687 src/physics/Anchors.cpp
688 src/physics/Attractors.cpp
689 src/physics/Box.cpp
690 src/physics/Clothes.cpp
691 src/physics/Collisions.cpp
692 src/physics/CollisionShapes.cpp
693 src/physics/Physics.cpp
b175ff2 @dscharrer Only build one of FilesystemPOSIX.cpp, FilesystemWindows.cpp, Filesys…
dscharrer authored
694 )
695
090a859 @dscharrer CMake: Don't link the CrashHandler in the crash reporter to avoid pul…
dscharrer authored
696 # Basic platform abstraction sources
f748b9d @dscharrer Fix unity build.
dscharrer authored
697 set(PLATFORM_SOURCES
adc6b18 @SebastienLussier Added basic cross platform dialog support
SebastienLussier authored
698 src/platform/Dialog.cpp
4db4d9c @dscharrer Detect user/data directory locations.
dscharrer authored
699 src/platform/Environment.cpp
f748b9d @dscharrer Fix unity build.
dscharrer authored
700 src/platform/Lock.cpp
701 src/platform/Platform.cpp
702 src/platform/String.cpp
703 src/platform/Time.cpp
704 )
adc6b18 @SebastienLussier Added basic cross platform dialog support
SebastienLussier authored
705 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
706 list(APPEND PLATFORM_SOURCES src/platform/Dialog.mm)
707 endif()
708
5f0a21b @dscharrer Don't link Thread.cpp and arxcrashreporter, arxsavetool and arxunpak.
dscharrer authored
709 # Extra platform abstraction - depends on the crash handler
710 set(PLATFORM_EXTRA_SOURCES
711 src/platform/Thread.cpp
712 )
713
090a859 @dscharrer CMake: Don't link the CrashHandler in the crash reporter to avoid pul…
dscharrer authored
714 # Crash handler sources
a7d91ef @dscharrer Merge branch 'master' into bsd
dscharrer authored
715 set(PLATFORM_CRASHHANDLER_SOURCES src/platform/CrashHandler.cpp)
dfa314b @dscharrer Remove extra whitespace.
dscharrer authored
716 set(PLATFORM_CRASHHANDLER_IMPL_SOURCES src/platform/crashhandler/CrashHandlerImpl.cpp)
559b93f @dscharrer <WIP>
dscharrer authored
717 set(PLATFORM_CRASHHANDLER_POSIX_SOURCES src/platform/crashhandler/CrashHandlerPOSIX.cpp)
5251ef2 @SebastienLussier More cleanup - Isolated Windows specific crash handling stuff and rem…
SebastienLussier authored
718 set(PLATFORM_CRASHHANDLER_WINDOWS_SOURCES src/platform/crashhandler/CrashHandlerWindows.cpp)
719
f748b9d @dscharrer Fix unity build.
dscharrer authored
720 set(SCENE_SOURCES
721 src/scene/ChangeLevel.cpp
722 src/scene/CinematicSound.cpp
723 src/scene/GameSound.cpp
724 src/scene/Interactive.cpp
725 src/scene/Light.cpp
726 src/scene/LinkedObject.cpp
727 src/scene/LoadLevel.cpp
728 src/scene/Object.cpp
729 src/scene/Scene.cpp
730 )
731
732 set(SCRIPT_SOURCES
733 src/script/Script.cpp
734 src/script/ScriptedAnimation.cpp
735 src/script/ScriptedCamera.cpp
736 src/script/ScriptedControl.cpp
737 src/script/ScriptedConversation.cpp
738 src/script/ScriptedInterface.cpp
739 src/script/ScriptedInventory.cpp
740 src/script/ScriptedIOControl.cpp
741 src/script/ScriptedIOProperties.cpp
742 src/script/ScriptedItem.cpp
743 src/script/ScriptedLang.cpp
744 src/script/ScriptedNPC.cpp
745 src/script/ScriptedPlayer.cpp
746 src/script/ScriptedVariable.cpp
747 src/script/ScriptEvent.cpp
748 src/script/ScriptUtils.cpp
749 )
9c3e84d @lubosz stubby cmake build
lubosz authored
750
6c9db46 @dscharrer Move windowing code into a separate subdirectory.
dscharrer authored
751 set(WINDOW_SOURCES
752 src/window/RenderWindow.cpp
753 src/window/Window.cpp
754 )
755 set(WINDOW_SDL_SOURCES src/window/SDLWindow.cpp)
756 set(WINDOW_WIN32_SOURCES src/window/Win32Window.cpp)
365d73b @SebastienLussier First working implementation of Arx using DirectX 9 (D3D9 & DInput8)
SebastienLussier authored
757 set(WINDOW_D3D9_SOURCES src/window/D3D9Window.cpp)
6c9db46 @dscharrer Move windowing code into a separate subdirectory.
dscharrer authored
758
f748b9d @dscharrer Fix unity build.
dscharrer authored
759 file(GLOB_RECURSE ALL_INCLUDES ${SRC_DIR}/*.h)
41d57f0 @dscharrer Make building the OpenAL and DirectSound backends optional.
dscharrer authored
760
3837bcb @dscharrer [make style] Fix include warnings.
dscharrer authored
761 include_directories(${SRC_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/tools)
519b7f1 @dscharrer Add Boost as a dependency.
dscharrer authored
762 include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS} ${IL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
41d57f0 @dscharrer Make building the OpenAL and DirectSound backends optional.
dscharrer authored
763
c044508 @dscharrer Remove trailing whitespace from cmake files.
dscharrer authored
764 # Setting the BOOST_ROOT will result in linking failures on Visual Studio as found
765 # release and debug libs get mixed up. On windows we will empty out the
766 # Boost_LIBRARIES list and count on the auto-linking feature boost provides.
767 # http://www.boost.org/doc/libs/1_47_0/more/getting_started/windows.html#auto-linking
4ef1483 @SebastienLussier Use boost auto linking feature when building with MSVC
SebastienLussier authored
768 if (MSVC)
769 # Reset libraries list so VC will perform auto-linking.
770 set (Boost_LIBRARIES "")
c044508 @dscharrer Remove trailing whitespace from cmake files.
dscharrer authored
771
772 # Not needed anymore as BOOST_ROOT finds these properly.
4ef1483 @SebastienLussier Use boost auto linking feature when building with MSVC
SebastienLussier authored
773 # Didnt remove yet eiher so nothing breaks, added empty checks instead to not add duplicated.
774 if ("${Boost_INCLUDE_DIRS}" STREQUAL "")
775 set (Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} $ENV{BOOST_ROOT}/include)
776 endif ()
777 if ("${Boost_LIBRARY_DIRS}" STREQUAL "")
778 set (Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} $ENV{BOOST_ROOT}/lib)
779 endif ()
c044508 @dscharrer Remove trailing whitespace from cmake files.
dscharrer authored
780
4ef1483 @SebastienLussier Use boost auto linking feature when building with MSVC
SebastienLussier authored
781 # Add boost lib directory to the list of libraries paths
782 link_directories(${Boost_LIBRARY_DIRS})
783 endif ()
784
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
785 set(ARX_LIBRARIES ${FREETYPE_LIBRARIES} ${ZLIB_LIBRARIES} ${IL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
4ef1483 @SebastienLussier Use boost auto linking feature when building with MSVC
SebastienLussier authored
786
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
787 if(ARX_HAVE_WINAPI)
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
788 list(APPEND ARX_LIBRARIES gdi32 shell32 comdlg32 ole32 comctl32)
789 endif()
790
7c025c3 @dscharrer Relax backend selection in CMake: don't fail if a backend that was en…
dscharrer authored
791 if(USE_OPENAL AND OPENAL_FOUND)
6c9db46 @dscharrer Move windowing code into a separate subdirectory.
dscharrer authored
792 list(APPEND AUDIO_SOURCES ${AUDIO_OPENAL_SOURCES})
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
793 list(APPEND ARX_LIBRARIES ${OPENAL_LIBRARY})
b1323e6 @dscharrer Mark include paths of external projects as SYSTEM to disable warnings.
dscharrer authored
794 include_directories(SYSTEM ${OPENAL_INCLUDE_DIR})
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
795 set(ARX_HAVE_OPENAL 1)
b43b234 @dscharrer Make the OpenAL effect extension optional so we can build against old…
dscharrer authored
796 if(OPENALEFX_FOUND)
b1323e6 @dscharrer Mark include paths of external projects as SYSTEM to disable warnings.
dscharrer authored
797 include_directories(SYSTEM ${OPENAL_EFX_INCLUDE_DIR})
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
798 set(ARX_HAVE_OPENAL_EFX 1)
b43b234 @dscharrer Make the OpenAL effect extension optional so we can build against old…
dscharrer authored
799 endif()
41d57f0 @dscharrer Make building the OpenAL and DirectSound backends optional.
dscharrer authored
800 endif()
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
801 if(USE_DSOUND)
7c025c3 @dscharrer Relax backend selection in CMake: don't fail if a backend that was en…
dscharrer authored
802 # TODO does this need DIRECTX_FOUND? if so, the find_package(DirectX) should also be run if USE_DSOUND is set but USE_D3D9 isn't
6c9db46 @dscharrer Move windowing code into a separate subdirectory.
dscharrer authored
803 list(APPEND AUDIO_SOURCES ${AUDIO_DSOUND_SOURCES})
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
804 set(ARX_HAVE_DSOUND 1)
41d57f0 @dscharrer Make building the OpenAL and DirectSound backends optional.
dscharrer authored
805 endif()
f748b9d @dscharrer Fix unity build.
dscharrer authored
806
7c025c3 @dscharrer Relax backend selection in CMake: don't fail if a backend that was en…
dscharrer authored
807 if(USE_D3D9 AND DIRECTX_FOUND)
365d73b @SebastienLussier First working implementation of Arx using DirectX 9 (D3D9 & DInput8)
SebastienLussier authored
808 list(APPEND GRAPHICS_SOURCES ${GRAPHICS_D3D9_SOURCES})
809 list(APPEND WINDOW_SOURCES ${WINDOW_WIN32_SOURCES} ${WINDOW_D3D9_SOURCES})
810
4864792 @SebastienLussier Cleaned DirectX libraries inclusion in CMake
SebastienLussier authored
811 list(APPEND ARX_LIBRARIES ${DIRECTX_D3D9_LIBRARY} ${DIRECTX_D3DX9_LIBRARY} ${DIRECTX_D3DCOMPILER_LIBRARY} ${DIRECTX_DXERR9_LIBRARY})
365d73b @SebastienLussier First working implementation of Arx using DirectX 9 (D3D9 & DInput8)
SebastienLussier authored
812 include_directories(SYSTEM ${DIRECTX_INCLUDE_DIR})
813
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
814 set(ARX_HAVE_D3D9 1)
365d73b @SebastienLussier First working implementation of Arx using DirectX 9 (D3D9 & DInput8)
SebastienLussier authored
815 endif()
816
aa36bda @dscharrer Revert "CMakeLists.txt: Don't use find_package(OpenGL)"
dscharrer authored
817 if(USE_OPENGL AND OPENGL_FOUND AND GLEW_FOUND)
6c9db46 @dscharrer Move windowing code into a separate subdirectory.
dscharrer authored
818 list(APPEND GRAPHICS_SOURCES ${GRAPHICS_OPENGL_SOURCES})
aa36bda @dscharrer Revert "CMakeLists.txt: Don't use find_package(OpenGL)"
dscharrer authored
819 list(APPEND ARX_LIBRARIES ${OPENGL_gl_LIBRARY} ${GLEW_LIBRARIES})
820 include_directories(SYSTEM ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIR})
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
821 set(ARX_HAVE_OPENGL 1)
aa36bda @dscharrer Revert "CMakeLists.txt: Don't use find_package(OpenGL)"
dscharrer authored
822 add_definitions(-DGL_GLEXT_PROTOTYPES)
ec98148 @dscharrer Add stub SDL Window and InputBackend and OpenGL Renderer implementati…
dscharrer authored
823 endif()
824
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
825 if(USE_SDL AND ARX_HAVE_OPENGL AND SDL_FOUND)
6c9db46 @dscharrer Move windowing code into a separate subdirectory.
dscharrer authored
826 list(APPEND WINDOW_SOURCES ${WINDOW_SDL_SOURCES})
827 list(APPEND INPUT_SOURCES ${INPUT_SDL_SOURCES})
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
828 list(APPEND ARX_LIBRARIES ${SDL_LIBRARY})
ec98148 @dscharrer Add stub SDL Window and InputBackend and OpenGL Renderer implementati…
dscharrer authored
829 include_directories(SYSTEM ${SDL_INCLUDE_DIR})
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
830 set(ARX_HAVE_SDL 1)
c105d07 @dscharrer Make building the OpenGLRenderer optional, disabled by default.
dscharrer authored
831 endif()
9c3e84d @lubosz stubby cmake build
lubosz authored
832
7c025c3 @dscharrer Relax backend selection in CMake: don't fail if a backend that was en…
dscharrer authored
833 if(USE_DINPUT8 AND DIRECTX_FOUND)
365d73b @SebastienLussier First working implementation of Arx using DirectX 9 (D3D9 & DInput8)
SebastienLussier authored
834 list(APPEND INPUT_SOURCES ${INPUT_DINPUT8_SOURCES})
4864792 @SebastienLussier Cleaned DirectX libraries inclusion in CMake
SebastienLussier authored
835 list(APPEND ARX_LIBRARIES ${DIRECTX_DINPUT8_LIBRARY} ${DIRECTX_DXGUID_LIBRARY} ${DIRECTX_DXERR9_LIBRARY})
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
836 set(ARX_HAVE_DINPUT8 1)
365d73b @SebastienLussier First working implementation of Arx using DirectX 9 (D3D9 & DInput8)
SebastienLussier authored
837 endif()
838
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
839 if(ARX_HAVE_ISATTY)
9c928c0 @dscharrer Support log backends, add a file log backend.
dscharrer authored
840 list(APPEND IO_LOGGER_SOURCES ${IO_LOGGER_POSIX_SOURCES})
841 endif()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
842 if(ARX_HAVE_WINAPI)
69c6305 @dscharrer Fix mingw32 build.
dscharrer authored
843 list(APPEND IO_LOGGER_SOURCES ${IO_LOGGER_WINDOWS_SOURCES})
9c928c0 @dscharrer Support log backends, add a file log backend.
dscharrer authored
844 endif()
6ff6a73 @dscharrer Never display error doalogs for console-only applications (arxunpak, …
dscharrer authored
845 list(APPEND IO_SOURCES ${IO_LOGGER_SOURCES} ${IO_LOGGER_EXTRA_SOURCES})
9c928c0 @dscharrer Support log backends, add a file log backend.
dscharrer authored
846
b69d7b3 @dscharrer Rename fs::path to res::path.
dscharrer authored
847 list(APPEND IO_SOURCES ${IO_RESOURCE_SOURCES})
848
b4a3ae2 @dscharrer CMakeLists.txt: Don't rely on the optimizer to remove unused referenc…
dscharrer authored
849 set(BASE_LIBRARIES)
850
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
851 if(ARX_HAVE_POSIX_FILESYSTEM)
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
852 list(APPEND IO_FILESYSTEM_SOURCES ${IO_FILESYSTEM_POSIX_SOURCES})
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
853 elseif(USE_NATIVE_FS AND ARX_HAVE_WINAPI)
854 add_definitions(-DARX_HAVE_WINDOWS_FILESYSTEM)
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
855 list(APPEND IO_FILESYSTEM_SOURCES ${IO_FILESYSTEM_WINDOWS_SOURCES})
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
856 set(ARX_HAVE_WIN32_FILESYSTEM 1)
f748b9d @dscharrer Fix unity build.
dscharrer authored
857 elseif((Boost_MAJOR_VERSION GREATER 1) OR (NOT Boost_MINOR_VERSION LESS 44))
4db4d9c @dscharrer Detect user/data directory locations.
dscharrer authored
858 find_package(Boost 1.44 REQUIRED COMPONENTS ${BOOST_COMPONENTS} filesystem system)
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
859 set(ARX_HAVE_BOOST_FILESYSTEM_V3 1)
f748b9d @dscharrer Fix unity build.
dscharrer authored
860 add_definitions(-DBOOST_FILESYSTEM_VERSION=3)
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
861 list(APPEND IO_FILESYSTEM_SOURCES ${IO_FILESYSTEM_BOOST_SOURCES})
b4a3ae2 @dscharrer CMakeLists.txt: Don't rely on the optimizer to remove unused referenc…
dscharrer authored
862 list(APPEND BASE_LIBRARIES ${Boost_LIBRARIES})
f748b9d @dscharrer Fix unity build.
dscharrer authored
863 else()
240e2f5 @dscharrer Add missing check for fstatat in FilesystemPOSIX.
dscharrer authored
864 message(FATAL_ERROR "You need either Boost >= 1.44 or Windows API or enough POSIX functionality; Found boost version ${Boost_VERSION}")
f748b9d @dscharrer Fix unity build.
dscharrer authored
865 endif()
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
866 list(APPEND IO_SOURCES ${IO_FILESYSTEM_SOURCES})
f748b9d @dscharrer Fix unity build.
dscharrer authored
867
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
868 if(ARX_HAVE_CRASHREPORTER)
869 if((ARX_HAVE_EXECLP OR ARX_HAVE_EXECL) AND ARX_HAVE_FORK AND ARX_HAVE_KILL)
a7d91ef @dscharrer Merge branch 'master' into bsd
dscharrer authored
870 list(APPEND PLATFORM_CRASHHANDLER_SOURCES ${PLATFORM_CRASHHANDLER_IMPL_SOURCES})
090a859 @dscharrer CMake: Don't link the CrashHandler in the crash reporter to avoid pul…
dscharrer authored
871 list(APPEND PLATFORM_CRASHHANDLER_SOURCES ${PLATFORM_CRASHHANDLER_POSIX_SOURCES})
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
872 set(ARX_HAVE_CRASHHANDLER_POSIX 1)
e680456 @SebastienLussier Do not use posix/windows crash handler files if(HAVE_CRASHREPORTER) i…
SebastienLussier authored
873 elseif(MSVC)
a7d91ef @dscharrer Merge branch 'master' into bsd
dscharrer authored
874 list(APPEND PLATFORM_CRASHHANDLER_SOURCES ${PLATFORM_CRASHHANDLER_IMPL_SOURCES})
090a859 @dscharrer CMake: Don't link the CrashHandler in the crash reporter to avoid pul…
dscharrer authored
875 list(APPEND PLATFORM_CRASHHANDLER_SOURCES ${PLATFORM_CRASHHANDLER_WINDOWS_SOURCES})
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
876 set(ARX_HAVE_CRASHHANDLER_WINDOWS 1)
e680456 @SebastienLussier Do not use posix/windows crash handler files if(HAVE_CRASHREPORTER) i…
SebastienLussier authored
877 list(APPEND ARX_LIBRARIES ${DBGHELP_LIBRARIES})
878 include_directories(SYSTEM ${DBGHELP_INCLUDE_DIR})
879 else()
880 # Don't bother building arxcrashreporter if it will never be used.
bc10be2 @dscharrer CMakeLists.txt: Don't include ${QT_USE_FILE}
dscharrer authored
881 set(ARX_HAVE_CRASHREPORTER 0)
e680456 @SebastienLussier Do not use posix/windows crash handler files if(HAVE_CRASHREPORTER) i…
SebastienLussier authored
882 endif()
559b93f @dscharrer <WIP>
dscharrer authored
883 endif()
5251ef2 @SebastienLussier More cleanup - Isolated Windows specific crash handling stuff and rem…
SebastienLussier authored
884
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
885 if(LIBRT_LIBRARY AND (ARX_HAVE_CLOCK_GETTIME OR ARX_HAVE_CRASHHANDLER_POSIX))
a27a7da @dscharrer Link the crash reporter against the rt library if available as it is …
dscharrer authored
886 # Needed for clock_gettime and boost::interprocess on some system.
b4a3ae2 @dscharrer CMakeLists.txt: Don't rely on the optimizer to remove unused referenc…
dscharrer authored
887 list(APPEND BASE_LIBRARIES ${LIBRT_LIBRARY})
a27a7da @dscharrer Link the crash reporter against the rt library if available as it is …
dscharrer authored
888 endif()
889
b4a3ae2 @dscharrer CMakeLists.txt: Don't rely on the optimizer to remove unused referenc…
dscharrer authored
890 list(APPEND ARX_LIBRARIES ${BASE_LIBRARIES})
891
f748b9d @dscharrer Fix unity build.
dscharrer authored
892 if(NOT MSVC)
893 check_link_library(Boost Boost_LIBRARIES)
894 endif()
895
5f0a21b @dscharrer Don't link Thread.cpp and arxcrashreporter, arxsavetool and arxunpak.
dscharrer authored
896 set(ARX_SOURCES
897 ${AI_SOURCES}
898 ${ANIMATION_SOURCES}
899 ${AUDIO_SOURCES}
900 ${CORE_SOURCES}
901 ${GAME_SOURCES}
902 ${GRAPHICS_SOURCES}
903 ${GUI_SOURCES}
904 ${INPUT_SOURCES}
905 ${IO_SOURCES}
906 ${MATH_SOURCES}
907 ${PHYSICS_SOURCES}
908 ${PLATFORM_SOURCES}
909 ${PLATFORM_EXTRA_SOURCES}
910 ${PLATFORM_CRASHHANDLER_SOURCES}
911 ${SCENE_SOURCES}
912 ${SCRIPT_SOURCES}
913 ${WINDOW_SOURCES}
914 )
f748b9d @dscharrer Fix unity build.
dscharrer authored
915
c3d008e @SebastienLussier Add an icon to the arx exe for Windows
SebastienLussier authored
916 # Set the icon for the Windows executable by adding this resource file to the sources
917 if(MSVC)
918 SET(ARX_SOURCES ${ARX_SOURCES} data/icons/arx-libertatis.rc)
41d57f0 @dscharrer Make building the OpenAL and DirectSound backends optional.
dscharrer authored
919 endif()
c3d008e @SebastienLussier Add an icon to the arx exe for Windows
SebastienLussier authored
920
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
921 if(BUILD_EDITOR)
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
922 list(APPEND ARX_SOURCES ${EDITOR_SOURCES})
05cc8a6 @dscharrer Make building .scn file support optional. (raw unprocessed scenes, no…
dscharrer authored
923 endif()
9c3e84d @lubosz stubby cmake build
lubosz authored
924
cc565fb @dscharrer Fix compile errors when using older boost versions (tested 1.37 and 1…
dscharrer authored
925 add_definitions(-DBOOST_FILESYSTEM_NO_DEPRECATED)
926
5c2d73a @SebastienLussier Fixed VC2010 warnings/errors/projects
SebastienLussier authored
927 #create source groups
b7b0735 @SebastienLussier [CMake] Changed create_source_groups() to create a hierarchy that rep…
SebastienLussier authored
928 list(APPEND ALL_FILES_FOR_GROUPS ${ALL_INCLUDES} ${ARX_SOURCES})
929 create_source_groups(ALL_FILES_FOR_GROUPS)
5c2d73a @SebastienLussier Fixed VC2010 warnings/errors/projects
SebastienLussier authored
930
72f4f01 @dscharrer Rename .{h,cpp}.cmake files to .{h,cpp}.in
dscharrer authored
931 configure_file("${SRC_DIR}/Configure.h.in" "Configure.h" ESCAPE_QUOTES)
932
b35342e @dscharrer Move path constants to their own header
dscharrer authored
933 configure_file("${SRC_DIR}/io/fs/PathConstants.h.in" "io/fs/PathConstants.h"
934 ESCAPE_QUOTES)
935
1c48ab0 @dscharrer Fix style warning: include header by path
dscharrer authored
936 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/platform")
72f4f01 @dscharrer Rename .{h,cpp}.cmake files to .{h,cpp}.in
dscharrer authored
937 set(PLATFORM_CONFIG_H "platform/PlatformConfig.h")
938 configure_file("${SRC_DIR}/${PLATFORM_CONFIG_H}.in" "${PLATFORM_CONFIG_H}" ESCAPE_QUOTES)
7fa9f82 @dscharrer Write configure options to a header instead of passing them on the co…
dscharrer authored
939
72f4f01 @dscharrer Rename .{h,cpp}.cmake files to .{h,cpp}.in
dscharrer authored
940 set(VERSION_FILE "${CMAKE_BINARY_DIR}/core/Version.cpp")
941 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/core")
942 version_file("${SRC_DIR}/core/Version.cpp.in" "${VERSION_FILE}" "VERSION" ".git")
d532aa5 @dscharrer Include Version.cpp in the crash reporter sources as it is used by Cr…
dscharrer authored
943 list(APPEND ARX_SOURCES "${VERSION_FILE}")
9c3e84d @lubosz stubby cmake build
lubosz authored
944
4cd5bf1 @dscharrer CMake: Move helper functions and macros out of the main CMakeLists.txt
dscharrer authored
945
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
946 # Add executables
947
68d5ffc @dscharrer CMake: Support a separate install directory for games binaries.
dscharrer authored
948 if(WIN32 OR APPLE)
029287d @dscharrer Fix Win32 build.
dscharrer authored
949 set(arx_INSTALL DESTINATION "bin")
68d5ffc @dscharrer CMake: Support a separate install directory for games binaries.
dscharrer authored
950 else()
951 set(arx_INSTALL DESTINATION "${GAMESBINDIR}")
952 endif()
953
954 add_executable_shared(arx WIN32 "${ARX_SOURCES}" "${ARX_LIBRARIES}"
955 "${ALL_INCLUDES}" "${arx_INSTALL}")
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
956
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
957 if(ARX_HAVE_CRASHREPORTER)
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
958
bc10be2 @dscharrer CMakeLists.txt: Don't include ${QT_USE_FILE}
dscharrer authored
959 add_definitions(${QT_DEFINITIONS} -DQT_NO_DEBUG)
960
961 include_directories(SYSTEM
962 "${QT_INCLUDE_DIR}"
963 "${QT_QTCORE_INCLUDE_DIR}"
964 "${QT_QTGUI_INCLUDE_DIR}"
965 "${QT_QTNETWORK_INCLUDE_DIR}"
966 )
967
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
968 set(arxcrashreporter_SOURCES
090a859 @dscharrer CMake: Don't link the CrashHandler in the crash reporter to avoid pul…
dscharrer authored
969 ${PLATFORM_SOURCES}
970 ${IO_FILESYSTEM_SOURCES}
971 ${IO_LOGGER_SOURCES}
689cbf5 @dscharrer crash reporter: Rename source files to match the rest of arx.
dscharrer authored
972 tools/crashreporter/CrashReporter.cpp
973 tools/crashreporter/ErrorReport.h
974 tools/crashreporter/ErrorReport.cpp
975 tools/crashreporter/qhexedit/Commands.h
976 tools/crashreporter/qhexedit/Commands.cpp
977 tools/crashreporter/qhexedit/QHexEdit.h
978 tools/crashreporter/qhexedit/QHexEdit.cpp
979 tools/crashreporter/qhexedit/QHexEditPrivate.h
980 tools/crashreporter/qhexedit/QHexEditPrivate.cpp
981 tools/crashreporter/qhexedit/XByteArray.h
982 tools/crashreporter/qhexedit/XByteArray.cpp
983 tools/crashreporter/tbg/TBG.h
984 tools/crashreporter/tbg/TBG.cpp
985 tools/crashreporter/ui/ErrorReportDialog.h
986 tools/crashreporter/ui/ErrorReportDialog.cpp
d532aa5 @dscharrer Include Version.cpp in the crash reporter sources as it is used by Cr…
dscharrer authored
987 "${VERSION_FILE}"
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
988 )
989
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
990 if(ARX_HAVE_WINAPI)
689cbf5 @dscharrer crash reporter: Rename source files to match the rest of arx.
dscharrer authored
991 list(APPEND arxcrashreporter_SOURCES
992 tools/crashreporter/Win32Utilities.h
993 tools/crashreporter/Win32Utilities.cpp
994 )
995 endif()
996
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
997 set(arxcrashreporter_UIs
689cbf5 @dscharrer crash reporter: Rename source files to match the rest of arx.
dscharrer authored
998 tools/crashreporter/ui/ErrorReportDialog.ui
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
999 )
1000
1001 set(arxcrashreporter_MOC_HEADERS
689cbf5 @dscharrer crash reporter: Rename source files to match the rest of arx.
dscharrer authored
1002 tools/crashreporter/ui/ErrorReportDialog.h
1003 tools/crashreporter/qhexedit/QHexEdit.h
1004 tools/crashreporter/qhexedit/QHexEditPrivate.h
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1005 )
1006
1007 set(arxcrashreporter_RESOURCES
689cbf5 @dscharrer crash reporter: Rename source files to match the rest of arx.
dscharrer authored
1008 tools/crashreporter/resources/CrashReporter.qrc
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1009 )
1010
0baa898 @dscharrer Don't run style checks for autogenerated sources (moc, ui, qrc).
dscharrer authored
1011 set(arxcrashreporter_MANUAL_SOURCES "${arxcrashreporter_SOURCES}")
1012
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1013 qt4_wrap_ui(arxcrashreporter_SOURCES ${arxcrashreporter_UIs})
1014 qt4_wrap_cpp(arxcrashreporter_SOURCES ${arxcrashreporter_MOC_HEADERS})
1015 qt4_add_resources(arxcrashreporter_SOURCES ${arxcrashreporter_RESOURCES})
1016
1017 set(SRC_DIR tools/crashreporter/)
1018
1019 create_source_groups(arxcrashreporter_SOURCES)
1020
1021 set(arxcrashreporter_LIBRARIES
b4a3ae2 @dscharrer CMakeLists.txt: Don't rely on the optimizer to remove unused referenc…
dscharrer authored
1022 ${BASE_LIBRARIES}
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1023 ${QT_QTCORE_LIBRARY_RELEASE}
1024 ${QT_QTGUI_LIBRARY_RELEASE}
4d7cf61 @SebastienLussier Crash reporter now creates issues on the bug tracker
SebastienLussier authored
1025 ${QT_QTNETWORK_LIBRARY_RELEASE}
2017d71 @dscharrer CMake: Make sure the crash reporter is linked agains the required thr…
dscharrer authored
1026 ${CMAKE_THREAD_LIBS_INIT}
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1027 )
b4a3ae2 @dscharrer CMakeLists.txt: Don't rely on the optimizer to remove unused referenc…
dscharrer authored
1028
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1029 if(MSVC)
1030 list(APPEND arxcrashreporter_LIBRARIES winmm psapi imm32)
579fb39 @SebastienLussier Improved the Windows crash reporter to include the callstack + added …
SebastienLussier authored
1031 list(APPEND arxcrashreporter_LIBRARIES ${DBGHELP_LIBRARIES})
1032 include_directories(SYSTEM ${DBGHELP_INCLUDE_DIR})
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1033 endif()
1034
e335184 @dscharrer Install arxcrashreporter in libexec instead of bin as it's not meant …
dscharrer authored
1035 if(WIN32 OR APPLE)
029287d @dscharrer Fix Win32 build.
dscharrer authored
1036 set(arxcrashreporter_INSTALL DESTINATION "bin")
e335184 @dscharrer Install arxcrashreporter in libexec instead of bin as it's not meant …
dscharrer authored
1037 else()
1038 set(arxcrashreporter_INSTALL DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}")
1039 endif()
1040
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1041 add_executable_shared(arxcrashreporter WIN32 "${arxcrashreporter_SOURCES}"
e335184 @dscharrer Install arxcrashreporter in libexec instead of bin as it's not meant …
dscharrer authored
1042 "${arxcrashreporter_LIBRARIES}" "" "${arxcrashreporter_INSTALL}")
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1043
1044 endif()
e71dc88 @SebastienLussier Arx crash reporter (WIP)
SebastienLussier authored
1045
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1046 if(BUILD_TOOLS)
1047
1048 set(arxsavetool_SOURCES
090a859 @dscharrer CMake: Don't link the CrashHandler in the crash reporter to avoid pul…
dscharrer authored
1049 ${PLATFORM_SOURCES}
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1050 ${IO_FILESYSTEM_SOURCES}
9c928c0 @dscharrer Support log backends, add a file log backend.
dscharrer authored
1051 ${IO_LOGGER_SOURCES}
b69d7b3 @dscharrer Rename fs::path to res::path.
dscharrer authored
1052 ${IO_RESOURCE_SOURCES}
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1053 src/core/Localisation.cpp
1054 src/io/SaveBlock.cpp
1055 src/io/IniReader.cpp
1056 src/io/IniSection.cpp
1057 tools/savetool/SaveFix.cpp
41671ad @dscharrer Rename savetool and unpak source files to match the rest of arx.
dscharrer authored
1058 tools/savetool/SaveTool.cpp
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1059 tools/savetool/SaveView.cpp
1060 )
1061
b4a3ae2 @dscharrer CMakeLists.txt: Don't rely on the optimizer to remove unused referenc…
dscharrer authored
1062 set(arxsavetool_LIBRARIES ${BASE_LIBRARIES} ${ZLIB_LIBRARIES})
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1063
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1064 add_executable_shared(arxsavetool "" "${arxsavetool_SOURCES}" "${arxsavetool_LIBRARIES}" "")
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1065
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1066 set(arxunpak_SOURCES
090a859 @dscharrer CMake: Don't link the CrashHandler in the crash reporter to avoid pul…
dscharrer authored
1067 ${PLATFORM_SOURCES}
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1068 ${IO_FILESYSTEM_SOURCES}
9c928c0 @dscharrer Support log backends, add a file log backend.
dscharrer authored
1069 ${IO_LOGGER_SOURCES}
b69d7b3 @dscharrer Rename fs::path to res::path.
dscharrer authored
1070 ${IO_RESOURCE_SOURCES}
41671ad @dscharrer Rename savetool and unpak source files to match the rest of arx.
dscharrer authored
1071 tools/unpak/UnPak.cpp
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1072 )
1073
b4a3ae2 @dscharrer CMakeLists.txt: Don't rely on the optimizer to remove unused referenc…
dscharrer authored
1074 set(arxunpak_LIBRARIES ${BASE_LIBRARIES})
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1075
1076 add_executable_shared(arxunpak "" "${arxunpak_SOURCES}" "${arxunpak_LIBRARIES}" "")
e71dc88 @SebastienLussier Arx crash reporter (WIP)
SebastienLussier authored
1077
c105d07 @dscharrer Make building the OpenGLRenderer optional, disabled by default.
dscharrer authored
1078 endif()
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1079
4cd5bf1 @dscharrer CMake: Move helper functions and macros out of the main CMakeLists.txt
dscharrer authored
1080
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1081 # Build and link executables
1082
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
1083 if(UNITY_BUILD)
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1084 unity_build()
1085 else()
1086 shared_build()
ec98148 @dscharrer Add stub SDL Window and InputBackend and OpenGL Renderer implementati…
dscharrer authored
1087 endif()
7c677ae @lubosz added remake flag
lubosz authored
1088
f67374f @dscharrer Merge tools build into the main CMakeLists.txt and automatically extr…
dscharrer authored
1089
1090 # Custom make targets
1091
7c677ae @lubosz added remake flag
lubosz authored
1092 add_custom_target(remake
7a4b058 @lubosz fixed formatting and include folder
lubosz authored
1093 #clean and compile with 1 thread per core
1094 COMMAND make clean && rm CMakeCache.txt && cmake ${CMAKE_SOURCE_DIR} -G\"Unix Makefiles\" && make -j`getconf _NPROCESSORS_ONLN`
7c677ae @lubosz added remake flag
lubosz authored
1095 )
335f4bf @dscharrer Add tool for PAK file decompression.
dscharrer authored
1096
734fab0 @dscharrer Use find_package in CMakeLists.txt instead of hardcoding library name…
dscharrer authored
1097 if(DOXYGEN_EXECUTABLE)
d7406f7 @dscharrer Add man pages for arx, arxsavetool and arxupak and cleanup `make doc`.
dscharrer authored
1098 set(DOXYGEN_OUTPUT_DIR "${CMAKE_BINARY_DIR}/doc")
1099 configure_file("scripts/Doxyfile" "Doxyfile" ESCAPE_QUOTES)
734fab0 @dscharrer Use find_package in CMakeLists.txt instead of hardcoding library name…
dscharrer authored
1100 add_custom_target(doc
1101 #build the documentation
d7406f7 @dscharrer Add man pages for arx, arxsavetool and arxupak and cleanup `make doc`.
dscharrer authored
1102 COMMAND "${CMAKE_COMMAND}" -E make_directory "${DOXYGEN_OUTPUT_DIR}"
1103 COMMAND "${CMAKE_COMMAND}" -E chdir ${CMAKE_SOURCE_DIR}
1104 ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile"
1105 COMMENT "Building doxygen documentation."
1106 VERBATIM
734fab0 @dscharrer Use find_package in CMakeLists.txt instead of hardcoding library name…
dscharrer authored
1107 )
1108 endif()
766a3e9 @lubosz added doxyfile and doc build to cmake. see readme.
lubosz authored
1109
4cd5bf1 @dscharrer CMake: Move helper functions and macros out of the main CMakeLists.txt
dscharrer authored
1110 file(GLOB_RECURSE TOOLS_INCLUDES ${CMAKE_SOURCE_DIR}/tools/*.h)
0baa898 @dscharrer Don't run style checks for autogenerated sources (moc, ui, qrc).
dscharrer authored
1111 set(STYLE_CHECKED_SOURCES
4cd5bf1 @dscharrer CMake: Move helper functions and macros out of the main CMakeLists.txt
dscharrer authored
1112 ${ARX_SOURCES}
1113 ${arxsavetool_SOURCES}
1114 ${arxunpak_SOURCES}
0baa898 @dscharrer Don't run style checks for autogenerated sources (moc, ui, qrc).
dscharrer authored
1115 ${arxcrashreporter_MANUAL_SOURCES}
4cd5bf1 @dscharrer CMake: Move helper functions and macros out of the main CMakeLists.txt
dscharrer authored
1116 )
0baa898 @dscharrer Don't run style checks for autogenerated sources (moc, ui, qrc).
dscharrer authored
1117 set(STYLE_CHECKED_INCLUDES
4cd5bf1 @dscharrer CMake: Move helper functions and macros out of the main CMakeLists.txt
dscharrer authored
1118 ${ALL_INCLUDES}
1119 ${TOOLS_INCLUDES}
1120 )
1121
0baa898 @dscharrer Don't run style checks for autogenerated sources (moc, ui, qrc).
dscharrer authored
1122 add_style_check_target(style "${STYLE_CHECKED_SOURCES}" "${STYLE_CHECKED_INCLUDES}")
e9bb76b @lubosz style check and make target
lubosz authored
1123
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
1124 if(BUILD_TESTS)
3e661ac @lubosz options for not buildings tests and tools
lubosz authored
1125 add_subdirectory(tests ${CMAKE_SOURCE_DIR}/bin/tests)
1126 endif()
813c161 @dscharrer Provide a configuration summary at the end of the CMake run.
dscharrer authored
1127
4cd5bf1 @dscharrer CMake: Move helper functions and macros out of the main CMakeLists.txt
dscharrer authored
1128
b1f3d7f @dscharrer CMake: Install the icon and a .desktop file under linux.
dscharrer authored
1129 # Install icon and desktop entry
1130 if(NOT WIN32 AND NOT APPLE)
1131
4525b38 @dscharrer CMake: Validate the desktop file using desktop-file-validate if avail…
dscharrer authored
1132 find_program(DESKTOP_FILE_VALIDATE desktop-file-validate)
1133
1134 if(DESKTOP_FILE_VALIDATE)
1135 get_filename_component(ABS_DESKTOP_FILE data/icons/arx-libertatis.desktop ABSOLUTE)
1136 add_custom_target(
1137 validate_desktop_file ALL
1138 "${DESKTOP_FILE_VALIDATE}" "${ABS_DESKTOP_FILE}" VERBATIM
1139 DEPENDS "${ABS_DESKTOP_FILE}"
1140 )
1141 endif()
1142
d7406f7 @dscharrer Add man pages for arx, arxsavetool and arxupak and cleanup `make doc`.
dscharrer authored
1143 install(FILES data/icons/arx-libertatis.png DESTINATION "${ICONDIR}" OPTIONAL)
1144 install(FILES data/icons/arx-libertatis.desktop DESTINATION "${APPDIR}" OPTIONAL)
b1f3d7f @dscharrer CMake: Install the icon and a .desktop file under linux.
dscharrer authored
1145
1146 endif()
1147
d7406f7 @dscharrer Add man pages for arx, arxsavetool and arxupak and cleanup `make doc`.
dscharrer authored
1148 # Install man pages
1149 if(NOT WIN32)
1150 install(FILES data/man/arx.6 DESTINATION "${CMAKE_INSTALL_MANDIR}/man6" OPTIONAL)
1151 if(BUILD_TOOLS)
1152 install(FILES data/man/arxsavetool.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" OPTIONAL)
1153 install(FILES data/man/arxunpak.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" OPTIONAL)
1154 endif()
1155 endif()
1156
b1f3d7f @dscharrer CMake: Install the icon and a .desktop file under linux.
dscharrer authored
1157
4cd5bf1 @dscharrer CMake: Move helper functions and macros out of the main CMakeLists.txt
dscharrer authored
1158 # Print a configuration summary
813c161 @dscharrer Provide a configuration summary at the end of the CMake run.
dscharrer authored
1159
1160 message("")
1161 message("Configuration:")
ddeecb9 @dscharrer Don't print the build type in the configuration summary for MSVC.
dscharrer authored
1162 if(NOT MSVC)
1163 if(UNITY_BUILD)
1164 set(BUILD_TYPE_SUFFIX " (unity build)")
1165 else()
1166 set(BUILD_TYPE_SUFFIX "")
1167 endif()
1168 if(CMAKE_BUILD_TYPE STREQUAL "")
1169 message(" - Build type: Release${BUILD_TYPE_SUFFIX}")
1170 else()
1171 message(" - Build type: ${CMAKE_BUILD_TYPE}${BUILD_TYPE_SUFFIX}")
1172 endif()
1173 endif(NOT MSVC)
813c161 @dscharrer Provide a configuration summary at the end of the CMake run.
dscharrer authored
1174 print_configuration("Filesystem backend" FIRST
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1175 ARX_HAVE_POSIX_FILESYSTEM "POSIX"
1176 ARX_HAVE_WIN32_FILESYSTEM "Win32"
64f9ddc @dscharrer Minor text alignment fix
dscharrer authored
1177 1 "Boost"
813c161 @dscharrer Provide a configuration summary at the end of the CMake run.
dscharrer authored
1178 )
1179 print_configuration("Renderer"
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1180 ARX_HAVE_OPENGL "OpenGL"
1181 ARX_HAVE_D3D9 "Direct3D 9"
813c161 @dscharrer Provide a configuration summary at the end of the CMake run.
dscharrer authored
1182 )
1183 print_configuration("Audio backend"
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1184 ARX_HAVE_OPENAL "OpenAL"
1185 ARX_HAVE_DSOUND "Direct Sound"
813c161 @dscharrer Provide a configuration summary at the end of the CMake run.
dscharrer authored
1186 )
1187 print_configuration("Input backend"
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1188 ARX_HAVE_SDL "SDL"
1189 ARX_HAVE_DINPUT8 "DirectInput 8"
813c161 @dscharrer Provide a configuration summary at the end of the CMake run.
dscharrer authored
1190 )
1191 print_configuration("Windowing"
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1192 ARX_HAVE_SDL "SDL"
1193 ARX_HAVE_D3D9 "Win32"
813c161 @dscharrer Provide a configuration summary at the end of the CMake run.
dscharrer authored
1194 )
8aa51cd @dscharrer Merge branch 'master' into slussier_misc and get it to compile under …
dscharrer authored
1195 print_configuration("Crash handler"
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1196 ARX_HAVE_CRASHHANDLER_POSIX "POSIX"
1197 ARX_HAVE_CRASHHANDLER_WINDOWS "Win32"
8aa51cd @dscharrer Merge branch 'master' into slussier_misc and get it to compile under …
dscharrer authored
1198 )
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1199 print_configuration("Crash reporter" FIRST
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1200 ARX_HAVE_CRASHREPORTER "enabled"
64f9ddc @dscharrer Minor text alignment fix
dscharrer authored
1201 1 "disabled"
9fdb80e @dscharrer CMake: Add an option to disable the crash reporter.
dscharrer authored
1202 )
1203 print_configuration("Tools" FIRST
1204 BUILD_TOOLS "enabled"
1205 1 "disabled"
1206 )
d43db2c @dscharrer Merge branch 'master' into slussier_misc
dscharrer authored
1207 message("")
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
1208
4cd5bf1 @dscharrer CMake: Move helper functions and macros out of the main CMakeLists.txt
dscharrer authored
1209
1210 # Detect configuration errors
1211
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1212 if(NOT (ARX_HAVE_PTHREADS OR ARX_HAVE_WINAPI))
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
1213 message(SEND_ERROR "No supported thread libraries found.")
1214 endif()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1215 if(NOT (ARX_HAVE_OPENGL OR ARX_HAVE_D3D9))
ea9d77a @dscharrer Only enable the OpenGL backend if GLEW was found, fail if either no r…
dscharrer authored
1216 message(SEND_ERROR "No renderer available - need either OpenGL and GLEW or Direct3D 9")
1217 endif()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1218 if(NOT (ARX_HAVE_OPENAL OR ARX_HAVE_DSOUND))
ea9d77a @dscharrer Only enable the OpenGL backend if GLEW was found, fail if either no r…
dscharrer authored
1219 message(WARNING "No audio backend enabled - need either OpenAL or Direct Sound")
1220 endif()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1221 if(NOT (ARX_HAVE_SDL OR ARX_HAVE_DINPUT8))
ea9d77a @dscharrer Only enable the OpenGL backend if GLEW was found, fail if either no r…
dscharrer authored
1222 message(SEND_ERROR "No input backend available - need either SDL or DirectInput 8")
1223 endif()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1224 if(NOT (ARX_HAVE_SDL OR ARX_HAVE_WINAPI))
ea9d77a @dscharrer Only enable the OpenGL backend if GLEW was found, fail if either no r…
dscharrer authored
1225 message(SEND_ERROR "No windowing backend available - need either SDL or Windows")
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
1226 endif()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1227 if(NOT (ARX_HAVE_NANOSLEEP OR ARX_HAVE_WINAPI))
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
1228 message(SEND_ERROR "Need either nanosleep or WIN32.")
1229 endif()
37d4851 @dscharrer Add ARX_ prefix to feature test macros (HAVE_*)
dscharrer authored
1230 if(NOT (ARX_HAVE_CLOCK_GETTIME OR ARX_HAVE_WINAPI OR ARX_HAVE_MACH_CLOCK))
52ac19b @dscharrer Remove the ARX_ prefix from configure options.
dscharrer authored
1231 message(SEND_ERROR "Need either clock_gettime or WIN32 or mach clock_get_time.")
1232 endif()
Something went wrong with that request. Please try again.