Move style guide stuff into separate file
[supertux.git] / CMakeLists.txt
1 #
2 # SuperTux - root build script
3 # Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 #
19
20
21 #
22 # INSTRUCTIONS:
23 # -------------
24 #
25 # Create a directory build/ and change to it. Run
26 #
27 #   cmake ..
28 #
29 # This creates a set of Makefiles to build the project. Run
30 #
31 #   make
32 #
33
34
35 ## Project name to use as command prefix
36
37 PROJECT(SUPERTUX)
38
39
40 ### CMake configuration
41
42 # allow building with CMake 2.6. Set compatibility options. Use some bundled modules as a fallback
43 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
44 IF(COMMAND cmake_policy)
45         CMAKE_POLICY(SET CMP0003 NEW)
46 ENDIF(COMMAND cmake_policy)
47
48 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SUPERTUX_SOURCE_DIR}/mk/cmake)
49
50 # move some config clutter to the advanced section
51 MARK_AS_ADVANCED(
52         CMAKE_BACKWARDS_COMPATIBILITY
53         CMAKE_BUILD_TYPE
54         CMAKE_INSTALL_PREFIX
55         EXECUTABLE_OUTPUT_PATH
56         LIBRARY_OUTPUT_PATH
57         CMAKE_OSX_ARCHITECTURES
58         CMAKE_OSX_SYSROOT
59 )
60
61 ## For autopackage
62 MARK_AS_ADVANCED(
63         ENABLE_BINRELOC
64         APPDATADIR
65 )
66 OPTION(ENABLE_BINRELOC "Enable autopackage's BINRELOC features" OFF)
67 SET(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/games/supertux2")
68
69 ## Check endianess
70
71 INCLUDE(TestBigEndian)
72 TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
73
74 ## Add lots of dependencies to compiler switches
75
76 FIND_PACKAGE(SDL REQUIRED)
77 MARK_AS_ADVANCED(
78         SDLMAIN_LIBRARY
79         SDL_INCLUDE_DIR
80         SDL_LIBRARY
81 )
82 INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
83
84 FIND_PACKAGE(SDL_image REQUIRED)
85 MARK_AS_ADVANCED(
86         SDLIMAGE_INCLUDE_DIR
87         SDLIMAGE_LIBRARY
88 )
89 INCLUDE_DIRECTORIES(${SDLIMAGE_INCLUDE_DIR})
90
91 OPTION(ENABLE_OPENGL "Enable OpenGL support" ON)
92 IF(ENABLE_OPENGL)
93   FIND_PACKAGE(OpenGL)
94   IF(${OPENGL_FOUND} STREQUAL "YES")
95     INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
96     SET(HAVE_OPENGL TRUE)
97   ENDIF(${OPENGL_FOUND} STREQUAL "YES")
98 ENDIF(ENABLE_OPENGL)
99
100 FIND_PACKAGE(OpenAL REQUIRED)
101 MARK_AS_ADVANCED(
102         OPENAL_INCLUDE_DIR
103         OPENAL_LIBRARY
104 )
105 INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
106
107 FIND_PACKAGE(OggVorbis REQUIRED)
108 MARK_AS_ADVANCED(
109         OGG_LIBRARY
110         VORBISENC_LIBRARY
111         VORBISFILE_LIBRARY
112         VORBIS_INCLUDE_DIR
113         VORBIS_LIBRARY
114 )
115 INCLUDE_DIRECTORIES(${OGGVORBIS_INCLUDE_DIR})
116
117 FIND_PACKAGE(PhysFS REQUIRED)
118 MARK_AS_ADVANCED(
119         PHYSFS_INCLUDE_DIR
120         PHYSFS_LIBRARY
121 )
122 INCLUDE_DIRECTORIES(${PHYSFS_INCLUDE_DIR})
123
124 FIND_PACKAGE(CURL)
125 IF(CURL_FOUND)
126   INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
127   SET(HAVE_LIBCURL TRUE)
128 ENDIF(CURL_FOUND)
129
130 #FIND_PACKAGE(ICONV REQUIRED)
131 #INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
132 #LINK_LIBRARIES(${ICONV_LIBRARY})
133
134 ## Find revision of WC
135 MARK_AS_ADVANCED(SVNVERSION_EXECUTABLE)
136 FIND_PROGRAM(SVNVERSION_EXECUTABLE svnversion)
137 IF(SVNVERSION_EXECUTABLE)
138   EXECUTE_PROCESS(COMMAND svnversion -n ${SUPERTUX_SOURCE_DIR}
139                   OUTPUT_VARIABLE SUPERTUX_WC_REVISION)
140   SET(REVISION " r${SUPERTUX_WC_REVISION}")
141 ENDIF(SVNVERSION_EXECUTABLE)
142
143 ## Check platform-dependent build options
144
145 INCLUDE(ConfigureChecks)
146
147 ## Create config.h and version.h
148
149 configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
150 configure_file(version.h.cmake ${CMAKE_BINARY_DIR}/version.h )
151 include_directories (${CMAKE_BINARY_DIR}/)
152
153 ## Also execute instructions in src/squirrel/CMakeLists.txt
154
155 ADD_SUBDIRECTORY(external/squirrel)
156
157 ## Add squirrel lib dir to search path
158
159 LINK_DIRECTORIES(external/squirrel)
160
161 ## Some additional include paths
162
163 include_directories (${SUPERTUX_SOURCE_DIR}/src/)
164 include_directories (${SUPERTUX_SOURCE_DIR}/external/squirrel/include/)
165 include_directories (${SUPERTUX_SOURCE_DIR}/external/)
166 include_directories (${SUPERTUX_SOURCE_DIR}/external/obstack/)
167
168 ## Build list of sources for supertux binary
169
170 FILE(GLOB SUPERTUX_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/*.cpp src/*/*.cpp src/video/sdl/*.cpp external/obstack/*.c external/tinygettext/*.cpp)
171
172 IF(HAVE_OPENGL)
173   FILE(GLOB SUPERTUX_OPENGL_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/video/gl/*.cpp)
174   SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${SUPERTUX_OPENGL_SOURCES})
175 ENDIF(HAVE_OPENGL)
176
177 ## Precompile "a few" headers in GCC
178 OPTION(PRECOMPILE_HEADERS "Precompile headers (experimental)" OFF)
179 IF(PRECOMPILE_HEADERS)
180   FILE(GLOB PRECOMPILED_HEADERS RELATIVE ${SUPERTUX_SOURCE_DIR} src/badguy/badguy.hpp
181            src/scripting/wrapper.hpp src/video/*.hpp src/math/*.hpp)
182   FILE(WRITE ${SUPERTUX_BINARY_DIR}/precompile.hh "// Precompiled headers\n")
183   FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#ifndef __SUPERTUX_PRECOMPILED_HEADER\n")
184   FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#define __SUPERTUX_PRECOMPILED_HEADER\n")
185   FOREACH(PRECOMPILED_HEADER ${PRECOMPILED_HEADERS})
186     FILE(RELATIVE_PATH PRECOMPILED_HEADER ${SUPERTUX_SOURCE_DIR}/src "${SUPERTUX_SOURCE_DIR}/${PRECOMPILED_HEADER}")
187     FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#include \"${PRECOMPILED_HEADER}\"\n")
188   ENDFOREACH(PRECOMPILED_HEADER)
189   FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#endif /*__SUPERTUX_PRECOMPILED_HEADER*/\n")
190   ADD_CUSTOM_COMMAND(
191     OUTPUT ${SUPERTUX_BINARY_DIR}/precompile.hh.gch
192     COMMAND ${CMAKE_CXX_COMPILER} -x "c++-header" $(CXX_FLAGS) ${SUPERTUX_BINARY_DIR}/precompile.hh
193     DEPENDS ${PRECOMPILED_HEADERS}
194     COMMENT "Building precompiled header..."
195   )
196   ## Make certain it is built
197   SET(SUPERTUX_SOURCES ${SUPERTUX_BINARY_DIR}/precompile.hh.gch ${SUPERTUX_SOURCES})
198   SET(CMAKE_CXX_FLAGS "-include ${SUPERTUX_BINARY_DIR}/precompile.hh" ${CMAKE_CXX_FLAGS})
199 ELSE(PRECOMPILE_HEADERS)
200   IF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh)
201     FILE(REMOVE ${SUPERTUX_BINARY_DIR}/precompile.hh)
202   ENDIF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh)
203   IF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh.gch)
204     FILE(REMOVE ${SUPERTUX_BINARY_DIR}/precompile.hh.gch)
205   ENDIF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh.gch)
206 ENDIF(PRECOMPILE_HEADERS)
207
208
209 ## Debug options
210
211 OPTION(DEBUG "Build with debugging options" ON)
212 OPTION(WERROR "Stop on first compiler warning" ON)
213 IF(CMAKE_COMPILER_IS_GNUCC)
214   ADD_DEFINITIONS(-Wall -Wextra -W)
215   IF (DEBUG)
216     REMOVE_DEFINITIONS(-O2)
217     ADD_DEFINITIONS(-O0 -g)
218   ELSE (DEBUG)
219     ADD_DEFINITIONS(-O2)
220     REMOVE_DEFINITIONS(-O0 -g)
221   ENDIF (DEBUG)
222   SET(CMAKE_CXX_FLAGS_PROFILE "-pg")
223   SET(CMAKE_C_FLAGS_PROFILE "-pg")
224   SET(CMAKE_LD_FLAGS_PROFILE "-pg")
225   IF(WERROR)
226     ADD_DEFINITIONS(-Werror)
227   ELSE(WERROR)
228     REMOVE_DEFINITIONS(-Werror)
229   ENDIF(WERROR)
230 ENDIF(CMAKE_COMPILER_IS_GNUCC)
231
232 ## Add in squirrel debug stuff
233
234 OPTION(ENABLE_SQDBG "Build squirrel script interpreter with debugging options" OFF)
235 IF(ENABLE_SQDBG)
236   include_directories (${SUPERTUX_SOURCE_DIR}/external/squirrel/)
237   FILE(GLOB SQDBG_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} external/squirrel/sqdbg/*.cpp)
238   SET(SUPERTUX_SOURCES ${SQDBG_SOURCES} ${SUPERTUX_SOURCES})
239 ENDIF(ENABLE_SQDBG)
240
241 ## Build miniswig and generate miniswig wrapper
242
243 OPTION(GENERATE_WRAPPER "Build miniswig and generate the wrapper" ${DEBUG})
244 IF(GENERATE_WRAPPER)
245   ADD_SUBDIRECTORY(tools/miniswig)
246   ADD_CUSTOM_COMMAND(
247     OUTPUT ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.hpp
248     COMMAND cd ${SUPERTUX_SOURCE_DIR} && ${CMAKE_CXX_COMPILER}
249     ARGS -x "c++" -E -CC -DSCRIPTING_API src/scripting/wrapper.interface.hpp -o ${SUPERTUX_BINARY_DIR}/miniswig.tmp -I${SUPERTUX_SOURCE_DIR}/src
250     COMMAND tools/miniswig/miniswig
251     ARGS --input miniswig.tmp --output-cpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp --output-hpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.hpp --module supertux --select-namespace Scripting
252     DEPENDS tools/miniswig/miniswig
253     IMPLICIT_DEPENDS CXX ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.interface.hpp
254   )
255 ENDIF(GENERATE_WRAPPER)
256
257 IF(NOT EXISTS ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp)
258   SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp)
259 ENDIF(NOT EXISTS ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp)
260
261 ## If xgettext is available, generate messages.pot for sources
262
263 OPTION(GENERATE_MESSAGESPOT "Generate messages.pot files" ${DEBUG})
264 IF(GENERATE_MESSAGESPOT)
265   MARK_AS_ADVANCED(
266     XGETTEXT_EXECUTABLE
267   )
268   FIND_PROGRAM(XGETTEXT_EXECUTABLE xgettext)
269   IF(NOT XGETTEXT_EXECUTABLE)
270     MESSAGE(STATUS "Warning: xgettext not found - will not update messages.pot")
271   ELSE(NOT XGETTEXT_EXECUTABLE)
272     MESSAGE(STATUS "Found xgettext: ${XGETTEXT_EXECUTABLE}")
273
274     SET(MESSAGES_POT_FILE ${SUPERTUX_SOURCE_DIR}/data/locale/messages.pot)
275     ADD_CUSTOM_COMMAND(
276       OUTPUT ${MESSAGES_POT_FILE}
277       COMMAND ${XGETTEXT_EXECUTABLE}
278       ARGS --keyword=_ --language=C++ --output=${MESSAGES_POT_FILE} ${SUPERTUX_SOURCES}
279       DEPENDS ${SUPERTUX_SOURCES}
280       WORKING_DIRECTORY ${SUPERTUX_SOURCE_DIR}
281       COMMENT "Generating POT file ${MESSAGES_POT_FILE}"
282     )
283     LIST(APPEND MESSAGES_POT_FILES ${MESSAGES_POT_FILE})
284
285     FILE(GLOB SUPERTUX_LEVEL_DIRS RELATIVE ${SUPERTUX_SOURCE_DIR} data/levels/*)
286     LIST(REMOVE_ITEM SUPERTUX_LEVEL_DIRS "data/levels/.svn")
287     FOREACH(SUPERTUX_LEVEL_DIR ${SUPERTUX_LEVEL_DIRS})
288       FILE(GLOB SUPERTUX_LEVELS RELATIVE ${SUPERTUX_SOURCE_DIR} ${SUPERTUX_LEVEL_DIR}/*.stl ${SUPERTUX_LEVEL_DIR}/*.stwm ${SUPERTUX_LEVEL_DIR}/*.txt)
289
290       ## Do not add target if SUPERTUX_LEVELS is empty. This is needed for cmake <=2.4
291       IF(SUPERTUX_LEVELS)
292       SET(MESSAGES_POT_FILE ${SUPERTUX_SOURCE_DIR}/${SUPERTUX_LEVEL_DIR}/messages.pot)
293       ADD_CUSTOM_COMMAND(
294         OUTPUT ${MESSAGES_POT_FILE}
295         COMMAND ${XGETTEXT_EXECUTABLE}
296         ARGS --keyword="_:1" --language=Lisp --force-po --sort-by-file "--output=${MESSAGES_POT_FILE}" ${SUPERTUX_LEVELS}
297         DEPENDS ${SUPERTUX_LEVELS}
298         WORKING_DIRECTORY ${SUPERTUX_SOURCE_DIR}
299         COMMENT "Generating POT file ${MESSAGES_POT_FILE}"
300       )
301       LIST(APPEND MESSAGES_POT_FILES ${MESSAGES_POT_FILE})
302       ENDIF(SUPERTUX_LEVELS)
303
304     ENDFOREACH(SUPERTUX_LEVEL_DIR)
305
306     ADD_CUSTOM_TARGET(
307       supertux2-messages ALL 
308       DEPENDS ${MESSAGES_POT_FILES}
309     )
310
311   ENDIF(NOT XGETTEXT_EXECUTABLE)
312 ENDIF(GENERATE_MESSAGESPOT)
313
314 ## Some additional compiler switches
315 IF(CMAKE_COMPILER_IS_GNUCC)
316   ADD_DEFINITIONS(-fno-strict-aliasing)
317 ENDIF(CMAKE_COMPILER_IS_GNUCC)
318
319 IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
320   ADD_DEFINITIONS(-DMACOSX)
321 ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
322
323
324 ## On Windows, add an icon
325
326 IF(WIN32)
327   SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.rc)
328   IF(MINGW)
329     ADD_CUSTOM_COMMAND(
330     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o
331     COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons -i${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.rc -o ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o)
332     SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o)
333   ELSE(MINGW)
334     SET(SUPERTUX_EXE_SRCS ${SUPERTUX_EXE_SRCS} supertux.rc)
335   ENDIF(MINGW)
336 ENDIF(WIN32)
337
338 ## Add binreloc.c if enabled
339 IF(ENABLE_BINRELOC)
340   SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${SUPERTUX_SOURCE_DIR}/external/binreloc/binreloc.c)
341 ENDIF(ENABLE_BINRELOC)
342
343
344 ## Generate supertux executable in the right place
345
346 SET(EXECUTABLE_OUTPUT_PATH ${SUPERTUX_SOURCE_DIR})
347
348 ## Add target for supertux binary
349
350 ADD_EXECUTABLE(supertux2 ${SUPERTUX_SOURCES})
351
352 ## Link supertux binary with squirrel and other libraries
353
354 TARGET_LINK_LIBRARIES(supertux2 squirrel)
355 TARGET_LINK_LIBRARIES(supertux2 ${SDL_LIBRARY})
356 TARGET_LINK_LIBRARIES(supertux2 ${SDLIMAGE_LIBRARY})
357 TARGET_LINK_LIBRARIES(supertux2 ${OPENAL_LIBRARY})
358 TARGET_LINK_LIBRARIES(supertux2 ${OGGVORBIS_LIBRARIES})
359 TARGET_LINK_LIBRARIES(supertux2 ${PHYSFS_LIBRARY})
360 IF(HAVE_OPENGL)
361     TARGET_LINK_LIBRARIES(supertux2 ${OPENGL_LIBRARY})
362 ENDIF(HAVE_OPENGL)
363 IF(HAVE_LIBCURL)
364   TARGET_LINK_LIBRARIES(supertux2 ${CURL_LIBRARY})
365 ENDIF(HAVE_LIBCURL)
366
367 # Warnings to add
368 OPTION(WARNINGS "Enable long list of warnings for compiler to check" ON)
369 IF(WARNINGS)
370   SET_PROPERTY(TARGET supertux2 APPEND PROPERTY COMPILE_FLAGS
371 # -ansi fails in MinGW
372 # still left:  -Weffc++ -Wold-style-cast -Wpadded -Wconversion -Wundef -Wsign-conversion -Wshadow -Winline -Wunsafe-loop-optimizations -Wfloat-equal -Wswitch-default -Wswitch-enum -Wcast-qual -Wsign-promo -Woverloaded-virtual -Wmissing-format-attribute -Wstrict-overflow=5 -Wformat=2
373         "-fdiagnostics-show-option -O3 -pedantic -Wno-long-long -Wabi -Wctor-dtor-privacy -Wstrict-null-sentinel -Wcast-align -Wdisabled-optimization -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wredundant-decls -Wstack-protector")
374 ENDIF(WARNINGS)
375
376 ## Install stuff
377
378 IF(WIN32 AND NOT UNIX)
379
380   SET(INSTALL_SUBDIR_BIN ".")
381   SET(INSTALL_SUBDIR_SHARE "data/")
382   SET(INSTALL_SUBDIR_DOC ".")
383
384   INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/SDL.dll
385                 ${SUPERTUX_SOURCE_DIR}/SDL_image.dll
386                 ${SUPERTUX_SOURCE_DIR}/iconv.dll
387                 ${SUPERTUX_SOURCE_DIR}/libogg-0.dll
388                 ${SUPERTUX_SOURCE_DIR}/libphysfs-1-0-0.dll
389                 ${SUPERTUX_SOURCE_DIR}/OpenAl32.dll
390                 ${SUPERTUX_SOURCE_DIR}/wrap_oal.dll
391                 ${SUPERTUX_SOURCE_DIR}/libcurl-4.dll DESTINATION ${INSTALL_SUBDIR_BIN})
392
393   INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.png ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.ico DESTINATION ".")
394
395 ELSE(WIN32 AND NOT UNIX)
396 IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
397
398   SET(INSTALL_SUBDIR_BIN "SuperTux.app/Contents/MacOS/")
399   SET(INSTALL_SUBDIR_SHARE "SuperTux.app/Contents/Resources/data/")
400   SET(INSTALL_SUBDIR_DOC "SuperTux.app/Contents/Resources/")
401
402   INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/tools/darwin/info.plist DESTINATION "SuperTux.app/Contents/")
403
404   INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.png ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.icns DESTINATION "SuperTux.app/Contents/Resources/")
405
406 ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
407
408   SET(INSTALL_SUBDIR_BIN "games/")
409   SET(INSTALL_SUBDIR_SHARE "share/games/supertux2/")
410   SET(INSTALL_SUBDIR_DOC "share/doc/supertux2/")
411
412   INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/supertux2.desktop DESTINATION "share/applications")
413
414   INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.png ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.xpm DESTINATION "share/pixmaps/")
415
416 ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
417 ENDIF(WIN32 AND NOT UNIX)
418
419 INSTALL(TARGETS supertux2 DESTINATION ${INSTALL_SUBDIR_BIN})
420
421 INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/INSTALL ${SUPERTUX_SOURCE_DIR}/README ${SUPERTUX_SOURCE_DIR}/COPYING ${SUPERTUX_SOURCE_DIR}/WHATSNEW.txt DESTINATION ${INSTALL_SUBDIR_DOC})
422
423 INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/credits.txt DESTINATION ${INSTALL_SUBDIR_SHARE})
424
425 INSTALL(DIRECTORY data/images
426                   data/fonts
427                   data/levels
428                   data/music
429                   data/scripts
430                   data/speech
431                   data/sounds
432                   data/locale
433                                DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)
434
435
436 ## CPack/Installation-specific stuff
437
438 INCLUDE(InstallRequiredSystemLibraries)
439 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Jump'n'Run Game featuring Tux")
440 SET(CPACK_PACKAGE_VENDOR "SuperTux Devel Team")
441 SET(CPACK_PACKAGE_CONTACT "SuperTux Devel Team <supertux-devel@lists.lethargik.org>")
442 SET(CPACK_DEBIAN_PACKAGE_NAME "supertux2")
443 SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.5), libgcc1 (>= 1:4.1), libgl1-mesa-glx | libgl1, libogg0 (>= 1.1.3), libopenal0a, libphysfs-1.0-0, libsdl-image1.2 (>= 1.2.5), libsdl1.2debian (>= 1.2.10-1), libstdc++6 (>= 4.1.2), libvorbis0a (>= 1.1.2), libvorbisfile3 (>= 1.1.2), libcurl3 (>= 7.16)")
444 SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Classic 2D jump 'n run sidescroller with Tux\n SuperTux is a classic 2D jump 'n run sidescroller game in a similar\n style like the original SuperMario games. This release of SuperTux\n features 9 enemies, 26 playable levels, software and OpenGL rendering\n modes, configurable joystick and keyboard input, new music and\n completely redone graphics.\n .\n This is a development snapshot of SuperTux. It may suffer from\n critical bugs and has not been fully tested. \n .\n Homepage: http://supertux.lethargik.org/")
445 SET(CPACK_DEBIAN_PACKAGE_SECTION "games")
446 SET(CPACK_RPM_PACKAGE_NAME "supertux2")
447 SET(CPACK_RPM_PACKAGE_DESCRIPTION "Classic 2D jump 'n run sidescroller with Tux\n SuperTux is a classic 2D jump 'n run sidescroller game in a similar\n style like the original SuperMario games. This release of SuperTux\n features 9 enemies, 26 playable levels, software and OpenGL rendering\n modes, configurable joystick and keyboard input, new music and\n completely redone graphics.\n .\n This is a development snapshot of SuperTux. It may suffer from\n critical bugs and has not been fully tested. \n .\n Homepage: http://supertux.lethargik.org/")
448 SET(CPACK_RPM_PACKAGE_LICENSE "GNU General Public License (GPL)")
449 SET(CPACK_RPM_PACKAGE_GROUP "Amusements/Games/Action/Arcade")
450 IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
451   # The OS X PackageMaker doesn't seem to like files with no extension
452 ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
453   SET(CPACK_PACKAGE_DESCRIPTION_FILE "${SUPERTUX_SOURCE_DIR}/README")
454   SET(CPACK_RESOURCE_FILE_LICENSE "${SUPERTUX_SOURCE_DIR}/COPYING")
455 ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
456 SET(CPACK_PACKAGE_VERSION_MAJOR "0")
457 SET(CPACK_PACKAGE_VERSION_MINOR "3")
458 SET(CPACK_PACKAGE_VERSION_PATCH "2-SVN")
459 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "SuperTux ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
460 SET(CPACK_PACKAGE_EXECUTABLES "..\\\\supertux2" "SuperTux ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
461 IF(WIN32 AND NOT UNIX)
462   SET(CPACK_NSIS_INSTALLED_ICON_NAME "..\\\\supertux2")
463   SET(CPACK_NSIS_DISPLAY_NAME "SuperTux ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
464 ELSE(WIN32 AND NOT UNIX)
465 ENDIF(WIN32 AND NOT UNIX)
466 INCLUDE(CPack)
467