2 # SuperTux - root build script
3 # Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
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.
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.
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
25 # Create a directory build/ and change to it. Run
29 # This creates a set of Makefiles to build the project. Run
36 # FIXME: create config.h from config.h.in
37 # FIXME: compile miniswig
38 # FIXME: use miniswig to create squirrel wrappers
39 # FIXME: create messages.pot for levels
40 # FIXME: provide working install target
44 ## (Optional) Generate noisy Makefile
46 #SET(CMAKE_VERBOSE_MAKEFILE on)
48 ## Project name to use as command prefix
52 ## Search here for additional cmake modules (for finding deps)
54 set(CMAKE_MODULE_PATH ${SUPERTUX_SOURCE_DIR}/mk/cmake ${CMAKE_MODULE_PATH})
56 ## Add lots of dependencies to compiler switches
58 FIND_PACKAGE(SDL REQUIRED)
59 INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
60 LINK_LIBRARIES(${SDL_LIBRARY})
62 FIND_PACKAGE(SDL_image REQUIRED)
63 INCLUDE_DIRECTORIES(${SDLIMAGE_INCLUDE_DIR})
64 LINK_LIBRARIES(${SDLIMAGE_LIBRARY})
66 FIND_PACKAGE(OpenGL REQUIRED)
67 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
68 LINK_LIBRARIES(${OPENGL_LIBRARY})
70 FIND_PACKAGE(OpenAL REQUIRED)
71 INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
72 LINK_LIBRARIES(${OPENAL_LIBRARY})
74 FIND_PACKAGE(OggVorbis REQUIRED)
75 INCLUDE_DIRECTORIES(${OGGVORBIS_INCLUDE_DIR})
76 LINK_LIBRARIES(${OGGVORBIS_LIBRARIES})
78 FIND_PACKAGE(PhysFS REQUIRED)
79 INCLUDE_DIRECTORIES(${PHYSFS_INCLUDE_DIR})
80 LINK_LIBRARIES(${PHYSFS_LIBRARY})
82 ## Also execute instructions in src/squirrel/CMakeLists.txt
84 ADD_SUBDIRECTORY(src/squirrel)
86 ## Add squirrel lib dir to search path
88 LINK_DIRECTORIES(src/squirrel)
90 ## Some additional include paths
92 include_directories (${SUPERTUX_SOURCE_DIR}/)
93 include_directories (${SUPERTUX_SOURCE_DIR}/src/)
94 include_directories (${SUPERTUX_SOURCE_DIR}/src/squirrel/include/)
96 ## Build list of sources for supertux binary
98 FILE(GLOB SUPERTUX_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/*.cpp src/audio/*.cpp src/badguy/*.cpp src/binreloc/*.cpp src/control/*.cpp src/gui/*.cpp src/lisp/*.cpp src/math/*.cpp src/object/*.cpp src/physfs/*.cpp src/sprite/*.cpp src/tinygettext/*.cpp src/trigger/*.cpp src/video/*.cpp src/worldmap/*.cpp src/scripting/*.cpp)
100 ## If xgettext is available, generate messages.pot for sources
107 IF(${XGETTEXT} STREQUAL "XGETTEXT-NOTFOUND")
108 MESSAGE(STATUS "Warning: xgettext not found - will not update messages.pot")
109 ELSE(${XGETTEXT} STREQUAL "XGETTEXT-NOTFOUND")
110 MESSAGE(STATUS "Found xgettext: ${XGETTEXT}")
111 SET(MESSAGES_POT_FILE ${SUPERTUX_SOURCE_DIR}/data/locale/messages.pot)
113 supertux-messages.pot ALL
114 COMMAND "/usr/bin/xgettext" -k_ -C -o ${MESSAGES_POT_FILE} ${SUPERTUX_SOURCES}
115 DEPENDS ${SUPERTUX_SOURCES}
116 WORKING_DIRECTORY ${SUPERTUX_SOURCE_DIR}
118 ENDIF(${XGETTEXT} STREQUAL "XGETTEXT-NOTFOUND")
120 ## Some additional compiler switches
122 ADD_DEFINITIONS(-O2 -fno-strict-aliasing)
124 ## Add target for supertux binary
126 ADD_EXECUTABLE(supertux ${SUPERTUX_SOURCES} )
128 ## Link supertux binary with squirrel
130 TARGET_LINK_LIBRARIES(supertux squirrel)
132 ## After building, copy binary to source root
137 COMMAND ${CMAKE_COMMAND}
138 ARGS -E copy supertux ${SUPERTUX_SOURCE_DIR}/supertux