4944
by qcs
Manual merge of cmake-migration branch to trunk |
1 |
project (widelands) |
2 |
||
3 |
cmake_minimum_required (VERSION 2.6) |
|
4 |
||
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
5 |
# Used as versioning, if WL_VERSION_STANDARD is definded.
|
5087
by Jens Beyer (Qcumber-some)
CMake improvements and documentation |
6 |
if (WL_VERSION_STANDARD) |
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
7 |
# Set the values below for standard versioning.
|
8 |
# As long as WL_VERSION_MAJOR is 0, the naming will be in form of
|
|
9 |
# "Build${WL_VERSION_MINOR}" + ".${WL_VERSION_PATCH}" if WL_VERSION_PATCH is
|
|
10 |
# defined.
|
|
11 |
set (WL_VERSION_MAJOR 0) |
|
6342
by Tino
update of some hardcoded version references |
12 |
set (WL_VERSION_MINOR 17) |
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
13 |
|
14 |
# Just define in case that we release patches for official builds
|
|
15 |
#set (WL_VERSION_PATCH 90)
|
|
16 |
||
17 |
# An addition to the version name (e.g. RC1, DEV, ...)
|
|
18 |
set (WL_VERSION_ADDITION DEV) |
|
5087
by Jens Beyer (Qcumber-some)
CMake improvements and documentation |
19 |
endif (WL_VERSION_STANDARD) |
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
20 |
|
21 |
# Define the directory structure for installation - will be hardcoded in WL bin
|
|
5087
by Jens Beyer (Qcumber-some)
CMake improvements and documentation |
22 |
# If nothing is given on command line, set the standard values depending on platform.
|
23 |
||
24 |
if (WIN32 OR APPLE OR WL_PORTABLE) |
|
25 |
if (NOT WL_INSTALL_PREFIX OR WL_INSTALL_PREFIX STREQUAL "") |
|
26 |
set (WL_INSTALL_PREFIX ".") |
|
27 |
endif (NOT WL_INSTALL_PREFIX OR WL_INSTALL_PREFIX STREQUAL "") |
|
5855
by Nicolai Hähnle
Tino's changes to use GLEW, with some modifications |
28 |
|
5087
by Jens Beyer (Qcumber-some)
CMake improvements and documentation |
29 |
if (NOT WL_INSTALL_DATADIR OR WL_INSTALL_DATADIR STREQUAL "") |
30 |
set (WL_INSTALL_DATADIR ".") |
|
31 |
endif (NOT WL_INSTALL_DATADIR OR WL_INSTALL_DATADIR STREQUAL "") |
|
32 |
||
33 |
if (NOT WL_INSTALL_LOCALEDIR OR WL_INSTALL_LOCALEDIR STREQUAL "") |
|
34 |
set (WL_INSTALL_LOCALEDIR "locale") |
|
35 |
endif (NOT WL_INSTALL_LOCALEDIR OR WL_INSTALL_LOCALEDIR STREQUAL "") |
|
36 |
||
37 |
if (NOT WL_INSTALL_BINDIR OR WL_INSTALL_BINDIR STREQUAL "") |
|
38 |
set (WL_INSTALL_BINDIR ".") |
|
39 |
endif (NOT WL_INSTALL_BINDIR OR WL_INSTALL_BINDIR STREQUAL "") |
|
40 |
elseif (WIN32 OR APPLE OR WL_PORTABLE) |
|
41 |
if (NOT WL_INSTALL_PREFIX OR WL_INSTALL_PREFIX STREQUAL "") |
|
42 |
set (WL_INSTALL_PREFIX "/usr/local") |
|
43 |
endif (NOT WL_INSTALL_PREFIX OR WL_INSTALL_PREFIX STREQUAL "") |
|
5855
by Nicolai Hähnle
Tino's changes to use GLEW, with some modifications |
44 |
|
5087
by Jens Beyer (Qcumber-some)
CMake improvements and documentation |
45 |
if (NOT WL_INSTALL_DATADIR OR WL_INSTALL_DATADIR STREQUAL "") |
46 |
set (WL_INSTALL_DATADIR "share/games/widelands") |
|
47 |
endif (NOT WL_INSTALL_DATADIR OR WL_INSTALL_DATADIR STREQUAL "") |
|
48 |
||
49 |
if (NOT WL_INSTALL_LOCALEDIR OR WL_INSTALL_LOCALEDIR STREQUAL "") |
|
50 |
set (WL_INSTALL_LOCALEDIR "${WL_INSTALL_PREFIX}/${WL_INSTALL_DATADIR}/locale") |
|
51 |
endif (NOT WL_INSTALL_LOCALEDIR OR WL_INSTALL_LOCALEDIR STREQUAL "") |
|
52 |
||
53 |
if (NOT WL_INSTALL_BINDIR OR WL_INSTALL_BINDIR STREQUAL "") |
|
54 |
set (WL_INSTALL_BINDIR "games") |
|
55 |
endif (NOT WL_INSTALL_BINDIR OR WL_INSTALL_BINDIR STREQUAL "") |
|
56 |
endif (WIN32 OR APPLE OR WL_PORTABLE) |
|
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
57 |
|
4991
by Jens Beyer (Qcumber-some)
Separated CMAKE_INSTALL_PREFIX and WL_INSTALL_PREFIX |
58 |
# General install prefix for config.h
|
59 |
if (NOT WL_INSTALL_PREFIX OR WL_INSTALL_PREFIX STREQUAL "") |
|
5087
by Jens Beyer (Qcumber-some)
CMake improvements and documentation |
60 |
set (WL_INSTALL_PREFIX /usr/local) |
4991
by Jens Beyer (Qcumber-some)
Separated CMAKE_INSTALL_PREFIX and WL_INSTALL_PREFIX |
61 |
endif (NOT WL_INSTALL_PREFIX OR WL_INSTALL_PREFIX STREQUAL "") |
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
62 |
|
63 |
# Widelands binary directory
|
|
4991
by Jens Beyer (Qcumber-some)
Separated CMAKE_INSTALL_PREFIX and WL_INSTALL_PREFIX |
64 |
if (NOT WL_INSTALL_BINDIR OR WL_INSTALL_BINDIR STREQUAL "") |
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
65 |
set (WL_INSTALL_BINDIR games) |
4991
by Jens Beyer (Qcumber-some)
Separated CMAKE_INSTALL_PREFIX and WL_INSTALL_PREFIX |
66 |
endif (NOT WL_INSTALL_BINDIR OR WL_INSTALL_BINDIR STREQUAL "") |
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
67 |
|
68 |
# Widelands data directory
|
|
4991
by Jens Beyer (Qcumber-some)
Separated CMAKE_INSTALL_PREFIX and WL_INSTALL_PREFIX |
69 |
if (NOT WL_INSTALL_DATADIR OR WL_INSTALL_DATADIR STREQUAL "") |
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
70 |
set (WL_INSTALL_DATADIR share/games/widelands) |
4991
by Jens Beyer (Qcumber-some)
Separated CMAKE_INSTALL_PREFIX and WL_INSTALL_PREFIX |
71 |
endif (NOT WL_INSTALL_DATADIR OR WL_INSTALL_DATADIR STREQUAL "") |
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
72 |
|
73 |
# Widelands locale directory
|
|
4991
by Jens Beyer (Qcumber-some)
Separated CMAKE_INSTALL_PREFIX and WL_INSTALL_PREFIX |
74 |
if (NOT WL_INSTALL_LOCALEDIR OR WL_INSTALL_LOCALEDIR STREQUAL "") |
5087
by Jens Beyer (Qcumber-some)
CMake improvements and documentation |
75 |
set (WL_INSTALL_LOCALEDIR ${WL_INSTALL_PREFIX}/${WL_INSTALL_DATADIR}/locale) |
4991
by Jens Beyer (Qcumber-some)
Separated CMAKE_INSTALL_PREFIX and WL_INSTALL_PREFIX |
76 |
endif (NOT WL_INSTALL_LOCALEDIR OR WL_INSTALL_LOCALEDIR STREQUAL "") |
4970
by Jens Beyer (Qcumber-some)
CMake writes VERSION file |
77 |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
78 |
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) |
79 |
message(FATAL_ERROR "Build-directory and source-directory are the same!") |
|
80 |
endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) |
|
81 |
||
4989
by Jens Beyer (Qcumber-some)
Check install directory, should not be build directory |
82 |
if (CMAKE_INSTALL_PREFIX STREQUAL CMAKE_BINARY_DIR) |
83 |
message(FATAL_ERROR "Build-directory and install-directory are the same!") |
|
84 |
endif (CMAKE_INSTALL_PREFIX STREQUAL CMAKE_BINARY_DIR) |
|
85 |
||
4944
by qcs
Manual merge of cmake-migration branch to trunk |
86 |
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) |
87 |
||
5087
by Jens Beyer (Qcumber-some)
CMake improvements and documentation |
88 |
if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") |
89 |
find_path(FILE_WL_RELEASE "WL_RELEASE" ${CMAKE_CURRENT_SOURCE_DIR}) |
|
90 |
if (${FILE_WL_RELEASE} STREQUAL "FILE_WL_RELEASE-NOTFOUND") |
|
91 |
set (CMAKE_BUILD_TYPE Debug) |
|
92 |
else (${FILE_WL_RELEASE} STREQUAL "FILE_WL_RELEASE-NOTFOUND") |
|
93 |
set (CMAKE_BUILD_TYPE Release) |
|
94 |
endif (${FILE_WL_RELEASE} STREQUAL "FILE_WL_RELEASE-NOTFOUND") |
|
95 |
endif (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
96 |
|
4951
by beyerj
Repaired targets install, package |
97 |
set (CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE}) |
98 |
||
5149.1.39
by Jens Beyer (Qcumber-some)
automatic unit tests for Debug, option WL_UNIT_TESTS to override |
99 |
# Unit tests are built per default in Debug and not build in Release
|
100 |
if (CMAKE_BUILD_TYPE STREQUAL "Debug") |
|
101 |
option (WL_UNIT_TESTS "build and run unit tests (requires boost_unit_test_framework)" ON) |
|
102 |
else (CMAKE_BUILD_TYPE STREQUAL "Debug") |
|
103 |
option (WL_UNIT_TESTS "build and run unit tests (requires boost_unit_test_framework)" OFF) |
|
104 |
endif (CMAKE_BUILD_TYPE STREQUAL "Debug") |
|
105 |
||
5149.1.40
by Jens Beyer (Qcumber-some)
boost_unit_test_framework is only necessary when actually doing unit testing |
106 |
# we only include Boost Headers to the main executable, no libraries
|
107 |
# unit_test_framework is for testing only
|
|
5149.1.39
by Jens Beyer (Qcumber-some)
automatic unit tests for Debug, option WL_UNIT_TESTS to override |
108 |
if (WL_UNIT_TESTS) |
109 |
message(STATUS "Enabled unit tests") |
|
6346.3.1
by Jens Beyer (Qcumber-some)
Link widelands_all library against Boost Signals only |
110 |
if (DEFINED MSVC) |
111 |
set (BUILD_SHARED_LIBS OFF) |
|
6403
by Jari
Fixed cmake to find correct boost libraries for visual studio. |
112 |
set (Boost_USE_STATIC_RUNTIME ON) |
113 |
set (Boost_USE_STATIC_LIBS ON) |
|
6346.3.1
by Jens Beyer (Qcumber-some)
Link widelands_all library against Boost Signals only |
114 |
else (DEFINED MSVC) |
115 |
set (Boost_USE_STATIC_LIBS OFF) |
|
116 |
endif (DEFINED MSVC) |
|
6105.1.14
by Nicolai Hähnle
First use of boost::signals |
117 |
set (Boost_FIND_COMPONENTS unit_test_framework signals) |
5149.1.40
by Jens Beyer (Qcumber-some)
boost_unit_test_framework is only necessary when actually doing unit testing |
118 |
set (Boost_USE_MULTITHREADED ON) |
119 |
set (Boost_DETAILED_FAILURE_MSG ON) |
|
6105.1.14
by Nicolai Hähnle
First use of boost::signals |
120 |
find_package(Boost 1.35.0 COMPONENTS unit_test_framework signals REQUIRED) |
5149.1.40
by Jens Beyer (Qcumber-some)
boost_unit_test_framework is only necessary when actually doing unit testing |
121 |
|
122 |
if (NOT DEFINED MSVC) |
|
5804.1.9
by Jari
Fixed visual studio build to use static boost libs. |
123 |
# If boost unit test library is linked dynamically, BOOST_TEST_DYN_LINK must be defined
|
5149.1.40
by Jens Beyer (Qcumber-some)
boost_unit_test_framework is only necessary when actually doing unit testing |
124 |
string( REGEX MATCH ".a$" BOOST_STATIC_UNIT_TEST_LIB ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) |
125 |
if (NOT BOOST_STATIC_UNIT_TEST_LIB) |
|
126 |
add_definitions(-DBOOST_TEST_DYN_LINK) |
|
127 |
endif (NOT BOOST_STATIC_UNIT_TEST_LIB) |
|
128 |
endif(NOT DEFINED MSVC) |
|
129 |
||
5149.1.39
by Jens Beyer (Qcumber-some)
automatic unit tests for Debug, option WL_UNIT_TESTS to override |
130 |
include(CTest) |
131 |
enable_testing() |
|
5633
by Jens Beyer (Qcumber-some)
add target autotest only if WL_UNIT_TESTS is enabled |
132 |
|
133 |
#automatic unit testing hook, must be updated to reflect all tests
|
|
134 |
#if this is too intricate, we can also have this as an automatic detection
|
|
135 |
#but the current way allows to disable certain checks if they are taking
|
|
136 |
#too much time when ran every compile time
|
|
137 |
add_custom_target(autotest ALL |
|
138 |
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure |
|
139 |
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
|
5804.1.2
by Jari Hautio
Added io/filesystem tests. Test don't succeed fully yet. Skip tilde expansion tests on windows. |
140 |
DEPENDS widelands;test_widelands_scripting;test_economy;test_io_filesystem |
5633
by Jens Beyer (Qcumber-some)
add target autotest only if WL_UNIT_TESTS is enabled |
141 |
)
|
5149.1.39
by Jens Beyer (Qcumber-some)
automatic unit tests for Debug, option WL_UNIT_TESTS to override |
142 |
else (WL_UNIT_TESTS) |
5662
by Jens Beyer (Qcumber-some)
change displayed message for disabled unit tests and enabled/disabled strict mode |
143 |
message(STATUS "Disabled Unit Tests") |
6105.1.14
by Nicolai Hähnle
First use of boost::signals |
144 |
set (Boost_FIND_COMPONENTS signals) |
6404
by Jari
Fixed cmake to find correct boost libraries for visual studio also when tests are disabled |
145 |
if (DEFINED MSVC) |
146 |
set (Boost_USE_STATIC_RUNTIME ON) |
|
147 |
set (Boost_USE_STATIC_LIBS ON) |
|
148 |
else (DEFINED MSVC) |
|
149 |
set (Boost_USE_STATIC_LIBS OFF) |
|
150 |
endif(DEFINED MSVC) |
|
6105.1.14
by Nicolai Hähnle
First use of boost::signals |
151 |
set (Boost_USE_MULTITHREADED ON) |
152 |
set (Boost_DETAILED_FAILURE_MSG ON) |
|
153 |
find_package(Boost 1.35.0 COMPONENTS signals REQUIRED) |
|
5149.1.39
by Jens Beyer (Qcumber-some)
automatic unit tests for Debug, option WL_UNIT_TESTS to override |
154 |
endif (WL_UNIT_TESTS) |
155 |
||
5645
by Jens Beyer (Qcumber-some)
added WL_STRICT option to treat almost every compilation warning as error |
156 |
option (WL_STRICT "If strict compilation mode is requested (almost every warning is an error)" OFF) |
157 |
||
5133
by Jens Beyer (Qcumber-some)
Disable -isystem for gcc4.3.1 and gcc4.3.2 with a warning message |
158 |
set (PARAMETER_COMPILERFLAG_OLDSTYLECAST_EXTENDED "-Wold-style-cast -isystem ${Boost_INCLUDE_DIR}") |
159 |
set (PARAMETER_COMPILERFLAG_OLDSTYLECAST "-Wold-style-cast") |
|
6477.1.1
by Hans Joachim Desserud
Compile with more warnings by default |
160 |
set (PARAMETER_COMPILERFLAG_GENERICWARNINGS "-Wall -Wextra") |
6513.2.6
by Hans Joachim Desserud
Revert -Wswitch-enum, though keep some style changes |
161 |
set (PARAMETER_COMPILERFLAG_EXTRAWARNINGS "-Wformat -Wformat-nonliteral -Wformat-security -Wformat-y2k -Winit-self -Winvalid-pch -Wmissing-include-dirs -Woverlength-strings -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-promo -Wswitch-default -Wundef -Wunused -Wunused-macros") |
6498.1.2
by Hans Joachim Desserud
And a few more warnings |
162 |
set (PARAMETER_COMPILERFLAG_GCCWARNINGS "-Wlogical-op -Wsync-nand -Wtrampolines") |
5650
by Timo Wingender
fix gcc warnings to compile with -Werror |
163 |
set (PARAMETER_COMPILERFLAG_STRICT "-Werror -Wno-error=old-style-cast -Wno-error=deprecated-declarations -fdiagnostics-show-option") |
6512.2.8
by Andras Eisenberger
Fixed tabulation in CMakeLists.txt |
164 |
include(CheckCXXCompilerFlag) #this include should be safe |
165 |
CHECK_CXX_COMPILER_FLAG(${PARAMETER_COMPILERFLAG_OLDSTYLECAST_EXTENDED} Compiler_old-style-cast_supported) |
|
166 |
IF (Compiler_old-style-cast_supported) |
|
167 |
EXEC_PROGRAM(${CMAKE_CXX_COMPILER} |
|
168 |
ARGS --version |
|
169 |
OUTPUT_VARIABLE WLBUILD_COMPILERVERSION |
|
170 |
)
|
|
171 |
STRING(REGEX REPLACE ".*([0-9])\\.([0-9])\\.([0-9]).*" "\\1.\\2.\\3" WLBUILD_COMPILERVERSION_REP ${WLBUILD_COMPILERVERSION}) |
|
172 |
IF (WLBUILD_COMPILERVERSION_REP STREQUAL "4.3.2" OR WLBUILD_COMPILERVERSION_REP STREQUAL "4.3.1") |
|
173 |
message("===== ATTENTION ===================================================") |
|
174 |
message("Your compiler has been identified as GCC 4.3.1 or GCC 4.3.2") |
|
175 |
message(" ") |
|
176 |
message("There is a bug regarding this version, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38000") |
|
177 |
message("and https://bugs.launchpad.net/widelands/+bug/549479 for details.") |
|
178 |
message("Build will disable -isystem usage, expect lots of warnings from Boost header files.") |
|
179 |
message("Widelands should still compile and link correctly.") |
|
180 |
message("If the compiler identification is correct, please consider updating your gcc.") |
|
181 |
message("This warning message will disappear at GCC 4.3.3 and higher.") |
|
182 |
message("If you feel this is wrong, please submit a bug with widelands (not with GCC!)") |
|
183 |
message("and add the following information how cmake sees your C++ compiler:") |
|
184 |
message(" ") |
|
185 |
message("--------------------------------") |
|
186 |
message("${WLBUILD_COMPILERVERSION}") |
|
187 |
message("--------------------------------") |
|
188 |
message(" ") |
|
189 |
message("Thank you for taking your time to read this.") |
|
190 |
message("===================================================================") |
|
191 |
set (WL_COMPILERFLAG_OLDSTYLECAST " ${PARAMETER_COMPILERFLAG_OLDSTYLECAST}") #the space is on purpose! |
|
192 |
ELSE (WLBUILD_COMPILERVERSION_REP STREQUAL "4.3.2" OR WLBUILD_COMPILERVERSION_REP STREQUAL "4.3.1") |
|
193 |
IF (CMAKE_BUILD_TYPE STREQUAL "Debug") |
|
194 |
set (WL_COMPILERFLAG_OLDSTYLECAST " ${PARAMETER_COMPILERFLAG_OLDSTYLECAST_EXTENDED}") #the space is on purpose! |
|
195 |
ELSE (CMAKE_BUILD_TYPE STREQUAL "Debug") |
|
6512.2.10
by Andras Eisenberger
Fix (harmless) copying error in CMakeLists.txt |
196 |
include_directories(SYSTEM ${Boost_INCLUDE_DIR}) |
6512.2.8
by Andras Eisenberger
Fixed tabulation in CMakeLists.txt |
197 |
ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug") |
198 |
ENDIF (WLBUILD_COMPILERVERSION_REP STREQUAL "4.3.2" OR WLBUILD_COMPILERVERSION_REP STREQUAL "4.3.1") |
|
199 |
ENDIF (Compiler_old-style-cast_supported) |
|
5107
by Jens Beyer (Qcumber-some)
Add Debug compiler warnings -Wall -Wno-attributes |
200 |
|
6539.3.1
by Nicolai Hähnle
Use the same compiler warning flags in both Debug and Release builds |
201 |
CHECK_CXX_COMPILER_FLAG(${PARAMETER_COMPILERFLAG_GENERICWARNINGS} Compiler_generic_warnings_supported) |
202 |
IF (Compiler_generic_warnings_supported) |
|
203 |
set (WL_COMPILERFLAG_GENERICWARNINGS " ${PARAMETER_COMPILERFLAG_GENERICWARNINGS}") #the space is on purpose! |
|
204 |
ENDIF (Compiler_generic_warnings_supported) |
|
205 |
||
206 |
CHECK_CXX_COMPILER_FLAG(${PARAMETER_COMPILERFLAG_EXTRAWARNINGS} Compiler_extra_warnings_supported) |
|
207 |
IF (Compiler_extra_warnings_supported) |
|
208 |
set (WL_COMPILERFLAG_EXTRAWARNINGS " ${PARAMETER_COMPILERFLAG_EXTRAWARNINGS}") #the space is on purpose! |
|
209 |
ELSE (Compiler_extra_warnings_supported) |
|
210 |
message("Warning: couldn't set the following compiler options: ${PARAMETER_COMPILERFLAG_EXTRAWARNINGS}. Most likely these options are available in a newer release of your compiler.") |
|
211 |
ENDIF (Compiler_extra_warnings_supported) |
|
212 |
||
213 |
CHECK_CXX_COMPILER_FLAG(${PARAMETER_COMPILERFLAG_GCCWARNINGS} Compiler_gcc_warnings_supported) |
|
214 |
IF (Compiler_gcc_warnings_supported) |
|
215 |
set (WL_COMPILERFLAG_GCCWARNINGS " ${PARAMETER_COMPILERFLAG_GCCWARNINGS}") #the space is on purpose! |
|
216 |
ELSE (Compiler_gcc_warnings_supported) |
|
217 |
message("Warning: could not add additional GCC-specific warning options: ${PARAMETER_COMPILERFLAG_GCCWARNINGS}. Most likely you are using a different compiler, like Clang/LLVM.") |
|
218 |
ENDIF (Compiler_gcc_warnings_supported) |
|
219 |
||
220 |
IF (WL_STRICT) |
|
221 |
CHECK_CXX_COMPILER_FLAG(${PARAMETER_COMPILERFLAG_STRICT} Compiler_strict_mode_supported) |
|
222 |
IF (Compiler_strict_mode_supported) |
|
223 |
set (WL_COMPILERFLAG_STRICT " ${PARAMETER_COMPILERFLAG_STRICT}") #the space is on purpose! |
|
224 |
message(STATUS "Strict mode enabled, expect compilation errors instead of compilation warnings!") |
|
225 |
ENDIF (Compiler_strict_mode_supported) |
|
226 |
ENDIF (WL_STRICT) |
|
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
227 |
|
228 |
# CMAKE only defines "-g", but we need -DDEBUG also, and we need -DNOPARACHUTE (for SDL) in Debug
|
|
6477.1.1
by Hans Joachim Desserud
Compile with more warnings by default |
229 |
set (CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG -DNOPARACHUTE${WL_COMPILERFLAG_OLDSTYLECAST}${WL_COMPILERFLAG_GENERICWARNINGS}${WL_COMPILERFLAG_EXTRAWARNINGS}${WL_COMPILERFLAG_GCCWARNINGS}${WL_COMPILERFLAG_STRICT}" CACHE STRING "Set by widelands CMakeLists.txt" FORCE) |
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
230 |
|
6539.3.2
by Nicolai Hähnle
Determine the release build optimization flag more robustly |
231 |
set (WL_COMPILERFLAG_OPTIMIZATIONS "-O3") |
232 |
||
6094
by David Allwicher
disable -O3 for gcc-4.5.1 gcc-4.5.2 |
233 |
#This can be removed if no one uses gcc 4.5.1 or 4.5.2 any more
|
6432
by Jens Beyer (Qcumber-some)
use correct variable variant in IF statement |
234 |
IF (CMAKE_COMPILER_IS_GNUCXX) |
6539.3.2
by Nicolai Hähnle
Determine the release build optimization flag more robustly |
235 |
EXEC_PROGRAM ( |
6094
by David Allwicher
disable -O3 for gcc-4.5.1 gcc-4.5.2 |
236 |
${CMAKE_CXX_COMPILER} |
237 |
ARGS --version |
|
238 |
OUTPUT_VARIABLE WLBUILD_COMPILERVERSION |
|
6539.3.2
by Nicolai Hähnle
Determine the release build optimization flag more robustly |
239 |
)
|
240 |
STRING(REGEX REPLACE ".*(4)\\.(5)\\.([0-9]).*" "\\1.\\2.\\3" WLBUILD_COMPILERVERSION_REP ${WLBUILD_COMPILERVERSION}) |
|
241 |
IF (WLBUILD_COMPILERVERSION_REP STREQUAL "4.5.1" OR WLBUILD_COMPILERVERSION_REP STREQUAL "4.5.2") |
|
242 |
message("Detected gcc ${WLBUILD_COMPILERVERSION_REP}") |
|
243 |
message("Suffering from gcc bug, disabling -O3") |
|
244 |
set (WL_COMPILERFLAG_OPTIMIZATIONS "-O2") |
|
245 |
ENDIF (WLBUILD_COMPILERVERSION_REP STREQUAL "4.5.1" OR WLBUILD_COMPILERVERSION_REP STREQUAL "4.5.2") |
|
6432
by Jens Beyer (Qcumber-some)
use correct variable variant in IF statement |
246 |
ENDIF (CMAKE_COMPILER_IS_GNUCXX) |
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
247 |
|
6539.3.1
by Nicolai Hähnle
Use the same compiler warning flags in both Debug and Release builds |
248 |
set (CMAKE_CXX_FLAGS_RELEASE "${WL_COMPILERFLAG_OPTIMIZATIONS} -DNDEBUG${WL_COMPILERFLAG_OLDSTYLECAST}${WL_COMPILERFLAG_GENERICWARNINGS}${WL_COMPILERFLAG_EXTRAWARNINGS}${WL_COMPILERFLAG_GCCWARNINGS}${WL_COMPILERFLAG_STRICT}" CACHE STRING "Set by widelands CMakeLists.txt" FORCE) |
249 |
||
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
250 |
#If building with MSVC, then check for 3rdparty libs
|
251 |
if (DEFINED MSVC) |
|
252 |
set (WL_3RDPARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty" CACHE STRING "Widelands 3rdparty dir") |
|
253 |
set (CMAKE_INCLUDE_PATH "${WL_3RDPARTY_DIR}/include;${WL_3RDPARTY_DIR}/include/sdl") |
|
254 |
set (CMAKE_LIBRARY_PATH "${WL_3RDPARTY_DIR}/lib") |
|
255 |
||
256 |
add_definitions( -Dand=&& -Dor=|| -Dnot=! -Dxor=^ ) |
|
257 |
add_definitions( -Dstrcasecmp=_stricmp ) |
|
258 |
add_definitions( -Dstrncasecmp=_strnicmp ) |
|
259 |
add_definitions( -Dsnprintf=_snprintf ) |
|
260 |
add_definitions( -Drint=floor ) |
|
261 |
add_definitions( -Dstrtoll=_strtoi64 ) |
|
262 |
add_definitions( -Dstrtoull=_strtoui64 ) |
|
263 |
add_definitions( -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS ) |
|
264 |
add_definitions( -Dssize_t=size_t ) |
|
265 |
add_definitions( -Dmkdir=_mkdir ) |
|
5502
by Jari Hautio
Implemented support for redirecting stdio from widelands to files. Redirection is enabled if REDIRECT_STDIO is defined at compile time (enabled for MSVC builds). This allows windows version to write logs to home folder if executable folder is not writable (program files folder under Vista nd Win7). Fixes bug #625979. |
266 |
add_definitions( -DREDIRECT_OUTPUT ) |
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
267 |
|
5912
by Nasenbaer
Fix the fix for bug #536149 - similar to the statement of the first fix: bug should be fixed now ... + typo in CMakeLists.txt |
268 |
# Automatic linking for boost requires setting lib dir and clearing Boost_LIBRARIES
|
5149.1.33
by Jens Beyer (Qcumber-some)
Merge from trunk |
269 |
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) |
270 |
set(Boost_LIBRARIES "") |
|
5660
by Jari Hautio
Fixed to build with MSVC2008. |
271 |
include_directories(${Boost_INCLUDE_DIR}) |
272 |
||
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
273 |
|
274 |
find_library(INTL_LIBRARY NAMES intl libintl) |
|
275 |
||
5786
by Jari Hautio
Silenced some unnecessary warnings in visual studio build. |
276 |
set (MSVC_DISABLE_WARNINGS "/wd4290 /wd4800 /wo4373 /wd4355") |
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
277 |
# CMAKE only defines "-g", but we need -DDEBUG also, and we need -DNOPARACHUTE (for SDL) in Debug
|
5786
by Jari Hautio
Silenced some unnecessary warnings in visual studio build. |
278 |
set (CMAKE_CXX_FLAGS_DEBUG " -DDEBUG -DNOPARACHUTE /MTd /Zi /D_DEBUG ${MSVC_DISABLE_WARNINGS}" CACHE STRING "Set by widelands CMakeLists.txt" FORCE) |
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
279 |
|
6043
by Holger Rapp
No reason not to optimize as aggresivly as possible. |
280 |
set (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG /MT /GL ${MSVC_DISABLE_WARNINGS}" CACHE STRING "Set by widelands CMakeLists.txt" FORCE) |
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
281 |
|
5480
by Jari Hautio
Switch to use static libraries and static msvc-runtime in windows/visual studio builds. |
282 |
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /LTCG /NODEFAULTLIB:libcmt.lib" CACHE STRING "Set by widelands CMakeLists.txt" FORCE) |
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
283 |
|
284 |
else (DEFINED MSVC) |
|
285 |
set (HAVE_VARARRAY TRUE CACHE BOOL "Use variable length arrays to improve performance. Requires gcc." ) |
|
286 |
endif (DEFINED MSVC) |
|
287 |
||
5099
by Jens Beyer (Qcumber-some)
Tell user which compiler flags the current CMake is using |
288 |
IF (CMAKE_BUILD_TYPE STREQUAL "Debug") |
5149
by Jens Beyer (Qcumber-some)
Minor cmake messaging cleanup |
289 |
message (STATUS "Using compiler flags: ${CMAKE_CXX_FLAGS_DEBUG}") |
5099
by Jens Beyer (Qcumber-some)
Tell user which compiler flags the current CMake is using |
290 |
ELSE (CMAKE_BUILD_TYPE STREQUAL "Debug") |
5149
by Jens Beyer (Qcumber-some)
Minor cmake messaging cleanup |
291 |
message (STATUS "Using compiler flags: ${CMAKE_CXX_FLAGS_RELEASE}") |
5099
by Jens Beyer (Qcumber-some)
Tell user which compiler flags the current CMake is using |
292 |
ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug") |
293 |
||
5011.1.1
by Jari Hautio
GGZ support enabled in VS2008. |
294 |
if (DEFINED WL_3RDPARTY_DIR) |
295 |
set (CMAKE_INCLUDE_PATH "${WL_3RDPARTY_DIR}/include;${WL_3RDPARTY_DIR}/include/sdl") |
|
296 |
set (CMAKE_LIBRARY_PATH "${WL_3RDPARTY_DIR}/lib") |
|
297 |
endif (DEFINED WL_3RDPARTY_DIR) |
|
298 |
||
6349
by Holger Rapp
Patch to build on OpenBSD by A.J. Bentley |
299 |
# on BSD this must be explicitly linked
|
300 |
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "OpenBSD") |
|
5914
by Holger Rapp
Applied fixes for FreeBSD from Nathan Peters |
301 |
find_library(EXECINFO_LIBRARY NAMES execinfo) |
6349
by Holger Rapp
Patch to build on OpenBSD by A.J. Bentley |
302 |
endif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "OpenBSD") |
5914
by Holger Rapp
Applied fixes for FreeBSD from Nathan Peters |
303 |
|
304 |
||
4995.2.17
by Timo Wingender
Add opengl support to cmake |
305 |
# Check for opengl
|
306 |
# TODO Check for SDL_opengl.h and add to include path
|
|
307 |
find_package(OpenGL) |
|
308 |
if (OPENGL_FOUND) |
|
309 |
# OpenGL Headers are not needed directly. Instead SDL_opengl.h should be searched
|
|
310 |
add_definitions("-DUSE_OPENGL") |
|
5855
by Nicolai Hähnle
Tino's changes to use GLEW, with some modifications |
311 |
find_package(GLEW) |
312 |
if (GLEW_FOUND) |
|
5866
by Jari Hautio
Support linking static version of glew library on Win32. |
313 |
add_definitions(${GLEW_EXTRA_DEFINITIONS}) |
5855
by Nicolai Hähnle
Tino's changes to use GLEW, with some modifications |
314 |
else (GLEW FOUND) |
315 |
message (STATUS "GLEW library not found, check your libraries path and installed packages!") |
|
316 |
endif (GLEW_FOUND) |
|
4995.2.17
by Timo Wingender
Add opengl support to cmake |
317 |
else (OPENGL_FOUND) |
318 |
message (STATUS "OpenGL support disabled, check your libraries path and installed packages!") |
|
319 |
endif (OPENGL_FOUND) |
|
320 |
||
4944
by qcs
Manual merge of cmake-migration branch to trunk |
321 |
# ...but using MAJOR, MINOR and PATCH
|
322 |
if (DEFINED WL_VERSION_MAJOR) |
|
4984
by Nasenbaer
Add more options for commandline to set BIN-, DATA- and LOCALEDIR, as well as Buildids with cmake |
323 |
set (CPACK_PACKAGE_VERSION_MAJOR ${WL_VERSION_MAJOR}) |
324 |
||
325 |
# Until 1.x.x set standard VERSION => "BuildXX"
|
|
326 |
if (WL_VERSION_MAJOR STREQUAL "0") |
|
327 |
if (DEFINED WL_VERSION_MINOR) |
|
328 |
set (WL_VERSION Build${WL_VERSION_MINOR}) |
|
329 |
set (CPACK_PACKAGE_VERSION_MINOR ${WL_VERSION_MINOR}) |
|
330 |
if (DEFINED WL_VERSION_PATCH) |
|
331 |
set (WL_VERSION ${WL_VERSION}.${WL_VERSION_PATCH}) |
|
332 |
set (CPACK_PACKAGE_VERSION_PATCH ${WL_VERSION_PATCH}) |
|
333 |
else (DEFINED WL_VERSION_PATCH) |
|
334 |
set (CPACK_PACKAGE_VERSION_PATCH 0) |
|
335 |
endif (DEFINED WL_VERSION_PATCH) |
|
336 |
if (DEFINED WL_VERSION_ADDITION) |
|
337 |
set (WL_VERSION ${WL_VERSION}${WL_VERSION_ADDITION}) |
|
338 |
endif (DEFINED WL_VERSION_ADDITION) |
|
339 |
else (DEFINED WL_VERSION_MINOR) |
|
340 |
set (WL_VERSION "NO BUILD ID") |
|
341 |
endif (DEFINED WL_VERSION_MINOR) |
|
342 |
||
343 |
# from 1.x.x on:
|
|
344 |
else (WL_VERSION_MAJOR STREQUAL "0") |
|
345 |
set (WL_VERSION ${WL_VERSION_MAJOR}) |
|
346 |
if (DEFINED WL_VERSION_MINOR) |
|
347 |
set (WL_VERSION ${WL_VERSION}.${WL_VERSION_MINOR}) |
|
348 |
set (CPACK_PACKAGE_VERSION_MINOR ${WL_VERSION_MINOR}) |
|
349 |
if (DEFINED WL_VERSION_PATCH) |
|
350 |
set (WL_VERSION ${WL_VERSION}.${WL_VERSION_PATCH}) |
|
351 |
set (CPACK_PACKAGE_VERSION_PATCH ${WL_VERSION_PATCH}) |
|
352 |
else (DEFINED WL_VERSION_PATCH) |
|
353 |
set (CPACK_PACKAGE_VERSION_PATCH 0) |
|
354 |
endif (DEFINED WL_VERSION_PATCH) |
|
355 |
if (DEFINED WL_VERSION_ADDITION) |
|
356 |
set (WL_VERSION ${WL_VERSION}${WL_VERSION_ADDITION}) |
|
357 |
endif (DEFINED WL_VERSION_ADDITION) |
|
358 |
else (DEFINED WL_VERSION_MINOR) |
|
359 |
set (CPACK_PACKAGE_VERSION_MINOR 0) |
|
360 |
endif (DEFINED WL_VERSION_MINOR) |
|
361 |
endif (WL_VERSION_MAJOR STREQUAL "0") |
|
5310
by Nasenbaer
Fix for compilation without bzr files in path |
362 |
# Needed - else detect_revision.py will still use bzr or even crash, if
|
363 |
# Widelands is compiled in a bzr export
|
|
364 |
file (WRITE WL_RELEASE "${WL_VERSION}") |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
365 |
endif (DEFINED WL_VERSION_MAJOR) |
366 |
||
6244
by Shevonar
Find Python earlier in CMake script to detect version successfully on first run. |
367 |
# we need python to determine the current version
|
368 |
find_package (PythonInterp REQUIRED) |
|
369 |
||
4944
by qcs
Manual merge of cmake-migration branch to trunk |
370 |
if (NOT DEFINED WL_VERSION) |
5040
by Jens Beyer (Qcumber-some)
Don't use unset function anymore, drop CMake version requirements from 2.6.3 to 2.6.0 |
371 |
add_custom_target ( |
372 |
BzrRevision ALL |
|
5343
by Jens Beyer (Qcumber-some)
Make internal cmake calls really platform independent (XCode problem) |
373 |
COMMAND ${CMAKE_COMMAND} -DWL_INSTALL_PREFIX=${WL_INSTALL_PREFIX} -DWL_INSTALL_BINDIR=${WL_INSTALL_BINDIR} -DWL_INSTALL_DATADIR=${WL_INSTALL_DATADIR} -DWL_INSTALL_LOCALEDIR=${WL_INSTALL_LOCALEDIR} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/BzrRevision.cmake |
5040
by Jens Beyer (Qcumber-some)
Don't use unset function anymore, drop CMake version requirements from 2.6.3 to 2.6.0 |
374 |
)
|
6539.3.1
by Nicolai Hähnle
Use the same compiler warning flags in both Debug and Release builds |
375 |
|
6208.1.4
by Shevonar
correct version name |
376 |
# Detect version now
|
377 |
execute_process ( |
|
378 |
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/detect_revision.py |
|
379 |
OUTPUT_VARIABLE WL_VERSION |
|
380 |
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
|
381 |
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
382 |
)
|
|
383 |
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/VERSION "${WL_VERSION}") |
|
384 |
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/build_info.cc.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/build_info.cc) |
|
385 |
message (STATUS "Version of Widelands Build is ${WL_VERSION}(${CMAKE_BUILD_TYPE})") |
|
386 |
||
5040
by Jens Beyer (Qcumber-some)
Don't use unset function anymore, drop CMake version requirements from 2.6.3 to 2.6.0 |
387 |
else (NOT DEFINED WL_VERSION) |
388 |
add_custom_target ( |
|
389 |
InputRevision ALL |
|
5343
by Jens Beyer (Qcumber-some)
Make internal cmake calls really platform independent (XCode problem) |
390 |
COMMAND ${CMAKE_COMMAND} -DWL_INSTALL_PREFIX=${WL_INSTALL_PREFIX} -DWL_INSTALL_BINDIR=${WL_INSTALL_BINDIR} -DWL_INSTALL_DATADIR=${WL_INSTALL_DATADIR} -DWL_INSTALL_LOCALEDIR=${WL_INSTALL_LOCALEDIR} -DWL_VERSION=${WL_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/InputRevision.cmake |
4944
by qcs
Manual merge of cmake-migration branch to trunk |
391 |
)
|
392 |
endif (NOT DEFINED WL_VERSION) |
|
393 |
||
4970
by Jens Beyer (Qcumber-some)
CMake writes VERSION file |
394 |
install ( |
395 |
FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION |
|
5771
by Jens Beyer (Qcumber-some)
remove special handling of localedir for Linux, it is now always part of datadir |
396 |
DESTINATION ${WL_INSTALL_DATADIR} |
4970
by Jens Beyer (Qcumber-some)
CMake writes VERSION file |
397 |
CONFIGURATIONS Debug;Release |
398 |
COMPONENT CoreVersionFile |
|
399 |
)
|
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
400 |
set(CPACK_COMPONENT_COREVERSIONFILE_HIDDEN TRUE) |
401 |
set(CPACK_COMPONENT_COREVERSIONFILE_REQUIRED TRUE) |
|
4967
by Jens Beyer (Qcumber-some)
Path quickfix along the suggestions of 'A Mennucc <mennucc1@debian.org>' on widelands-public; this will probably need cleanup/review after transition |
402 |
|
4994
by Jens Beyer (Qcumber-some)
Fixed Bug 2961088: order of includes |
403 |
include_directories(src ${CMAKE_CURRENT_BINARY_DIR}/src) |
404 |
||
4944
by qcs
Manual merge of cmake-migration branch to trunk |
405 |
include(CheckIncludeFile) |
406 |
||
407 |
find_package(PNG REQUIRED) |
|
408 |
include_directories(${PNG_INCLUDE_DIR}) |
|
409 |
||
410 |
find_package(ZLIB REQUIRED) |
|
411 |
include_directories(${ZLIB_INCLUDE_DIR}) |
|
412 |
||
6346.8.1
by Jens Beyer (Qcumber-some)
Move minizip sources out of widelands to own library; use system minizip library if available |
413 |
# Check if we have a working minizip library
|
414 |
find_package(Minizip) |
|
415 |
if (MINIZIP_FOUND) |
|
416 |
include_directories(${MINIZIP_INCLUDE_DIR}) |
|
417 |
endif (MINIZIP_FOUND) |
|
418 |
||
6440.1.1
by Dmitry Marakasov
libintl is required on FreeBSD as well |
419 |
if (APPLE OR WIN32 OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") |
4944
by qcs
Manual merge of cmake-migration branch to trunk |
420 |
find_package(intl REQUIRED) |
421 |
include_directories(${INTL_INCLUDE_DIR}) |
|
6440.1.1
by Dmitry Marakasov
libintl is required on FreeBSD as well |
422 |
endif (APPLE OR WIN32 OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") |
4944
by qcs
Manual merge of cmake-migration branch to trunk |
423 |
|
424 |
find_package(SDL REQUIRED) |
|
425 |
include_directories(${SDL_INCLUDE_DIR}) |
|
426 |
||
427 |
find_package(SDL_image REQUIRED) |
|
428 |
include_directories(${SDLIMAGE_INCLUDE_DIR}) |
|
6337.2.1
by Jens Beyer (Qcumber-some)
error messages for missing SDL accessory packages |
429 |
if (NOT SDLIMAGE_FOUND) |
430 |
message(FATAL_ERROR "Required package SDL_image not found, please install and re-run cmake") |
|
431 |
endif (NOT SDLIMAGE_FOUND) |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
432 |
|
433 |
find_package(SDL_mixer REQUIRED) |
|
434 |
include_directories(${SDLMIXER_INCLUDE_DIR}) |
|
6337.2.1
by Jens Beyer (Qcumber-some)
error messages for missing SDL accessory packages |
435 |
if (NOT SDLMIXER_FOUND) |
436 |
message(FATAL_ERROR "Required package SDL_mixer not found, please install and re-run cmake") |
|
437 |
endif (NOT SDLMIXER_FOUND) |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
438 |
|
439 |
find_package(SDL_net REQUIRED) |
|
440 |
include_directories(${SDLNET_INCLUDE_DIR}) |
|
6337.2.1
by Jens Beyer (Qcumber-some)
error messages for missing SDL accessory packages |
441 |
if (NOT SDLNET_FOUND) |
442 |
message(FATAL_ERROR "Required package SDL_net not found, please install and re-run cmake") |
|
443 |
endif (NOT SDLNET_FOUND) |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
444 |
|
445 |
find_package(SDL_ttf REQUIRED) |
|
446 |
include_directories(${SDLTTF_INCLUDE_DIR}) |
|
6337.2.1
by Jens Beyer (Qcumber-some)
error messages for missing SDL accessory packages |
447 |
if (NOT SDLTTF_FOUND) |
448 |
message(FATAL_ERROR "Required package SDL_ttf not found, please install and re-run cmake") |
|
449 |
endif (NOT SDLTTF_FOUND) |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
450 |
|
451 |
find_package(SDL_gfx REQUIRED) |
|
452 |
include_directories(${SDLGFX_INCLUDE_DIR}) |
|
6337.2.1
by Jens Beyer (Qcumber-some)
error messages for missing SDL accessory packages |
453 |
if (NOT SDLGFX_FOUND) |
454 |
message(FATAL_ERROR "Required package SDL_gfx not found, please install and re-run cmake") |
|
455 |
endif (NOT SDLGFX_FOUND) |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
456 |
|
457 |
find_package(Lua51 REQUIRED) |
|
458 |
include_directories(${LUA_INCLUDE_DIR}) |
|
459 |
||
4945
by beyerj
Integrated CMake build patch for Windows from TMiegel in Sourceforge bugtracker #2929259 |
460 |
IF (WIN32) |
461 |
SET(GUI_TYPE WIN32) |
|
462 |
ENDIF (WIN32) |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
463 |
|
464 |
#configure_file (src/config.h.cmake src/config.h)
|
|
465 |
#configure_file (src/build_info.cc.cmake src/build_info.cc)
|
|
466 |
||
4961
by Jens Beyer (Qcumber-some)
detect_revision in new location; Cleanup CMake scripts; enable target 'lang' |
467 |
add_subdirectory(doc) |
5149.1.5
by Jens Beyer (Qcumber-some)
Converted 'make lang' to cmake without the python scripts |
468 |
add_subdirectory(po) |
4944
by qcs
Manual merge of cmake-migration branch to trunk |
469 |
add_subdirectory(src) |
470 |
||
471 |
# install files to the correct locations here
|
|
472 |
install( |
|
473 |
DIRECTORY
|
|
474 |
campaigns
|
|
475 |
fonts
|
|
476 |
global
|
|
477 |
tribes
|
|
478 |
txts
|
|
479 |
worlds
|
|
5092
by Jens Beyer (Qcumber-some)
Changed pics directory handling - not a special directory anymore |
480 |
pics
|
5228
by Jens Beyer (Qcumber-some)
make install should copy the scripting dir |
481 |
scripting
|
5771
by Jens Beyer (Qcumber-some)
remove special handling of localedir for Linux, it is now always part of datadir |
482 |
DESTINATION ${WL_INSTALL_DATADIR} |
4951
by beyerj
Repaired targets install, package |
483 |
CONFIGURATIONS Debug;Release |
4944
by qcs
Manual merge of cmake-migration branch to trunk |
484 |
COMPONENT CoreDataFiles |
485 |
)
|
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
486 |
set(CPACK_COMPONENT_COREDATAFILES_DISPLAY_NAME "Widelands Core") |
487 |
set(CPACK_COMPONENT_COREDATAFILES_HIDDEN FALSE) |
|
488 |
set(CPACK_COMPONENT_COREDATAFILES_REQUIRED TRUE) |
|
489 |
||
490 |
install( |
|
491 |
DIRECTORY
|
|
492 |
maps
|
|
493 |
DESTINATION ${WL_INSTALL_DATADIR} |
|
494 |
CONFIGURATIONS Debug;Release |
|
495 |
COMPONENT MapFiles |
|
496 |
)
|
|
497 |
set(CPACK_COMPONENT_MAPFILES_DISPLAY_NAME "Maps Files") |
|
498 |
||
499 |
install( |
|
500 |
DIRECTORY
|
|
501 |
music
|
|
502 |
sound
|
|
503 |
DESTINATION ${WL_INSTALL_DATADIR} |
|
504 |
CONFIGURATIONS Debug;Release |
|
505 |
COMPONENT MusicFiles |
|
506 |
)
|
|
507 |
set(CPACK_COMPONENT_MUSICFILES_DISPLAY_NAME "Music and Sound Files") |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
508 |
|
4966
by Jens Beyer (Qcumber-some)
Target 'install' now uses the results of target 'pics' |
509 |
install( |
5059
by Jens Beyer (Qcumber-some)
Upon installing, copy ChangeLog, CREDITS and COPYING files |
510 |
FILES
|
511 |
COPYING
|
|
512 |
CREDITS
|
|
513 |
ChangeLog
|
|
5771
by Jens Beyer (Qcumber-some)
remove special handling of localedir for Linux, it is now always part of datadir |
514 |
DESTINATION ${WL_INSTALL_DATADIR} |
5059
by Jens Beyer (Qcumber-some)
Upon installing, copy ChangeLog, CREDITS and COPYING files |
515 |
CONFIGURATIONS Debug;Release |
516 |
COMPONENT CoreLicenseFiles |
|
517 |
)
|
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
518 |
set(CPACK_COMPONENT_CORELICENSEFILES_HIDDEN TRUE) |
519 |
set(CPACK_COMPONENT_CORELICENSEFILES_REQUIRED TRUE) |
|
5059
by Jens Beyer (Qcumber-some)
Upon installing, copy ChangeLog, CREDITS and COPYING files |
520 |
|
521 |
install( |
|
4966
by Jens Beyer (Qcumber-some)
Target 'install' now uses the results of target 'pics' |
522 |
DIRECTORY
|
523 |
doc
|
|
5771
by Jens Beyer (Qcumber-some)
remove special handling of localedir for Linux, it is now always part of datadir |
524 |
DESTINATION ${WL_INSTALL_DATADIR} |
4966
by Jens Beyer (Qcumber-some)
Target 'install' now uses the results of target 'pics' |
525 |
CONFIGURATIONS Debug |
526 |
COMPONENT DocFiles |
|
5147
by Jens Beyer (Qcumber-some)
Cleanup after make doc; minor fix for doc installation |
527 |
PATTERN "CMakeLists.txt" EXCLUDE |
4966
by Jens Beyer (Qcumber-some)
Target 'install' now uses the results of target 'pics' |
528 |
)
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
529 |
set(CPACK_COMPONENT_DOCFILES_DISPLAY_NAME "Documentation") |
530 |
set(CPACK_COMPONENT_DOCFILES_HIDDEN TRUE) |
|
531 |
set(CPACK_COMPONENT_DOCFILES_REQUIRED FALSE) |
|
4944
by qcs
Manual merge of cmake-migration branch to trunk |
532 |
|
5139
by Jens Beyer (Qcumber-some)
Let make clean do the cleanup after make lang |
533 |
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES locale) |
534 |
||
4962
by Jens Beyer (Qcumber-some)
Added locale dir to install |
535 |
install( |
536 |
DIRECTORY
|
|
4986
by Nasenbaer
and now with binary and locales :) - installation works and translation works in installed builds as well :) |
537 |
${CMAKE_CURRENT_BINARY_DIR}/locale/ |
5771
by Jens Beyer (Qcumber-some)
remove special handling of localedir for Linux, it is now always part of datadir |
538 |
DESTINATION ${WL_INSTALL_DATADIR}/locale |
4962
by Jens Beyer (Qcumber-some)
Added locale dir to install |
539 |
CONFIGURATIONS Debug;Release |
540 |
COMPONENT CoreLanguageFiles |
|
541 |
)
|
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
542 |
set(CPACK_COMPONENT_CORELANGUAGEFILES_DISPLAY_NAME "Language Files") |
543 |
||
544 |
set(CPACK_COMPONENT_EXECUTABLEFILES_HIDDEN TRUE) |
|
545 |
set(CPACK_COMPONENT_EXECUTABLEFILES_REQUIRED TRUE) |
|
546 |
||
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
547 |
# Components to install
|
548 |
set(CPACK_COMPONENTS_ALL ExecutableFiles CoreDataFiles MapFiles CoreLanguageFiles CoreVersionFile CoreLicenseFiles) |
|
549 |
if (NOT WL_NOMUSIC) |
|
550 |
set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} MusicFiles) |
|
551 |
endif (NOT WL_NOMUSIC) |
|
552 |
||
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
553 |
if (WIN32) |
554 |
# Install files only needed for Windows
|
|
6208.1.3
by Shevonar
changed some paths |
555 |
FILE(GLOB dlls "${CMAKE_CURRENT_BINARY_DIR}/*.dll") |
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
556 |
install( |
557 |
FILES
|
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
558 |
${dlls} |
559 |
utils/win32/WL-Editor.ico
|
|
560 |
DESTINATION ${WL_INSTALL_DATADIR} |
|
561 |
CONFIGURATIONS Debug;Release |
|
562 |
COMPONENT Win32Specific |
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
563 |
)
|
564 |
set(CPACK_COMPONENT_WIN32SPECIFIC_HIDDEN TRUE) |
|
565 |
set(CPACK_COMPONENT_WIN32SPECIFIC_REQUIRED TRUE) |
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
566 |
set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} Win32Specific) |
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
567 |
|
568 |
# Only NSIS supports install types
|
|
569 |
set(CPACK_ALL_INSTALL_TYPES Full Minimal) |
|
570 |
set(CPACK_COMPONENT_EXECUTABLEFILES_INSTALL_TYPES Full Minimal) |
|
571 |
set(CPACK_COMPONENT_COREDATAFILES_INSTALL_TYPES Full Minimal) |
|
572 |
set(CPACK_COMPONENT_COREVERSIONFILE_INSTALL_TYPES Full Minimal) |
|
573 |
set(CPACK_COMPONENT_CORELICENSEFILES_INSTALL_TYPES Full Minimal) |
|
574 |
set(CPACK_COMPONENT_MAPFILES_INSTALL_TYPES Full) |
|
575 |
set(CPACK_COMPONENT_MUSICFILES_INSTALL_TYPES Full) |
|
576 |
set(CPACK_COMPONENT_CORELANGUAGEFILES_INSTALL_TYPES Full) |
|
577 |
set(CPACK_COMPONENT_WIN32SPECIFIC_INSTALL_TYPES Full Minimal) |
|
578 |
||
579 |
# Set generator
|
|
580 |
set(CPACK_GENERATOR NSIS) |
|
581 |
||
582 |
# Graphics for the installer (all slashes are necessary!)
|
|
6208.1.3
by Shevonar
changed some paths |
583 |
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_LIST_DIR}\\\\utils\\\\win32\\\\wl-ico-128.ico") |
584 |
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_LIST_DIR}\\\\utils\\\\win32\\\\wl-ico-128.ico") |
|
585 |
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_LIST_DIR}\\\\utils\\\\win32\\\\nsis\\\\install_header.bmp") |
|
586 |
set(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP "${CMAKE_CURRENT_LIST_DIR}\\\\utils\\\\win32\\\\nsis\\\\WL.bmp") |
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
587 |
|
588 |
# Name for installer and Windows Add/Remove
|
|
589 |
set(CPACK_NSIS_PACKAGE_NAME "Widelands") |
|
590 |
set(CPACK_NSIS_DISPLAY_NAME "Widelands ${WL_VERSION}") |
|
591 |
set(CPACK_NSIS_DISPLAY_NAME_SET "TRUE") |
|
6539.3.1
by Nicolai Hähnle
Use the same compiler warning flags in both Debug and Release builds |
592 |
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
593 |
# Optional dialogs
|
594 |
if (NOT DEFINED CPACK_NSIS_LANGUAGE_DIALOG) |
|
595 |
set(CPACK_NSIS_LANGUAGE_DIALOG "ON") |
|
596 |
endif (NOT DEFINED CPACK_NSIS_LANGUAGE_DIALOG) |
|
597 |
if (NOT DEFINED CPACK_NSIS_CHANGELOG) |
|
598 |
set(CPACK_NSIS_CHANGELOG "ON") |
|
599 |
endif (NOT DEFINED CPACK_NSIS_CHANGELOG) |
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
600 |
|
601 |
# Setup (and remove) shortcuts to Widelands (all slashes are necessary!)
|
|
602 |
set(CPACK_PACKAGE_EXECUTABLES "..\\\\widelands;Widelands") |
|
603 |
set(CPACK_NSIS_MENU_LINKS "http://wl.widelands.org/;Widelands Homepage") |
|
604 |
set(CPACK_NSIS_CREATE_ICONS_EXTRA " |
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
605 |
CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Widelands - Mapeditor.lnk\\\" \\\"$INSTDIR\\\\widelands.exe\\\" \\\"--editor\\\" \\\"$INSTDIR\\\\WL-Editor.ico\\\" |
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
606 |
") |
607 |
set(CPACK_NSIS_DELETE_ICONS_EXTRA " |
|
608 |
Delete \\\"$DESKTOP\\\\Widelands.lnk\\\" |
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
609 |
Delete \\\"$DESKTOP\\\\Widelands - Mapeditor.lnk\\\" |
610 |
Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Widelands - Mapeditor.lnk\\\" |
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
611 |
") |
612 |
||
613 |
# Additional information (all slashes are necessary!)
|
|
614 |
set(CPACK_NSIS_URL_INFO_ABOUT "http://wl.widelands.org/") |
|
615 |
set(CPACK_NSIS_HELP_LINK "http://wl.widelands.org/") |
|
616 |
set(CPACK_NSIS_INSTALLED_ICON_NAME "widelands.exe") |
|
617 |
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "..\\\\widelands.exe") |
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
618 |
set(CPACK_NSIS_MUI_FINISHPAGE_README "$INSTDIR\\\\ChangeLog") |
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
619 |
set(CPACK_PACKAGE_VENDOR "Widelands Development Team") |
6208.1.4
by Shevonar
correct version name |
620 |
# replace [ and ], they will cause problems in filename!
|
6244
by Shevonar
Find Python earlier in CMake script to detect version successfully on first run. |
621 |
string(REPLACE "[" "-" PACKAGE_VERSION ${WL_VERSION}) |
622 |
string(REPLACE "]" "" PACKAGE_VERSION ${PACKAGE_VERSION}) |
|
6208.1.4
by Shevonar
correct version name |
623 |
set(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}(${CMAKE_BUILD_TYPE})") |
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
624 |
set(CPACK_PACKAGE_VERSION_MAJOR ${WL_VERSION_MAJOR}) |
625 |
set(CPACK_PACKAGE_VERSION_MINOR ${WL_VERSION_MINOR}) |
|
626 |
set(CPACK_PACKAGE_VERSION_PATCH ${WL_VERSION_PATCH}) |
|
6208.1.3
by Shevonar
changed some paths |
627 |
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}\\\\COPYING") |
628 |
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}\\\\ChangeLog") |
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
629 |
|
630 |
# Setup (and remove) Registry entries for Widelands (all slashes are necessary!)
|
|
631 |
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " |
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
632 |
WriteRegStr HKCR \\\".wgf\\\" \\\"\\\" \\\"WidelandsSavegame\\\" |
633 |
WriteRegStr HKCR \\\"WidelandsSavegame\\\" \\\"\\\" \\\"Widelands Savegame\\\" |
|
634 |
WriteRegStr HKCR \\\"WidelandsSavegame\\\\DefaultIcon\\\" \\\"\\\" \\\"$INSTDIR\\\\widelands.exe,0\\\" |
|
635 |
WriteRegStr HKCR \\\"WidelandsSavegame\\\\shell\\\\open\\\\command\\\" \\\"\\\" \\\"$INSTDIR\\\\widelands.exe --loadgame=%1\\\" |
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
636 |
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
637 |
WriteRegStr HKCR \\\".wmf\\\" \\\"\\\" \\\"WidelandsMapFile\\\" |
638 |
WriteRegStr HKCR \\\"WidelandsMapFile\\\" \\\"\\\" \\\"Widelands Mapfile\\\" |
|
639 |
WriteRegStr HKCR \\\"WidelandsMapFile\\\\DefaultIcon\\\" \\\"\\\" \\\"$INSTDIR\\\\WL-Editor.ico\\\" |
|
640 |
WriteRegStr HKCR \\\"WidelandsMapFile\\\\shell\\\\open\\\\command\\\" \\\"\\\" \\\"$INSTDIR\\\\widelands.exe --editor=%1\\\" |
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
641 |
") |
642 |
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " |
|
643 |
DeleteRegValue HKCR \\\".wgf\\\" \\\"WidelandsSavegame\\\" |
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
644 |
DeleteRegKey /ifempty HKCR \\\".wgf\\\" |
645 |
DeleteRegKey HKCR \\\"WidelandsSavegame\\\" |
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
646 |
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
647 |
DeleteRegValue HKCR \\\".wmf\\\" \\\"WidelandsMapFile\\\" |
648 |
DeleteRegKey /ifempty HKCR \\\".wmf\\\" |
|
649 |
DeleteRegKey HKCR \\\"WidelandsMapFile\\\" |
|
6539.3.1
by Nicolai Hähnle
Use the same compiler warning flags in both Debug and Release builds |
650 |
|
6208.1.2
by Shevonar
Reworked NSIS Installer. Now has language dialog, changelog, optional desktop shortcuts and WL_NOMUSIC option |
651 |
Delete \\\"$INSTDIR\\\\stdout.txt\\\" |
652 |
Delete \\\"$INSTDIR\\\\stderr.txt\\\" |
|
653 |
Delete \\\"$INSTDIR\\\" |
|
6208.1.1
by Shevonar
Added NSIS support to CMake/CPack. |
654 |
") |
655 |
||
656 |
elseif (WIN32) |
|
657 |
set (CPACK_PACKAGE_FILE_NAME widelands-${WL_VERSION}) |
|
658 |
set (CPACK_GENERATOR "TGZ") |
|
659 |
set (CPACK_SOURCE_GENERATOR "TGZ") |
|
660 |
endif (WIN32) |
|
661 |
||
4944
by qcs
Manual merge of cmake-migration branch to trunk |
662 |
include(CPack) |