Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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