2011-03-27 02:18:56 -06:00
|
|
|
# _________ __ __
|
|
|
|
# / _____// |_____________ _/ |______ ____ __ __ ______
|
|
|
|
# \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
|
|
|
# / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
|
|
|
# /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
|
|
|
# \/ \/ \//_____/ \/
|
|
|
|
# ______________________ ______________________
|
|
|
|
# T H E W A R B E G I N S
|
|
|
|
# Stratagus - A free fantasy real time strategy game engine
|
|
|
|
#
|
|
|
|
# CMakeLists.txt
|
|
|
|
# Copyright (C) 2011 Pali Rohár <pali.rohar@gmail.com>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
2011-03-05 15:36:56 -07:00
|
|
|
project(stratagus)
|
2011-03-25 15:08:04 -06:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
2011-03-27 02:18:56 -06:00
|
|
|
set(STRATAGUS_VERSION 2.2.5.5)
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
# Stratagus sources
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
src/include
|
|
|
|
src/guichan/include
|
|
|
|
src/guichan/include/guichan
|
|
|
|
)
|
|
|
|
|
|
|
|
set(action_SRCS
|
|
|
|
src/action/action_attack.cpp
|
|
|
|
src/action/action_board.cpp
|
|
|
|
src/action/action_build.cpp
|
|
|
|
src/action/action_die.cpp
|
|
|
|
src/action/action_follow.cpp
|
|
|
|
src/action/action_move.cpp
|
|
|
|
src/action/action_patrol.cpp
|
|
|
|
src/action/action_repair.cpp
|
|
|
|
src/action/action_research.cpp
|
|
|
|
src/action/action_resource.cpp
|
|
|
|
src/action/action_returngoods.cpp
|
|
|
|
src/action/actions.cpp
|
|
|
|
src/action/action_spellcast.cpp
|
|
|
|
src/action/action_stand.cpp
|
|
|
|
src/action/action_still.cpp
|
|
|
|
src/action/action_train.cpp
|
|
|
|
src/action/action_unload.cpp
|
|
|
|
src/action/action_upgradeto.cpp
|
|
|
|
src/action/command.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(action FILES ${action_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(ai_SRCS
|
|
|
|
src/ai/ai_building.cpp
|
|
|
|
src/ai/ai.cpp
|
|
|
|
src/ai/ai_force.cpp
|
|
|
|
src/ai/ai_magic.cpp
|
|
|
|
src/ai/ai_plan.cpp
|
|
|
|
src/ai/ai_resource.cpp
|
|
|
|
src/ai/script_ai.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(ai FILES ${ai_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(beos_SRCS
|
|
|
|
src/beos/beos.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(beos FILES ${beos_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(editor_SRCS
|
|
|
|
src/editor/editloop.cpp
|
|
|
|
src/editor/editor.cpp
|
|
|
|
src/editor/edmap.cpp
|
|
|
|
src/editor/script_editor.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(editor FILES ${editor_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(game_SRCS
|
|
|
|
src/game/game.cpp
|
|
|
|
src/game/loadgame.cpp
|
|
|
|
src/game/replay.cpp
|
|
|
|
src/game/savegame.cpp
|
|
|
|
src/game/trigger.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(game FILES ${game_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(guichan_SRCS
|
|
|
|
src/guichan/cliprectangle.cpp
|
|
|
|
src/guichan/color.cpp
|
|
|
|
src/guichan/defaultfont.cpp
|
|
|
|
src/guichan/exception.cpp
|
|
|
|
src/guichan/focushandler.cpp
|
|
|
|
src/guichan/gfont.cpp
|
|
|
|
src/guichan/graphics.cpp
|
|
|
|
src/guichan/gui.cpp
|
|
|
|
src/guichan/guichan.cpp
|
|
|
|
src/guichan/image.cpp
|
|
|
|
src/guichan/imagefont.cpp
|
|
|
|
src/guichan/key.cpp
|
|
|
|
src/guichan/keyinput.cpp
|
|
|
|
src/guichan/mouseinput.cpp
|
|
|
|
# src/guichan/opengl/opengl.cpp
|
|
|
|
# src/guichan/opengl/openglgraphics.cpp
|
|
|
|
# src/guichan/opengl/openglimageloader.cpp
|
|
|
|
src/guichan/rectangle.cpp
|
|
|
|
src/guichan/sdl/gsdl.cpp
|
|
|
|
src/guichan/sdl/sdlgraphics.cpp
|
|
|
|
src/guichan/sdl/sdlimageloader.cpp
|
|
|
|
src/guichan/sdl/sdlinput.cpp
|
|
|
|
src/guichan/widget.cpp
|
|
|
|
src/guichan/widgets/button.cpp
|
|
|
|
src/guichan/widgets/container.cpp
|
|
|
|
src/guichan/widgets/dropdown.cpp
|
|
|
|
src/guichan/widgets/checkbox.cpp
|
|
|
|
src/guichan/widgets/icon.cpp
|
|
|
|
src/guichan/widgets/label.cpp
|
|
|
|
src/guichan/widgets/listbox.cpp
|
|
|
|
src/guichan/widgets/radiobutton.cpp
|
|
|
|
src/guichan/widgets/scrollarea.cpp
|
|
|
|
src/guichan/widgets/slider.cpp
|
|
|
|
src/guichan/widgets/textbox.cpp
|
|
|
|
src/guichan/widgets/textfield.cpp
|
|
|
|
src/guichan/widgets/window.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(guichan FILES ${guichan_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(map_SRCS
|
|
|
|
src/map/map.cpp
|
|
|
|
src/map/map_draw.cpp
|
|
|
|
src/map/map_fog.cpp
|
|
|
|
src/map/map_radar.cpp
|
|
|
|
src/map/map_save.cpp
|
|
|
|
src/map/map_wall.cpp
|
|
|
|
src/map/minimap.cpp
|
|
|
|
src/map/script_map.cpp
|
|
|
|
src/map/script_tileset.cpp
|
|
|
|
src/map/tileset.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(map FILES ${map_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(network_SRCS
|
|
|
|
src/network/commands.cpp
|
|
|
|
src/network/lowlevel.cpp
|
|
|
|
src/network/master.cpp
|
|
|
|
src/network/netconnect.cpp
|
|
|
|
src/network/network.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(network FILES ${network_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(particle_SRCS
|
|
|
|
src/particle/graphicanimation.cpp
|
|
|
|
src/particle/chunkparticle.cpp
|
|
|
|
src/particle/particlemanager.cpp
|
|
|
|
src/particle/smokeparticle.cpp
|
|
|
|
src/particle/staticparticle.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(particle FILES ${particle_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(pathfinder_SRCS
|
|
|
|
src/pathfinder/astar.cpp
|
|
|
|
src/pathfinder/pathfinder.cpp
|
|
|
|
src/pathfinder/script_pathfinder.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(pathfinder FILES ${pathfinder_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(sound_SRCS
|
|
|
|
src/sound/mikmod.cpp
|
|
|
|
src/sound/music.cpp
|
|
|
|
src/sound/ogg.cpp
|
|
|
|
src/sound/script_sound.cpp
|
|
|
|
src/sound/sound.cpp
|
|
|
|
src/sound/sound_id.cpp
|
|
|
|
src/sound/sound_server.cpp
|
|
|
|
src/sound/unitsound.cpp
|
|
|
|
src/sound/wav.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(sound FILES ${sound_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(stratagusmain_SRCS
|
|
|
|
src/stratagus/construct.cpp
|
|
|
|
src/stratagus/groups.cpp
|
|
|
|
src/stratagus/iolib.cpp
|
|
|
|
src/stratagus/luacallback.cpp
|
|
|
|
src/stratagus/mainloop.cpp
|
|
|
|
src/stratagus/missile.cpp
|
|
|
|
src/stratagus/player.cpp
|
|
|
|
src/stratagus/script.cpp
|
|
|
|
src/stratagus/script_missile.cpp
|
|
|
|
src/stratagus/script_player.cpp
|
|
|
|
src/stratagus/script_spell.cpp
|
|
|
|
src/stratagus/selection.cpp
|
|
|
|
src/stratagus/spells.cpp
|
|
|
|
src/stratagus/stratagus.cpp
|
|
|
|
src/stratagus/title.cpp
|
|
|
|
src/stratagus/translate.cpp
|
|
|
|
src/stratagus/util.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(stratagusmain FILES ${stratagus_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(ui_SRCS
|
|
|
|
src/ui/botpanel.cpp
|
|
|
|
src/ui/button_checks.cpp
|
|
|
|
src/ui/icons.cpp
|
|
|
|
src/ui/interface.cpp
|
|
|
|
src/ui/mainscr.cpp
|
|
|
|
src/ui/menu_proc.cpp
|
|
|
|
src/ui/menus.cpp
|
|
|
|
src/ui/mouse.cpp
|
|
|
|
src/ui/script_ui.cpp
|
|
|
|
src/ui/ui.cpp
|
|
|
|
src/ui/widgets.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(ui FILES ${ui_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(unit_SRCS
|
|
|
|
src/unit/build.cpp
|
|
|
|
src/unit/depend.cpp
|
|
|
|
src/unit/script_unit.cpp
|
|
|
|
src/unit/script_unittype.cpp
|
|
|
|
src/unit/unit_cache.cpp
|
|
|
|
src/unit/unit.cpp
|
|
|
|
src/unit/unit_draw.cpp
|
|
|
|
src/unit/unit_find.cpp
|
|
|
|
src/unit/unit_manager.cpp
|
|
|
|
src/unit/unit_save.cpp
|
|
|
|
src/unit/unittype.cpp
|
|
|
|
src/unit/upgrade.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(unit FILES ${unit_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(video_SRCS
|
|
|
|
src/video/cursor.cpp
|
|
|
|
src/video/font.cpp
|
|
|
|
src/video/graphic.cpp
|
|
|
|
src/video/linedraw.cpp
|
|
|
|
src/video/mng.cpp
|
|
|
|
src/video/movie.cpp
|
|
|
|
src/video/png.cpp
|
|
|
|
src/video/sdl.cpp
|
|
|
|
src/video/sprite.cpp
|
|
|
|
src/video/video.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(video FILES ${video_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
set(win32_SRCS
|
2011-03-06 12:38:55 -07:00
|
|
|
src/win32/attachconsole.cpp
|
|
|
|
src/win32/stratagus.rc
|
2011-03-05 15:36:56 -07:00
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(win32 FILES ${win32_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
2011-03-06 10:07:24 -07:00
|
|
|
set(stratagus_SRCS
|
|
|
|
${action_SRCS}
|
|
|
|
${ai_SRCS}
|
|
|
|
${editor_SRCS}
|
|
|
|
${game_SRCS}
|
|
|
|
${guichan_SRCS}
|
|
|
|
${map_SRCS}
|
|
|
|
${network_SRCS}
|
|
|
|
${particle_SRCS}
|
|
|
|
${pathfinder_SRCS}
|
|
|
|
${sound_SRCS}
|
|
|
|
${stratagusmain_SRCS}
|
|
|
|
${ui_SRCS}
|
|
|
|
${unit_SRCS}
|
|
|
|
${video_SRCS}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/tolua.cpp
|
|
|
|
)
|
|
|
|
|
2011-04-01 12:28:36 -06:00
|
|
|
set(stratagus_HDRS
|
|
|
|
src/ai/ai_local.h
|
|
|
|
src/video/intern_video.h
|
|
|
|
src/video/renderer.h
|
|
|
|
src/include/actions.h
|
|
|
|
src/include/ai.h
|
|
|
|
src/include/animation.h
|
|
|
|
src/include/commands.h
|
|
|
|
src/include/construct.h
|
|
|
|
src/include/cursor.h
|
|
|
|
src/include/depend.h
|
|
|
|
src/include/editor.h
|
|
|
|
src/include/font.h
|
|
|
|
src/include/icons.h
|
|
|
|
src/include/interface.h
|
|
|
|
src/include/iocompat.h
|
|
|
|
src/include/iolib.h
|
|
|
|
src/include/luacallback.h
|
|
|
|
src/include/map.h
|
|
|
|
src/include/master.h
|
|
|
|
src/include/menus.h
|
|
|
|
src/include/minimap.h
|
|
|
|
src/include/missile.h
|
|
|
|
src/include/movie.h
|
|
|
|
src/include/myendian.h
|
|
|
|
src/include/netconnect.h
|
|
|
|
src/include/net_lowlevel.h
|
|
|
|
src/include/network.h
|
|
|
|
src/include/particle.h
|
|
|
|
src/include/pathfinder.h
|
|
|
|
src/include/player.h
|
|
|
|
src/include/replay.h
|
|
|
|
src/include/results.h
|
|
|
|
src/include/script.h
|
|
|
|
src/include/script_sound.h
|
|
|
|
src/include/settings.h
|
|
|
|
src/include/sound.h
|
|
|
|
src/include/sound_server.h
|
|
|
|
src/include/spells.h
|
|
|
|
src/include/stratagus.h
|
|
|
|
src/include/tile.h
|
|
|
|
src/include/tileset.h
|
|
|
|
src/include/title.h
|
|
|
|
src/include/translate.h
|
|
|
|
src/include/trigger.h
|
|
|
|
src/include/ui.h
|
|
|
|
src/include/unit_cache.h
|
|
|
|
src/include/unit.h
|
|
|
|
src/include/unit_manager.h
|
|
|
|
src/include/unitsound.h
|
|
|
|
src/include/unittype.h
|
|
|
|
src/include/upgrade.h
|
|
|
|
src/include/upgrade_structs.h
|
|
|
|
src/include/util.h
|
|
|
|
src/include/vec2i.h
|
|
|
|
src/include/version.h
|
|
|
|
src/include/video.h
|
|
|
|
src/include/wav.h
|
|
|
|
src/include/widgets.h
|
|
|
|
src/guichan/include/guichan/actionlistener.h
|
|
|
|
src/guichan/include/guichan/allegro.h
|
|
|
|
src/guichan/include/guichan/basiccontainer.h
|
|
|
|
src/guichan/include/guichan/cliprectangle.h
|
|
|
|
src/guichan/include/guichan/color.h
|
|
|
|
src/guichan/include/guichan/defaultfont.h
|
|
|
|
src/guichan/include/guichan/exception.h
|
|
|
|
src/guichan/include/guichan/focushandler.h
|
|
|
|
src/guichan/include/guichan/font.h
|
|
|
|
src/guichan/include/guichan/graphics.h
|
|
|
|
src/guichan/include/guichan/gsdl.h
|
|
|
|
src/guichan/include/guichan/gui.h
|
|
|
|
src/guichan/include/guichan.h
|
|
|
|
src/guichan/include/guichan/imagefont.h
|
|
|
|
src/guichan/include/guichan/image.h
|
|
|
|
src/guichan/include/guichan/imageloader.h
|
|
|
|
src/guichan/include/guichan/input.h
|
|
|
|
src/guichan/include/guichan/key.h
|
|
|
|
src/guichan/include/guichan/keyinput.h
|
|
|
|
src/guichan/include/guichan/keylistener.h
|
|
|
|
src/guichan/include/guichan/listmodel.h
|
|
|
|
src/guichan/include/guichan/mouseinput.h
|
|
|
|
src/guichan/include/guichan/mouselistener.h
|
|
|
|
src/guichan/include/guichan/platform.h
|
|
|
|
src/guichan/include/guichan/rectangle.h
|
|
|
|
src/guichan/include/guichan/sdl/sdlgraphics.h
|
|
|
|
src/guichan/include/guichan/sdl/sdlimageloader.h
|
|
|
|
src/guichan/include/guichan/sdl/sdlinput.h
|
|
|
|
src/guichan/include/guichan/sdl/sdlpixel.h
|
|
|
|
src/guichan/include/guichan/widget.h
|
|
|
|
src/guichan/include/guichan/widgets/button.h
|
|
|
|
src/guichan/include/guichan/widgets/container.h
|
|
|
|
src/guichan/include/guichan/widgets/dropdown.h
|
|
|
|
src/guichan/include/guichan/widgets/checkbox.h
|
|
|
|
src/guichan/include/guichan/widgets/icon.h
|
|
|
|
src/guichan/include/guichan/widgets/label.h
|
|
|
|
src/guichan/include/guichan/widgets/listbox.h
|
|
|
|
src/guichan/include/guichan/widgets/radiobutton.h
|
|
|
|
src/guichan/include/guichan/widgets/scrollarea.h
|
|
|
|
src/guichan/include/guichan/widgets/slider.h
|
|
|
|
src/guichan/include/guichan/widgets/textbox.h
|
|
|
|
src/guichan/include/guichan/widgets/textfield.h
|
|
|
|
src/guichan/include/guichan/widgets/window.h
|
|
|
|
src/guichan/include/guichan/x.h
|
|
|
|
)
|
|
|
|
source_group(include FILES ${stratagus_HDRS})
|
|
|
|
|
2011-03-06 10:07:24 -07:00
|
|
|
# Additional platform checks
|
|
|
|
|
|
|
|
if(UNIX AND CMAKE_SYSTEM_NAME MATCHES BSD)
|
|
|
|
set(BSD true)
|
|
|
|
endif()
|
|
|
|
|
2011-03-27 03:00:14 -06:00
|
|
|
find_package(PkgConfig QUIET REQUIRED)
|
|
|
|
|
|
|
|
# Check if platform is Maemo
|
|
|
|
if(UNIX AND CMAKE_SYSTEM_NAME MATCHES Linux)
|
|
|
|
pkg_check_modules(MAEMO_VERSION maemo-version)
|
|
|
|
if(MAEMO_VERSION_FOUND)
|
|
|
|
set(MAEMO true)
|
|
|
|
endif()
|
2011-03-06 10:07:24 -07:00
|
|
|
endif()
|
|
|
|
|
2011-03-05 15:36:56 -07:00
|
|
|
# Find all libraries
|
|
|
|
|
2011-03-06 10:07:24 -07:00
|
|
|
option(ENABLE_STATIC "Compile Stratagus as static executable" OFF)
|
|
|
|
|
|
|
|
if(ENABLE_STATIC)
|
|
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.a")
|
|
|
|
endif()
|
|
|
|
|
2011-03-05 15:36:56 -07:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
|
|
|
|
|
|
|
find_package(Lua51 REQUIRED)
|
|
|
|
find_package(PNG REQUIRED)
|
|
|
|
find_package(SDL REQUIRED)
|
|
|
|
find_package(Tolua++ REQUIRED)
|
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
|
2011-03-06 10:07:24 -07:00
|
|
|
if(MAEMO)
|
2011-03-27 03:00:14 -06:00
|
|
|
pkg_check_modules(LIBOSSO REQUIRED libosso)
|
|
|
|
else()
|
|
|
|
pkg_check_modules(LIBOSSO libosso)
|
2011-03-06 10:07:24 -07:00
|
|
|
endif()
|
|
|
|
|
2011-04-02 02:32:11 -06:00
|
|
|
if(WIN32)
|
|
|
|
find_package(MakeNSIS)
|
|
|
|
endif()
|
|
|
|
|
2011-03-05 15:36:56 -07:00
|
|
|
find_package(BZip2)
|
|
|
|
find_package(Mikmod)
|
|
|
|
find_package(MNG)
|
|
|
|
find_package(OggVorbis)
|
|
|
|
find_package(Theora)
|
|
|
|
|
|
|
|
find_package(X11)
|
|
|
|
find_package(OpenGL)
|
|
|
|
find_package(OpenGLES)
|
|
|
|
find_package(SDL_gles)
|
|
|
|
|
|
|
|
find_package(Sqlite)
|
2011-03-26 16:30:14 -06:00
|
|
|
find_package(Doxygen)
|
2011-03-27 02:18:56 -06:00
|
|
|
find_package(SelfPackers)
|
2011-03-05 15:36:56 -07:00
|
|
|
|
2011-03-06 10:07:24 -07:00
|
|
|
include(CheckFunctionExists)
|
2011-03-05 15:36:56 -07:00
|
|
|
|
2011-04-02 02:32:11 -06:00
|
|
|
# Windows RC compiler definitions
|
|
|
|
|
2011-03-06 12:18:05 -07:00
|
|
|
if(WIN32)
|
|
|
|
enable_language(RC)
|
|
|
|
include(CMakeDetermineRCCompiler)
|
2011-03-05 15:36:56 -07:00
|
|
|
|
2011-03-06 12:18:05 -07:00
|
|
|
if(MINGW)
|
|
|
|
set(CMAKE_RC_COMPILER_INIT windres)
|
|
|
|
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
|
|
|
endif()
|
2011-03-05 15:36:56 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Options for compiling
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
option(ENABLE_STDIO_REDIRECT "Redirect Stratagus console output to files on Windows" OFF)
|
2011-04-01 12:47:26 -06:00
|
|
|
option(ENABLE_NSIS "Create Stratagus Window NSIS Installer" OFF)
|
2011-03-05 15:36:56 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#option(ENABLE_TOUCHSCREEN "Use touchscreen input" ON)
|
|
|
|
|
|
|
|
option(WITH_BZIP2 "Compile Stratagus with BZip2 compression support" ON)
|
|
|
|
option(WITH_MIKMOD "Compile Stratagus with Mikmod sound library" ON)
|
|
|
|
option(WITH_MNG "Compile Stratagus with MNG image library" ON)
|
|
|
|
option(WITH_OGGVORBIS "Compile Stratagus with OGG/Vorbis sound library" ON)
|
|
|
|
option(WITH_THEORA "Compile Stratagus with Theroa video library" ON)
|
|
|
|
|
2011-04-01 12:47:26 -06:00
|
|
|
option(WITH_X11 "Compile Stratagus with X11 clipboard pasting support" ON)
|
2011-03-27 02:18:56 -06:00
|
|
|
#option(WITH_OPENGL "Compile Stratagus with OpenGL rendering support" ON)
|
2011-03-05 15:36:56 -07:00
|
|
|
option(WITH_OPENGLES "Compile Stratagus with OpenGL ES 1.1 rendering support instead OpenGL" OFF)
|
|
|
|
|
2011-03-26 16:30:14 -06:00
|
|
|
option(ENABLE_DOC "Generate Stratagus source code documentation with Doxygen" ON)
|
2011-03-27 02:18:56 -06:00
|
|
|
option(ENABLE_UPX "Compress Stratagus executable binary with UPX packer" OFF)
|
2011-03-26 16:30:14 -06:00
|
|
|
|
2011-03-05 15:36:56 -07:00
|
|
|
# Stratagus definitions
|
|
|
|
|
|
|
|
add_definitions(${PNG_DEFINITIONS} -DUSE_ZLIB)
|
2011-03-27 03:00:14 -06:00
|
|
|
include_directories(${LIBOSSO_INCLUDE_DIRS} ${LUA_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ${TOLUA++_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
|
|
|
|
set(stratagus_LIBS ${LIBOSSO_LIBRARIES} ${stratagus_LIBS} ${LUA_LIBRARIES} ${PNG_LIBRARIES} ${SDL_LIBRARY} ${TOLUA++_LIBRARY} ${ZLIB_LIBRARIES})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
if(WIN32 AND NOT ENABLE_STDIO_REDIRECT)
|
|
|
|
add_definitions(-DNO_STDIO_REDIRECT)
|
|
|
|
endif()
|
|
|
|
|
2011-03-25 15:08:04 -06:00
|
|
|
# OpenGL ES 1.1 Maemo hack
|
|
|
|
if(MAEMO)
|
|
|
|
set(WITH_OPENGLES ON)
|
|
|
|
endif()
|
|
|
|
|
2011-03-05 15:36:56 -07:00
|
|
|
# TODO: Add support for touchscreen input (not only for MAEMO)
|
|
|
|
#if(ENABLE_TOUCHSCREEN)
|
|
|
|
#
|
|
|
|
#endif()
|
|
|
|
|
|
|
|
if(WITH_BZIP2 AND BZIP2_FOUND)
|
|
|
|
add_definitions(-DUSE_BZ2LIB ${BZIP2_DEFINITIONS})
|
|
|
|
include_directories(${BZIP2_INCLUDE_DIR})
|
|
|
|
set(stratagus_LIBS ${stratagus_LIBS} ${BZIP2_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_MIKMOD AND MIKMOD_FOUND)
|
|
|
|
add_definitions(-DUSE_MIKMOD ${MIKMOD_DEFINITIONS})
|
|
|
|
include_directories(${MIKMOD_INCLUDE_DIR})
|
|
|
|
set(stratagus_LIBS ${stratagus_LIBS} ${MIKMOD_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_MNG AND MNG_FOUND)
|
|
|
|
add_definitions(-DUSE_MNG)
|
|
|
|
include_directories(${MNG_INCLUDE_DIR})
|
|
|
|
set(stratagus_LIBS ${stratagus_LIBS} ${MNG_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_OGGVORBIS AND OGGVORBIS_FOUND)
|
|
|
|
add_definitions(-DUSE_VORBIS)
|
|
|
|
include_directories(${OGGVORBIS_INCLUDE_DIR})
|
2011-03-06 10:07:24 -07:00
|
|
|
set(stratagus_LIBS ${stratagus_LIBS} ${OGG_LIBRARY} ${VORBIS_LIBRARY})
|
2011-03-05 15:36:56 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_THEORA AND THEORA_FOUND)
|
|
|
|
add_definitions(-DUSE_THEORA)
|
|
|
|
include_directories(${THEORA_INCLUDE_DIR})
|
|
|
|
set(stratagus_LIBS ${stratagus_LIBS} ${THEORA_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
2011-04-01 12:47:26 -06:00
|
|
|
if(WITH_X11 AND X11_FOUND)
|
2011-03-05 15:36:56 -07:00
|
|
|
add_definitions(-DHAVE_X11)
|
|
|
|
include_directories(${X11_INCLUDE_DIR})
|
|
|
|
set(stratagus_LIBS ${stratagus_LIBS} ${X11_X11_LIB})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# TODO: Add OpenGL support optional
|
|
|
|
#if(WITH_OPENGL AND OPENGL_FOUND)
|
|
|
|
if(NOT WITH_OPENGLES)
|
|
|
|
# add_definitions(-DUSE_OPENGL)
|
|
|
|
include_directories(${OPENGL_INCLUDE_DIR})
|
|
|
|
set(stratagus_LIBS ${stratagus_LIBS} ${OPENGL_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# TODO: Add OpenGL ES 1.1 support together with OpengL
|
|
|
|
if(WITH_OPENGLES AND OPENGLES_FOUND AND SDLGLES_FOUND)
|
|
|
|
add_definitions(-DUSE_GLES)
|
|
|
|
include_directories(${OPENGLES_INCLUDE_DIR} ${SDLGLES_INCLUDE_DIR})
|
|
|
|
set(stratagus_LIBS ${stratagus_LIBS} ${OPENGLES_LIBRARIES} ${SDLGLES_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
2011-03-06 10:07:24 -07:00
|
|
|
# Platform definitions
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
if(WIN32)
|
2011-03-06 10:07:24 -07:00
|
|
|
add_definitions(-DUSE_WIN32)
|
2011-03-05 15:36:56 -07:00
|
|
|
set(stratagus_SRCS ${stratagus_SRCS} ${win32_SRCS})
|
2011-03-06 10:07:24 -07:00
|
|
|
set(stratagus_LIBS ${stratagus_LIBS} dsound dxguid winmm ws2_32)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
add_definitions(-DUSE_MAC)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BSD)
|
2011-03-26 16:32:47 -06:00
|
|
|
add_definitions(-DUSE_BSD)
|
2011-03-05 15:36:56 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BEOS)
|
2011-03-06 10:07:24 -07:00
|
|
|
add_definitions(-DUSE_BEOS)
|
2011-03-05 15:36:56 -07:00
|
|
|
set(stratagus_SRCS ${stratagus_SRCS} ${beos_SRCS})
|
|
|
|
endif()
|
|
|
|
|
2011-03-06 10:07:24 -07:00
|
|
|
if(MAEMO)
|
|
|
|
add_definitions(-DUSE_MAEMO)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_function_exists("strcasestr" HAVE_STRCASESTR)
|
|
|
|
check_function_exists("strnlen" HAVE_STRNLEN)
|
|
|
|
|
|
|
|
if(HAVE_STRCASESTR)
|
|
|
|
add_definitions(-DHAVE_STRCASESTR)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_STRNLEN)
|
|
|
|
add_definitions(-DHAVE_STRNLEN)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
|
|
|
|
2011-03-27 03:50:36 -06:00
|
|
|
# Print compile info
|
|
|
|
|
|
|
|
message("==================================")
|
|
|
|
|
|
|
|
macro(log_package PACKAGE_NAME PACKAGE)
|
2011-04-01 12:47:26 -06:00
|
|
|
if(NOT WITH_${PACKAGE})
|
|
|
|
message("${PACKAGE_NAME}: Disabled (Enable by param -DWITH_${PACKAGE}=ON)")
|
2011-03-27 03:50:36 -06:00
|
|
|
elseif(WITH_${PACKAGE} AND ${PACKAGE}_FOUND)
|
2011-04-01 12:47:26 -06:00
|
|
|
message("${PACKAGE_NAME}: Found")
|
2011-03-27 03:50:36 -06:00
|
|
|
else()
|
2011-04-01 12:47:26 -06:00
|
|
|
message("${PACKAGE_NAME}: Not Found")
|
2011-03-27 03:50:36 -06:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2011-03-29 02:57:49 -06:00
|
|
|
message("Debug mode: Yes")
|
2011-03-27 03:50:36 -06:00
|
|
|
else()
|
2011-03-29 02:57:49 -06:00
|
|
|
message("Debug mode: No")
|
2011-03-27 03:50:36 -06:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_STATIC)
|
|
|
|
message("Static linking: Yes")
|
|
|
|
else()
|
|
|
|
message("Static linking: No")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
message("Platform: Window")
|
|
|
|
elseif(APPLE)
|
|
|
|
message("Platform: Mac")
|
|
|
|
elseif(BSD)
|
|
|
|
message("Platform: BSD")
|
|
|
|
elseif(BEOS)
|
|
|
|
message("Platform: BEOS")
|
|
|
|
elseif(MAEMO)
|
|
|
|
message("Platform: Maemo")
|
|
|
|
else()
|
|
|
|
message("Platform: Other")
|
|
|
|
endif()
|
|
|
|
|
2011-04-01 12:47:26 -06:00
|
|
|
if(WIN32 AND ENABLE_STDIO_REDIRECT)
|
2011-03-27 03:50:36 -06:00
|
|
|
message("Stdio redirect: Yes")
|
|
|
|
else()
|
|
|
|
message("Stdio redirect: No")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_DOC AND DOXYGEN_FOUND)
|
|
|
|
message("Doxygen documentation: Yes")
|
|
|
|
else()
|
|
|
|
message("Doxygen documentation: No")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_UPX AND SELF_PACKER_FOR_EXECUTABLE)
|
|
|
|
message("Upx packer: Yes")
|
|
|
|
else()
|
|
|
|
message("Upx packer: No")
|
|
|
|
endif()
|
|
|
|
|
2011-04-01 12:47:26 -06:00
|
|
|
if(WIN32 AND ENABLE_NSIS AND MAKENSIS_FOUND)
|
2011-03-27 03:50:36 -06:00
|
|
|
message("NSIS Installer: Yes")
|
2011-04-01 12:47:26 -06:00
|
|
|
elseif(NOT WIN32)
|
|
|
|
message("NSIS Installer: Unsupported on this platform")
|
2011-03-27 03:50:36 -06:00
|
|
|
else()
|
|
|
|
message("NSIS Installer: No")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
log_package("Bzip2" "BZIP2")
|
|
|
|
log_package("MikMod" "MIKMOD")
|
|
|
|
log_package("Mng" "MNG")
|
|
|
|
log_package("Ogg/Vorbis" "OGGVORBIS")
|
|
|
|
log_package("Theora" "THEORA")
|
|
|
|
log_package("LibOSSO" "LIBOSSO")
|
2011-04-01 12:47:26 -06:00
|
|
|
log_package("X11" "X11")
|
|
|
|
#log_package("OpenGL" "OPENGL")
|
2011-03-27 03:50:36 -06:00
|
|
|
|
2011-04-01 12:47:26 -06:00
|
|
|
if(NOT WITH_OPENGLES)
|
|
|
|
message("OpenGL ES 1.1 (instead OpenGL): Disabled (Enable by param -DWITH_OPENGLES=ON)")
|
2011-03-27 03:50:36 -06:00
|
|
|
elseif(WITH_OPENGLES AND OPENGLES_FOUND AND SDLGLES_FOUND)
|
2011-04-01 12:47:26 -06:00
|
|
|
message("OpenGL ES 1.1 (instead OpenGL): Found")
|
2011-03-27 03:50:36 -06:00
|
|
|
else()
|
2011-04-01 12:47:26 -06:00
|
|
|
message("OpenGL ES 1.1 (instead OpenGL): Not Found")
|
2011-03-27 03:50:36 -06:00
|
|
|
endif()
|
|
|
|
|
|
|
|
message("==================================")
|
|
|
|
|
2011-03-06 10:07:24 -07:00
|
|
|
# Compile Stratagus
|
|
|
|
|
2011-03-27 02:18:56 -06:00
|
|
|
add_custom_command(OUTPUT tolua.cpp
|
|
|
|
COMMAND ${TOLUA++_APP} ARGS -L stratagus.lua -o ${CMAKE_CURRENT_BINARY_DIR}/tolua.cpp stratagus.pkg
|
|
|
|
DEPENDS src/tolua/*.pkg
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/tolua
|
|
|
|
)
|
|
|
|
|
2011-04-01 12:28:36 -06:00
|
|
|
add_executable(stratagus WIN32 ${stratagus_SRCS} ${stratagus_HDRS})
|
2011-03-05 15:36:56 -07:00
|
|
|
target_link_libraries(stratagus ${stratagus_LIBS})
|
|
|
|
|
2011-03-27 02:18:56 -06:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
set_target_properties(stratagus PROPERTIES OUTPUT_NAME stratagus-dbg)
|
|
|
|
endif()
|
|
|
|
|
2011-04-01 12:47:26 -06:00
|
|
|
if(WIN32 AND MINGW AND ENABLE_STATIC)
|
2011-03-06 10:07:24 -07:00
|
|
|
set_target_properties(stratagus PROPERTIES LINK_FLAGS "${LINK_FLAGS} -static-libgcc")
|
|
|
|
endif()
|
|
|
|
|
2011-03-05 15:36:56 -07:00
|
|
|
########### next target ###############
|
|
|
|
|
|
|
|
set(metaserver_SRCS
|
2011-03-29 02:57:49 -06:00
|
|
|
metaserver/cmd.cpp
|
|
|
|
metaserver/db.cpp
|
|
|
|
metaserver/games.cpp
|
|
|
|
metaserver/main.cpp
|
|
|
|
metaserver/netdriver.cpp
|
2011-03-05 15:36:56 -07:00
|
|
|
src/network/lowlevel.cpp
|
|
|
|
)
|
|
|
|
|
2011-04-01 12:28:36 -06:00
|
|
|
set(metaserver_HDRS
|
|
|
|
metaserver/cmd.h
|
|
|
|
metaserver/db.h
|
|
|
|
metaserver/games.h
|
|
|
|
metaserver/netdriver.h
|
|
|
|
)
|
|
|
|
|
|
|
|
source_group(metaserver FILES ${metaserver_SRCS} ${metaserver_HDRS})
|
|
|
|
|
2011-03-05 15:36:56 -07:00
|
|
|
if(SQLITE_FOUND)
|
2011-04-01 12:28:36 -06:00
|
|
|
add_executable(metaserver ${metaserver_SRCS} ${metaserver_HDRS})
|
2011-03-05 15:36:56 -07:00
|
|
|
target_link_libraries(metaserver ${SDL_LIBRARY} ${SQLITE_LIBRARIES})
|
2011-03-06 10:07:24 -07:00
|
|
|
|
2011-04-01 12:47:26 -06:00
|
|
|
if(WIN32 AND MINGW AND ENABLE_STATIC)
|
2011-03-06 10:07:24 -07:00
|
|
|
set_target_properties(metaserver PROPERTIES LINK_FLAGS "${LINK_FLAGS} -static-libgcc")
|
|
|
|
endif()
|
2011-03-05 15:36:56 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
########### next target ###############
|
|
|
|
|
|
|
|
set(png2stratagus_SRCS
|
|
|
|
tools/png2stratagus.cpp
|
|
|
|
)
|
2011-04-01 12:28:36 -06:00
|
|
|
source_group(png2stratagus FILES ${png2stratagus_SRCS})
|
2011-03-05 15:36:56 -07:00
|
|
|
|
|
|
|
add_executable(png2stratagus ${png2stratagus_SRCS})
|
2011-03-06 10:07:24 -07:00
|
|
|
target_link_libraries(png2stratagus ${PNG_LIBRARY} ${ZLIB_LIBRARIES})
|
|
|
|
|
2011-04-01 12:47:26 -06:00
|
|
|
if(WIN32 AND MINGW AND ENABLE_STATIC)
|
2011-03-06 10:07:24 -07:00
|
|
|
set_target_properties(png2stratagus PROPERTIES LINK_FLAGS "${LINK_FLAGS} -static-libgcc")
|
|
|
|
endif()
|
2011-03-05 15:36:56 -07:00
|
|
|
|
2011-03-26 16:30:14 -06:00
|
|
|
########### next target ###############
|
|
|
|
|
2011-03-27 02:18:56 -06:00
|
|
|
if(ENABLE_DOC AND DOXYGEN_FOUND)
|
2011-03-26 16:30:14 -06:00
|
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen/index.html
|
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen.cfg
|
2011-03-27 02:18:56 -06:00
|
|
|
DEPENDS doc/doxygen*.cfg ${stratagus_SRCS}
|
2011-03-26 16:30:14 -06:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
COMMENT "Generating Stratagus souce code documentation with Doxygen" VERBATIM
|
|
|
|
)
|
2011-03-27 02:18:56 -06:00
|
|
|
add_custom_target(doc ALL DEPENDS doc/doxygen/index.html)
|
2011-03-26 16:30:14 -06:00
|
|
|
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen/)
|
|
|
|
endif()
|
|
|
|
|
2011-03-27 02:18:56 -06:00
|
|
|
########### next target ###############
|
|
|
|
|
|
|
|
macro(self_packer PACKER_TARGET)
|
|
|
|
get_target_property(PACKER_NAME ${PACKER_TARGET} OUTPUT_NAME)
|
|
|
|
if(NOT PACKER_NAME)
|
|
|
|
set(PACKER_NAME ${PACKER_TARGET})
|
|
|
|
endif()
|
|
|
|
add_custom_command(TARGET ${PACKER_TARGET} POST_BUILD
|
|
|
|
COMMAND ${SELF_PACKER_FOR_EXECUTABLE}
|
|
|
|
ARGS ${SELF_PACKER_FOR_EXECUTABLE_FLAGS} ${PACKER_NAME}${CMAKE_EXECUTABLE_SUFFIX}
|
|
|
|
)
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
if(ENABLE_UPX AND SELF_PACKER_FOR_EXECUTABLE)
|
|
|
|
self_packer(stratagus)
|
|
|
|
self_packer(png2stratagus)
|
|
|
|
if(SQLITE_FOUND)
|
|
|
|
self_packer(metaserver)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
########### next target ###############
|
|
|
|
|
|
|
|
if(WIN32 AND ENABLE_NSIS AND MAKENSIS_FOUND)
|
|
|
|
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/COPYING DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/win32/stratagus.ico DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
add_custom_command(OUTPUT Stratagus-${STRATAGUS_VERSION}${MAKENSIS_SUFFIX}
|
|
|
|
COMMAND ${MAKENSIS} ARGS ${MAKENSIS_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/src/win32/stratagus.nsi
|
|
|
|
DEPENDS src/win32/stratagus.nsi stratagus COPYING
|
|
|
|
COMMENT "Generating Stratagus Windows NSIS Installer" VERBATIM
|
|
|
|
)
|
|
|
|
add_custom_target(nsis ALL DEPENDS Stratagus-${STRATAGUS_VERSION}${MAKENSIS_SUFFIX})
|
|
|
|
endif()
|
|
|
|
|
2011-03-05 15:36:56 -07:00
|
|
|
########### install files ###############
|
|
|
|
|
|
|
|
install(TARGETS stratagus DESTINATION games)
|
2011-03-27 02:18:56 -06:00
|
|
|
install(TARGETS png2stratagus DESTINATION bin)
|
|
|
|
|
|
|
|
if(SQLITE_FOUND)
|
|
|
|
install(TARGETS metaserver DESTINATION sbin)
|
|
|
|
endif()
|