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
2014-10-20 11:58:56 -06:00
# Copyright (C) 2011-2014 Pali Rohár <pali.rohar@gmail.com>, cybermind <cybermindid@gmail.com>
2011-03-27 02:18:56 -06:00
#
# 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-07-27 03:17:09 -06:00
2013-02-05 14:16:43 -07:00
#########################
# Version configuration #
#########################
# Stratagus major version
set(STRATAGUS_MAJOR_VERSION 2)
2015-12-04 10:13:53 -07:00
# Stratagus minor version (maximum 99)
set(STRATAGUS_MINOR_VERSION 4)
# Stratagus patch level (maximum 99)
2017-06-11 04:16:18 -06:00
set(STRATAGUS_PATCH_LEVEL 2)
2013-02-05 14:16:43 -07:00
# Stratagus patch level 2
set(STRATAGUS_PATCH_LEVEL2 0)
#########################
2011-03-05 15:36:56 -07:00
project(stratagus)
2011-03-25 15:08:04 -06:00
cmake_minimum_required(VERSION 2.6)
2013-02-05 14:16:43 -07:00
set(STRATAGUS_VERSION "${STRATAGUS_MAJOR_VERSION}.${STRATAGUS_MINOR_VERSION}.${STRATAGUS_PATCH_LEVEL}")
2013-02-05 14:27:43 -07:00
set(STRATAGUS_VERSION_FULL "${STRATAGUS_VERSION}.${STRATAGUS_PATCH_LEVEL2}")
2013-02-05 14:16:43 -07:00
if(${STRATAGUS_PATCH_LEVEL2} GREATER 0)
2013-02-05 14:27:43 -07:00
set(STRATAGUS_VERSION "${STRATAGUS_VERSION_FULL}")
2013-02-05 14:16:43 -07:00
endif()
2011-03-05 15:36:56 -07:00
# Stratagus sources
include_directories(
src/include
src/guichan/include
src/guichan/include/guichan
2013-02-05 14:16:43 -07:00
${CMAKE_CURRENT_BINARY_DIR}
2011-03-05 15:36:56 -07:00
)
set(action_SRCS
src/action/action_attack.cpp
src/action/action_board.cpp
src/action/action_build.cpp
2012-02-25 05:51:12 -07:00
src/action/action_built.cpp
2012-12-27 01:58:44 -07:00
src/action/action_defend.cpp
2011-03-05 15:36:56 -07:00
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_spellcast.cpp
src/action/action_still.cpp
src/action/action_train.cpp
src/action/action_unload.cpp
src/action/action_upgradeto.cpp
2012-02-25 05:51:12 -07:00
src/action/actions.cpp
2011-03-05 15:36:56 -07:00
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
2012-03-25 10:37:53 -06:00
set(animation_SRCS
src/animation/animation.cpp
2012-04-01 09:29:51 -06:00
src/animation/animation_attack.cpp
2012-03-31 01:34:59 -06:00
src/animation/animation_die.cpp
2012-04-01 09:29:51 -06:00
src/animation/animation_exactframe.cpp
src/animation/animation_frame.cpp
src/animation/animation_goto.cpp
src/animation/animation_ifvar.cpp
src/animation/animation_label.cpp
2013-05-09 10:32:37 -06:00
src/animation/animation_luacallback.cpp
2012-04-01 09:29:51 -06:00
src/animation/animation_move.cpp
src/animation/animation_randomgoto.cpp
src/animation/animation_randomrotate.cpp
src/animation/animation_randomsound.cpp
src/animation/animation_randomwait.cpp
src/animation/animation_rotate.cpp
src/animation/animation_setplayervar.cpp
src/animation/animation_setvar.cpp
src/animation/animation_sound.cpp
src/animation/animation_spawnmissile.cpp
src/animation/animation_spawnunit.cpp
src/animation/animation_unbreakable.cpp
src/animation/animation_wait.cpp
2012-03-25 10:37:53 -06:00
)
source_group(animation FILES ${animation_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_wall.cpp
2013-04-21 07:35:48 -06:00
src/map/mapfield.cpp
2011-03-05 15:36:56 -07:00
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
2012-04-17 02:58:43 -06:00
set(missile_SRCS
src/missile/missile.cpp
2012-04-17 04:18:53 -06:00
src/missile/missile_cliptotarget.cpp
2012-08-31 10:55:27 -06:00
src/missile/missile_continuous.cpp
2012-04-17 04:18:53 -06:00
src/missile/missile_cycleonce.cpp
src/missile/missile_deathcoil.cpp
src/missile/missile_fire.cpp
src/missile/missile_flameshield.cpp
src/missile/missile_hit.cpp
src/missile/missile_landmine.cpp
src/missile/missile_none.cpp
src/missile/missile_parabolic.cpp
src/missile/missile_pointotpointwithhit.cpp
src/missile/missile_pointtopoint.cpp
src/missile/missile_pointtopointbounce.cpp
src/missile/missile_pointtopointcycleonce.cpp
src/missile/missile_stay.cpp
2013-08-31 23:44:48 -06:00
src/missile/missile_straightfly.cpp
2012-04-17 04:18:53 -06:00
src/missile/missile_tracer.cpp
src/missile/missile_whirlwind.cpp
2012-04-18 04:16:22 -06:00
src/missile/missileconfig.cpp
2012-04-17 02:58:43 -06:00
src/missile/script_missile.cpp
)
2012-04-17 04:18:53 -06:00
source_group(missile FILES ${missile_SRCS})
2012-04-17 02:58:43 -06:00
2011-03-05 15:36:56 -07:00
set(network_SRCS
src/network/commands.cpp
2012-08-13 06:51:43 -06:00
src/network/net_lowlevel.cpp
2013-03-24 07:57:58 -06:00
src/network/net_message.cpp
2011-03-05 15:36:56 -07:00
src/network/master.cpp
src/network/netconnect.cpp
src/network/network.cpp
2013-12-05 08:03:34 -07:00
src/network/netsockets.cpp
2011-03-05 15:36:56 -07:00
)
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
2012-08-07 15:08:27 -06:00
src/particle/radialparticle.cpp
2011-03-05 15:36:56 -07:00
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
2014-10-20 11:58:56 -06:00
src/sound/fluidsynth.cpp
2011-03-05 15:36:56 -07:00
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
2012-08-10 05:26:54 -06:00
set(spell_SRCS
src/spell/script_spell.cpp
src/spell/spell_adjustvariable.cpp
src/spell/spell_adjustvital.cpp
src/spell/spell_areaadjustvital.cpp
src/spell/spell_areabombardment.cpp
src/spell/spell_capture.cpp
src/spell/spell_demolish.cpp
2014-02-25 09:30:32 -07:00
src/spell/spell_luacallback.cpp
2012-08-10 05:26:54 -06:00
src/spell/spell_polymorph.cpp
src/spell/spell_spawnmissile.cpp
src/spell/spell_spawnportal.cpp
src/spell/spell_summon.cpp
2013-04-15 08:39:16 -06:00
src/spell/spell_teleport.cpp
2012-08-10 05:26:54 -06:00
src/spell/spells.cpp
)
source_group(spell FILES ${spell_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
2013-04-03 10:24:22 -06:00
src/stratagus/main.cpp
2011-03-05 15:36:56 -07:00
src/stratagus/mainloop.cpp
2013-02-08 09:20:58 -07:00
src/stratagus/parameters.cpp
2011-03-05 15:36:56 -07:00
src/stratagus/player.cpp
src/stratagus/script.cpp
src/stratagus/script_player.cpp
src/stratagus/selection.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
2012-12-31 04:02:34 -07:00
src/ui/contenttype.cpp
2011-03-05 15:36:56 -07:00
src/ui/icons.cpp
src/ui/interface.cpp
src/ui/mainscr.cpp
2013-02-25 05:53:02 -07:00
src/ui/uibuttons_proc.cpp
2011-03-05 15:36:56 -07:00
src/ui/mouse.cpp
2012-12-31 07:24:08 -07:00
src/ui/popup.cpp
2011-03-05 15:36:56 -07:00
src/ui/script_ui.cpp
2012-12-31 06:08:18 -07:00
src/ui/statusline.cpp
2011-03-05 15:36:56 -07:00
src/ui/ui.cpp
2012-12-31 06:08:18 -07:00
src/ui/uitimer.cpp
2011-03-05 15:36:56 -07:00
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
2012-04-15 11:06:44 -06:00
src/unit/unitptr.cpp
2011-03-05 15:36:56 -07:00
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
2012-08-14 09:35:58 -06:00
src/video/color.cpp
2011-03-05 15:36:56 -07:00
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
2015-10-16 04:28:08 -06:00
src/video/shaders.cpp
2011-03-05 15:36:56 -07:00
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
2015-04-12 03:54:50 -06:00
src/win32/SetupConsole_win32.cpp
2011-03-06 12:38:55 -07:00
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
2012-01-16 17:25:05 -07:00
set(tolua_FILES
src/tolua/ai.pkg
src/tolua/editor.pkg
src/tolua/font.pkg
src/tolua/game.pkg
src/tolua/map.pkg
2013-12-05 08:03:34 -07:00
src/tolua/master.pkg
2012-01-16 17:25:05 -07:00
src/tolua/minimap.pkg
src/tolua/network.pkg
src/tolua/particle.pkg
src/tolua/pathfinder.pkg
src/tolua/player.pkg
src/tolua/sound.pkg
src/tolua/stratagus.pkg
2012-08-06 05:22:03 -06:00
src/tolua/translate.pkg
2012-01-16 17:25:05 -07:00
src/tolua/trigger.pkg
src/tolua/ui.pkg
src/tolua/unit.pkg
src/tolua/unittype.pkg
src/tolua/upgrade.pkg
src/tolua/video.pkg
src/tolua/stratagus.lua
)
source_group(tolua FILES ${tolua_FILES})
2011-03-06 10:07:24 -07:00
set(stratagus_SRCS
${action_SRCS}
2012-03-25 10:37:53 -06:00
${animation_SRCS}
2011-03-06 10:07:24 -07:00
${ai_SRCS}
${editor_SRCS}
${game_SRCS}
${guichan_SRCS}
${map_SRCS}
2012-04-17 02:58:43 -06:00
${missile_SRCS}
2011-03-06 10:07:24 -07:00
${network_SRCS}
${particle_SRCS}
${pathfinder_SRCS}
${sound_SRCS}
2012-08-10 05:26:54 -06:00
${spell_SRCS}
2011-03-06 10:07:24 -07:00
${stratagusmain_SRCS}
${ui_SRCS}
${unit_SRCS}
${video_SRCS}
${CMAKE_CURRENT_BINARY_DIR}/tolua.cpp
)
2012-02-27 11:46:19 -07:00
set(stratagus_guichan_HDRS
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
)
set(stratagus_action_HDRS
src/include/action/action_attack.h
src/include/action/action_board.h
src/include/action/action_build.h
src/include/action/action_built.h
2012-12-27 01:58:44 -07:00
src/include/action/action_defend.h
2012-02-27 11:46:19 -07:00
src/include/action/action_die.h
src/include/action/action_follow.h
src/include/action/action_move.h
src/include/action/action_patrol.h
src/include/action/action_repair.h
src/include/action/action_research.h
src/include/action/action_resource.h
src/include/action/action_spellcast.h
src/include/action/action_still.h
src/include/action/action_train.h
src/include/action/action_unload.h
src/include/action/action_upgradeto.h
)
2012-03-31 01:34:59 -06:00
set(stratagus_animation_HDRS
2012-04-01 09:29:51 -06:00
src/include/animation/animation_attack.h
2012-03-31 01:34:59 -06:00
src/include/animation/animation_die.h
2012-04-01 09:29:51 -06:00
src/include/animation/animation_exactframe.h
src/include/animation/animation_frame.h
src/include/animation/animation_goto.h
src/include/animation/animation_ifvar.h
src/include/animation/animation_label.h
2013-05-09 10:32:37 -06:00
src/include/animation/animation_luacallback.h
2012-04-01 09:29:51 -06:00
src/include/animation/animation_move.h
src/include/animation/animation_randomgoto.h
src/include/animation/animation_randomrotate.h
src/include/animation/animation_randomsound.h
src/include/animation/animation_randomwait.h
src/include/animation/animation_rotate.h
src/include/animation/animation_setplayervar.h
src/include/animation/animation_setvar.h
src/include/animation/animation_sound.h
src/include/animation/animation_spawnmissile.h
src/include/animation/animation_spawnunit.h
src/include/animation/animation_unbreakable.h
src/include/animation/animation_wait.h
2012-03-31 01:34:59 -06:00
)
2012-02-27 11:46:19 -07:00
2012-08-10 07:40:52 -06:00
set(stratagus_spell_HDRS
src/include/spell/spell_adjustvariable.h
src/include/spell/spell_adjustvital.h
src/include/spell/spell_areaadjustvital.h
src/include/spell/spell_areabombardment.h
src/include/spell/spell_capture.h
src/include/spell/spell_demolish.h
2014-02-25 09:30:32 -07:00
src/include/spell/spell_luacallback.h
2012-08-10 07:40:52 -06:00
src/include/spell/spell_polymorph.h
src/include/spell/spell_spawnmissile.h
src/include/spell/spell_spawnportal.h
src/include/spell/spell_summon.h
2013-04-15 08:39:16 -06:00
src/include/spell/spell_teleport.h
2012-08-10 07:40:52 -06:00
)
2012-02-27 11:46:19 -07:00
set(stratagus_generic_HDRS
2011-04-01 12:28:36 -06:00
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
2012-08-14 09:35:58 -06:00
src/include/color.h
2011-04-01 12:28:36 -06:00
src/include/commands.h
src/include/construct.h
src/include/cursor.h
src/include/depend.h
src/include/editor.h
src/include/font.h
2012-08-11 06:19:13 -06:00
src/include/game.h
2011-04-01 12:28:36 -06:00
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
2012-04-18 04:16:22 -06:00
src/include/missileconfig.h
2011-04-01 12:28:36 -06:00
src/include/movie.h
src/include/myendian.h
src/include/net_lowlevel.h
2013-03-24 07:57:58 -06:00
src/include/net_message.h
src/include/netconnect.h
2011-04-01 12:28:36 -06:00
src/include/network.h
2013-12-05 08:03:34 -07:00
src/include/network/netsockets.h
2013-02-08 09:20:58 -07:00
src/include/parameters.h
2011-04-01 12:28:36 -06:00
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
2015-10-16 04:28:08 -06:00
src/include/shaders.h
2011-04-01 12:28:36 -06:00
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
2012-12-31 04:02:34 -07:00
src/include/ui/contenttype.h
2012-12-31 07:24:08 -07:00
src/include/ui/popup.h
2012-12-31 06:08:18 -07:00
src/include/ui/statusline.h
src/include/ui/uitimer.h
2011-04-01 12:28:36 -06:00
src/include/ui.h
src/include/unit.h
2012-04-15 11:06:44 -06:00
src/include/unit_cache.h
2012-06-29 05:18:12 -06:00
src/include/unit_find.h
2011-04-01 12:28:36 -06:00
src/include/unit_manager.h
2012-04-15 11:06:44 -06:00
src/include/unitptr.h
2011-04-01 12:28:36 -06:00
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
2012-04-26 10:29:43 -06:00
src/include/viewport.h
2011-04-01 12:28:36 -06:00
src/include/wav.h
src/include/widgets.h
2015-04-12 03:54:50 -06:00
src/include/SetupConsole_win32.h
2011-04-01 12:28:36 -06:00
)
2012-02-27 11:46:19 -07:00
source_group(include FILES ${stratagus_generic_HDRS})
source_group(include\\action FILES ${stratagus_action_HDRS})
2012-03-31 01:34:59 -06:00
source_group(include\\animation FILES ${stratagus_animation_HDRS})
2012-02-27 11:46:19 -07:00
source_group(include\\guichan FILES ${stratagus_guichan_HDRS})
2012-08-10 07:40:52 -06:00
source_group(include\\spell FILES ${stratagus_spell_HDRS})
2012-02-27 11:46:19 -07:00
2013-02-05 15:39:30 -07:00
set(stratagus_HDRS
${stratagus_generic_HDRS}
${stratagus_action_HDRS}
${stratagus_animation_HDRS}
${stratagus_guichan_HDRS}
${stratagus_spell_HDRS}
${CMAKE_CURRENT_BINARY_DIR}/version-generated.h
2013-02-08 15:06:10 -07:00
version-generated.h # This line is needed for CMake when generating Doxygen documentation
2013-02-05 15:39:30 -07:00
)
2011-04-01 12:28:36 -06:00
2015-02-13 10:39:28 -07:00
# Configuration types
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
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
if(UNIX AND CMAKE_SYSTEM_NAME MATCHES Linux)
2013-02-05 08:48:08 -07:00
set(LINUX true)
endif()
2015-11-26 06:12:53 -07:00
if(WIN32 AND MSVC AND NOT CMAKE_PREFIX_PATH)
# use a default
set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../dependencies)
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-04-02 02:32:11 -06:00
if(WIN32)
find_package(MakeNSIS)
endif()
2011-03-05 15:36:56 -07:00
find_package(BZip2)
2014-10-20 11:58:56 -06:00
find_package(FluidSynth)
2015-02-19 06:47:55 -07:00
find_package(StackTrace)
2011-03-05 15:36:56 -07:00
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
2013-02-05 07:28:21 -07:00
include(CheckTypeSize)
2011-03-06 10:07:24 -07:00
include(CheckFunctionExists)
2013-02-05 07:28:21 -07:00
include(CheckSymbolExists)
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)
2018-09-27 13:38:09 -06:00
option(ENABLE_STDIO_REDIRECT "Redirect Stratagus console output to files on Windows" ON)
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()
2011-05-23 11:50:57 -06:00
option(ENABLE_TOUCHSCREEN "Use touchscreen input" OFF)
2011-03-05 15:36:56 -07:00
option(WITH_BZIP2 "Compile Stratagus with BZip2 compression support" ON)
2014-10-20 11:58:56 -06:00
option(WITH_FLUIDSYNTH "Compile Stratagus with FluidSynth sound library" ON)
2011-03-05 15:36:56 -07:00
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)
2015-02-19 06:47:55 -07:00
option(WITH_STACKTRACE "Compile Stratagus with StackTrace library" ON)
2011-03-05 15:36:56 -07:00
2011-04-01 12:47:26 -06:00
option(WITH_X11 "Compile Stratagus with X11 clipboard pasting support" ON)
2011-03-05 15:36:56 -07:00
2011-05-23 10:12:24 -06:00
option(ENABLE_DOC "Generate Stratagus source code documentation with Doxygen" OFF)
2011-08-08 07:28:05 -06:00
option(ENABLE_DEV "Install Stratagus game development headers files" OFF)
2011-03-27 02:18:56 -06:00
option(ENABLE_UPX "Compress Stratagus executable binary with UPX packer" OFF)
2011-12-19 10:16:02 -07:00
option(ENABLE_STRIP "Strip all symbols from executables" OFF)
2013-08-03 06:43:17 -06:00
option(ENABLE_USEGAMEDIR "Place all files created by Stratagus(logs, savegames) in game directory(old behavior), otherwise place everything in user directory(new behavior)" OFF)
2015-02-13 10:39:28 -07:00
option(ENABLE_MULTIBUILD "Compile Stratagus on all CPU cores simltaneously in MSVC" ON)
2011-03-26 16:30:14 -06:00
2011-04-12 23:41:04 -06:00
if(NOT WITH_RENDERER)
if(OPENGL_FOUND)
set(WITH_RENDERER "OpenGL")
elseif(OPENGLES_FOUND AND SDLGLES_FOUND)
set(WITH_RENDERER "OpenGLES")
else()
set(WITH_RENDERER "NativeSDL")
endif()
endif()
2012-05-20 11:48:55 -06:00
# Install paths
2012-06-19 10:41:00 -06:00
set(BINDIR "bin" CACHE PATH "Where to install user binaries")
set(SBINDIR "sbin" CACHE PATH "Where to install system binaries")
set(GAMEDIR "games" CACHE PATH "Where to install games binaries")
2012-05-20 11:48:55 -06:00
set(DOCDIR "share/doc/stratagus" CACHE PATH "Sets the doc directory to a non-default location.")
set(MANDIR "share/man/man6" CACHE PATH "Sets the man directory to a non-default location.")
2012-07-15 06:10:42 -06:00
set(PIXMAPSDIR "share/pixmaps" CACHE PATH "Sets the pixmaps directory to a non-default location.")
2012-05-20 11:48:55 -06:00
set(STRATAGUS_HEADERS "include" CACHE PATH "Where to install stratagus headers.")
2012-07-15 06:10:42 -06:00
if(NOT IS_ABSOLUTE "${PIXMAPSDIR}")
set(PIXMAPSDIRABS "${CMAKE_INSTALL_PREFIX}/${PIXMAPSDIR}")
else()
set(PIXMAPSDIRABS "${PIXMAPSDIR}")
endif()
2011-03-05 15:36:56 -07:00
# Stratagus definitions
2012-07-15 06:10:42 -06:00
add_definitions(${PNG_DEFINITIONS} -DUSE_ZLIB -DPIXMAPS=\"${PIXMAPSDIRABS}\")
2011-04-13 04:37:37 -06:00
include_directories(${LUA_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ${TOLUA++_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
set(stratagus_LIBS ${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()
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()
2014-10-20 11:58:56 -06:00
if(WITH_FLUIDSYNTH AND FLUIDSYNTH_FOUND)
add_definitions(-DUSE_FLUIDSYNTH ${FLUIDSYNTH_DEFINITIONS})
include_directories(${FLUIDSYNTH_INCLUDE_DIR})
set(stratagus_LIBS ${stratagus_LIBS} ${FLUIDSYNTH_LIBRARY})
2015-11-30 06:12:32 -07:00
find_file(FLUIDSYNTH_DLL libfluidsynth.dll HINTS ${CMAKE_PREFIX_PATH}/bin)
find_file(GLIB_DLL libglib-2.0-0.dll HINTS ${CMAKE_PREFIX_PATH} PATH_SUFFIXES bin lib)
find_file(GTHREAD_DLL libgthread-2.0-0.dll HINTS ${CMAKE_PREFIX_PATH} PATH_SUFFIXES bin lib)
set(MAKENSIS_FLAGS ${MAKENSIS_FLAGS} -DFLUID -DFLUIDDLL=libfluidsynth.dll -DGTHREADDLL=libglib-2.0-0.dll -DGLIBDLL=libgthread-2.0-0.dll)
2014-10-20 11:58:56 -06:00
endif()
2011-03-05 15:36:56 -07:00
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})
2016-03-06 10:17:00 -07:00
if (MSVC)
include_directories(${JPEG_INCLUDE_DIR})
set(stratagus_LIBS ${stratagus_LIBS} ${JPEG_LIBRARY})
endif()
2011-03-05 15:36:56 -07:00
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()
2015-02-19 06:47:55 -07:00
if(WITH_STACKTRACE AND STACKTRACE_FOUND)
add_definitions(-DUSE_STACKTRACE ${STACKTRACE_DEFINITIONS})
include_directories(${STACKTRACE_PROJECT_DIR})
set(stratagus_LIBS ${stratagus_LIBS} ${STACKTRACE_LIBRARY})
endif()
2011-04-01 12:47:26 -06:00
if(WITH_X11 AND X11_FOUND)
2013-02-05 09:14:46 -07:00
add_definitions(-DUSE_X11)
2011-03-05 15:36:56 -07:00
include_directories(${X11_INCLUDE_DIR})
set(stratagus_LIBS ${stratagus_LIBS} ${X11_X11_LIB})
endif()
2011-04-12 23:41:04 -06:00
if(WITH_RENDERER STREQUAL "OpenGL" AND OPENGL_FOUND)
add_definitions(-DUSE_OPENGL)
2011-03-05 15:36:56 -07:00
include_directories(${OPENGL_INCLUDE_DIR})
set(stratagus_LIBS ${stratagus_LIBS} ${OPENGL_LIBRARIES})
2013-02-08 11:55:03 -07:00
message(STATUS "Using OpenGL")
2011-04-12 23:41:04 -06:00
elseif(WITH_RENDERER STREQUAL "OpenGLES" AND OPENGLES_FOUND AND SDLGLES_FOUND)
2013-02-08 11:55:03 -07:00
if(SDLGLES_TYPE STREQUAL "Native")
add_definitions(-DUSE_GLES_NATIVE)
message(STATUS "Using OpenGLES (SDL Native)")
elseif(SDLGLES_TYPE STREQUAL "EGL")
add_definitions(-DUSE_GLES_EGL)
message(STATUS "Using OpenGLES (SDL EGL)")
else()
message(FATAL_ERROR "Unknown SDL gles type")
endif()
2011-03-05 15:36:56 -07:00
add_definitions(-DUSE_GLES)
include_directories(${OPENGLES_INCLUDE_DIR} ${SDLGLES_INCLUDE_DIR})
set(stratagus_LIBS ${stratagus_LIBS} ${OPENGLES_LIBRARIES} ${SDLGLES_LIBRARY})
2013-02-08 10:53:21 -07:00
elseif(NOT WITH_RENDERER STREQUAL "NativeSDL")
message(FATAL_ERROR "Specified rendering support was not found in system.\nChoose: NativeSDL OpenGL OpenGLES")
2011-03-05 15:36:56 -07:00
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})
2015-03-15 11:56:45 -06:00
set(stratagus_LIBS ${stratagus_LIBS} dsound winmm ws2_32 dbghelp)
2011-03-06 10:07:24 -07:00
endif()
2011-05-23 09:55:14 -06:00
if (WIN32 AND MSVC)
2015-11-26 06:12:53 -07:00
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE=1 -DNOMINMAX)
2011-04-11 11:13:16 -06:00
endif()
2012-02-25 02:23:53 -07:00
if (WIN32 AND MINGW)
set(stratagus_LIBS ${stratagus_LIBS} dxguid)
endif()
2011-03-06 10:07:24 -07:00
if(APPLE)
add_definitions(-DUSE_MAC)
2016-03-06 10:17:00 -07:00
set(SDL_LIBRARY ${SDL_LIBRARY} SDLmain)
2011-03-06 10:07:24 -07:00
endif()
if(BSD)
2011-03-26 16:32:47 -06:00
add_definitions(-DUSE_BSD)
2013-02-05 08:48:08 -07:00
endif()
if(LINUX)
add_definitions(-DUSE_LINUX)
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()
2012-02-18 02:16:04 -07:00
# Stratagus needs to have char by default signed
# No idea how to tell this to other compilers
2012-02-25 02:23:53 -07:00
if(CMAKE_COMPILER_IS_GNUCXX)
2016-11-08 15:50:55 -07:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char -std=gnu++0x -Werror")
2012-02-18 02:16:04 -07:00
endif()
2013-02-07 06:59:50 -07:00
if(CMAKE_COMPILER_IS_GNUC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char")
endif()
# TODO: Add support for other compilers
2012-02-18 02:16:04 -07:00
2013-02-05 07:28:21 -07:00
check_type_size(errno_t ERRNOT)
check_function_exists("strcpy_s" HAVE_STRCPYS)
check_function_exists("strncpy_s" HAVE_STRNCPYS)
2011-03-06 10:07:24 -07:00
check_function_exists("strcasestr" HAVE_STRCASESTR)
check_function_exists("strnlen" HAVE_STRNLEN)
2013-02-05 07:54:34 -07:00
check_function_exists("getopt" HAVE_GETOPT)
2011-03-06 10:07:24 -07:00
2013-02-05 07:28:21 -07:00
# mingw-w64 does not have strcat_s in any include file, but function symbol in library exists
# so rather check if we have strcat_s in string.h file
check_symbol_exists("strcat_s" "string.h" HAVE_STRCATS)
if(HAVE_ERRNOT)
add_definitions(-DHAVE_ERRNOT)
endif()
if(HAVE_STRCPYS)
add_definitions(-DHAVE_STRCPYS)
endif()
if(HAVE_STRNCPYS)
add_definitions(-DHAVE_STRNCPYS)
endif()
if(HAVE_STRCATS)
add_definitions(-DHAVE_STRCATS)
endif()
2011-03-06 10:07:24 -07:00
if(HAVE_STRCASESTR)
add_definitions(-DHAVE_STRCASESTR)
endif()
if(HAVE_STRNLEN)
add_definitions(-DHAVE_STRNLEN)
endif()
2013-02-05 07:54:34 -07:00
if(HAVE_GETOPT)
add_definitions(-DHAVE_GETOPT)
endif()
2013-02-05 08:56:16 -07:00
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDEBUG)
endif()
2011-03-06 10:07:24 -07:00
2011-12-19 10:16:02 -07:00
if(ENABLE_STRIP)
2013-02-07 06:59:50 -07:00
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
2013-02-05 09:00:02 -07:00
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s")
endif()
# TODO: Add support for other compilers
2011-12-19 10:16:02 -07:00
endif()
2013-08-03 06:43:17 -06:00
if(ENABLE_USEGAMEDIR)
add_definitions(-DUSE_GAME_DIR)
endif()
2012-01-02 15:13:23 -07:00
if(ENABLE_TOUCHSCREEN)
add_definitions(-DUSE_TOUCHSCREEN)
endif()
2015-02-13 10:39:28 -07:00
if(ENABLE_MULTIBUILD)
if(WIN32 AND MSVC)
2015-11-30 06:12:32 -07:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
2015-02-13 10:39:28 -07:00
message(STATUS "Added parallel build arguments to CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
endif()
endif()
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-13 04:56:10 -06:00
message("${PACKAGE_NAME}: Found and enabled (Disable by param -DWITH_${PACKAGE}=OFF)")
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-04-13 04:56:10 -06:00
message("Debug mode: Yes (Disable by param -DCMAKE_BUILD_TYPE=Release)")
2011-03-27 03:50:36 -06:00
else()
2011-04-13 04:56:10 -06:00
message("Debug mode: No (Enable by param -DCMAKE_BUILD_TYPE=Debug)")
2011-03-27 03:50:36 -06:00
endif()
2011-12-19 10:16:02 -07:00
if(ENABLE_STRIP)
message("Strip executables: Yes (Disable by param -DENABLE_STRIP=OFF)")
else()
message("Strip executables: No (Enable by param -DENABLE_STRIP=ON)")
endif()
2011-03-27 03:50:36 -06:00
if(ENABLE_STATIC)
2011-04-13 04:56:10 -06:00
message("Static linking: Yes (Disable by param -DENABLE_STATIC=OFF)")
2011-03-27 03:50:36 -06:00
else()
2011-04-13 04:56:10 -06:00
message("Static linking: No (Enable by param -DENABLE_STATIC=ON)")
2011-03-27 03:50:36 -06:00
endif()
2013-08-03 06:43:17 -06:00
if(ENABLE_USEGAMEDIR)
message("Place game files in: game directory (Place in user directory with -DENABLE_USEGAMEDIR=OFF)")
else()
message("Place game files in: user directory (Place in game directory with -DENABLE_USEGAMEDIR=ON)")
endif()
2015-02-13 10:39:28 -07:00
if(ENABLE_MULTIBUILD)
message("Parallel building in MSVC: Yes (Disable by param -DENABLE_MULTIBUILD=OFF)")
else()
message("Parallel building in MSVC: No (Enable by param -DENABLE_MULTIBUILD=ON)")
endif()
2011-05-23 09:55:14 -06:00
if(WIN32 AND MSVC)
message("Platform: Windows (MSVC)")
elseif(WIN32 AND MINGW)
message("Platform: Windows (MinGW)")
elseif(WIN32)
message("Platform: Windows (Other)")
2011-03-27 03:50:36 -06:00
elseif(APPLE)
message("Platform: Mac")
elseif(BSD)
message("Platform: BSD")
elseif(BEOS)
message("Platform: BEOS")
2013-02-05 08:48:08 -07:00
elseif(LINUX)
message("Platform: Linux")
2011-03-27 03:50:36 -06:00
else()
2011-05-23 09:55:14 -06:00
message("Platform: Other/No platform code")
2011-03-27 03:50:36 -06:00
endif()
2011-04-01 12:47:26 -06:00
if(WIN32 AND ENABLE_STDIO_REDIRECT)
2011-04-13 04:56:10 -06:00
message("Redirect stdio: Yes (Disable by param -DENABLE_STDIO_REDIRECT=OFF)")
2011-05-23 09:55:14 -06:00
elseif(NOT WIN32)
message("Redirect stdio: Unsupported on this platform")
2011-03-27 03:50:36 -06:00
else()
2011-04-13 04:56:10 -06:00
message("Redirect stdio: No (Enable by param -DENABLE_STDIO_REDIRECT=ON)")
2011-03-27 03:50:36 -06:00
endif()
2011-05-23 11:50:57 -06:00
if(ENABLE_TOUCHSCREEN)
message("Touchscreen input: Yes (Disable by param -DENABLE_TOUCHSCREEN=OFF)")
else()
message("Touchscreen input: No (Enable by param -DENABLE_TOUCHSCREEN=ON)")
endif()
2011-03-27 03:50:36 -06:00
if(ENABLE_DOC AND DOXYGEN_FOUND)
2011-04-13 04:56:10 -06:00
message("Doxygen documentation: Yes (Disable by param -DENABLE_DOC=OFF)")
2011-03-27 03:50:36 -06:00
else()
2011-04-13 04:56:10 -06:00
message("Doxygen documentation: No (Enable by param -DENABLE_DOC=ON)")
2011-03-27 03:50:36 -06:00
endif()
2011-08-08 07:47:57 -06:00
if(ENABLE_DEV)
message("Game development files: Yes (Disable by param -DENABLE_DEV=OFF)")
else()
message("Game development files: No (Enable by param -DENABLE_DEV=ON)")
endif()
2011-03-27 03:50:36 -06:00
if(ENABLE_UPX AND SELF_PACKER_FOR_EXECUTABLE)
2011-04-13 04:56:10 -06:00
message("Upx packer: Yes (Disable by param -DENABLE_UPX=OFF)")
2011-03-27 03:50:36 -06:00
else()
2011-04-13 04:56:10 -06:00
message("Upx packer: No (Enable by param -DENABLE_UPX=ON)")
2011-03-27 03:50:36 -06:00
endif()
2011-04-01 12:47:26 -06:00
if(WIN32 AND ENABLE_NSIS AND MAKENSIS_FOUND)
2011-04-13 04:56:10 -06:00
message("NSIS Installer: Yes (Disable by param -DENABLE_NSIS=OFF)")
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()
2011-04-13 04:56:10 -06:00
message("NSIS Installer: No (Enable by param -DENABLE_NSIS=ON)")
2011-03-27 03:50:36 -06:00
endif()
log_package("Bzip2" "BZIP2")
2014-10-20 11:58:56 -06:00
log_package("FluidSynth" "FLUIDSYNTH")
2011-03-27 03:50:36 -06:00
log_package("MikMod" "MIKMOD")
log_package("Mng" "MNG")
log_package("Ogg/Vorbis" "OGGVORBIS")
2015-02-19 06:47:55 -07:00
log_package("StackTrace" "STACKTRACE")
2011-03-27 03:50:36 -06:00
log_package("Theora" "THEORA")
2011-04-01 12:47:26 -06:00
log_package("X11" "X11")
2011-03-27 03:50:36 -06:00
2011-04-12 23:41:04 -06:00
if(WITH_RENDERER STREQUAL "OpenGL" AND OPENGL_FOUND)
2013-02-08 10:53:21 -07:00
message("Renderer: OpenGL (Disable by param -DWITH_RENDERER=NativeSDL)")
2011-04-12 23:41:04 -06:00
elseif(WITH_RENDERER STREQUAL "OpenGLES" AND OPENGLES_FOUND AND SDLGLES_FOUND)
2013-02-08 11:55:03 -07:00
message("Renderer: OpenGLES (Disable by param -DWITH_RENDERER=NativeSDL)")
2011-03-27 03:50:36 -06:00
else()
2013-02-08 11:55:03 -07:00
message("Renderer: NativeSDL (Enable OpenGL by param -DWITH_RENDERER=OpenGL)")
2011-03-27 03:50:36 -06:00
endif()
message("==================================")
2011-03-06 10:07:24 -07:00
# Compile Stratagus
2013-02-08 06:37:06 -07:00
if(NOT CMAKE_CROSSCOMPILING)
2015-12-08 02:55:16 -07:00
# Generate header file version-generated.h with git revision
2013-02-08 06:37:06 -07:00
# Run tool genversion at compile time which (re)generate file version-generated.h when needed
set(genversion_SRCS tools/genversion.cpp)
source_group(genversion FILES ${genversion_SRCS})
add_executable(genversion ${genversion_SRCS})
2013-02-08 15:06:10 -07:00
add_custom_target(version-generated.h ALL
2013-02-08 06:37:06 -07:00
genversion ${CMAKE_CURRENT_BINARY_DIR}/version-generated.h "${STRATAGUS_VERSION}"
DEPENDS genversion
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)
2013-02-08 15:06:10 -07:00
set_source_files_properties(version-generated.h PROPERTIES GENERATED true)
set_source_files_properties(src/include/version.h PROPERTIES OBJECT_DEPENDS version-generated.h) # This is needed for old CMake which does not generate correct dependences
2013-02-08 06:37:06 -07:00
list(APPEND CLEAN_FILES version-generated.h)
else()
2015-12-08 02:55:16 -07:00
# Generate header file version-generated.h without git revision
2013-02-08 06:37:06 -07:00
# When cross compiling we cannot build host binary, so create file at cmake time
if(NOT "${STRATAGUS_VERSION}" STREQUAL "${STRATAGUS_VERSION_CACHED}" OR NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/version-generated.h)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/version-generated.h
"/* ${STRATAGUS_MAJOR_VERSION} ${STRATAGUS_MINOR_VERSION} ${STRATAGUS_PATCH_LEVEL} ${STRATAGUS_PATCH_LEVEL2} -1 */\n"
"/* This file is autogenerated, do not modify it! */\n"
"#define StratagusMajorVersion ${STRATAGUS_MAJOR_VERSION}\n"
"#define StratagusMinorVersion ${STRATAGUS_MINOR_VERSION}\n"
"#define StratagusPatchLevel ${STRATAGUS_PATCH_LEVEL}\n"
"#define StratagusPatchLevel2 ${STRATAGUS_PATCH_LEVEL2}\n"
)
set(STRATAGUS_VERSION_CACHED ${STRATAGUS_VERSION} CACHE INTERNAL "" FORCE)
endif()
list(APPEND CLEAN_FILES version-generated.h)
endif()
2013-02-05 14:16:43 -07:00
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
2012-01-16 17:25:05 -07:00
DEPENDS ${tolua_FILES}
2011-03-27 02:18:56 -06:00
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/tolua
2013-02-05 14:19:20 -07:00
VERBATIM
2011-03-27 02:18:56 -06:00
)
2017-10-28 05:26:18 -06:00
if (ENABLE_STDIO_REDIRECT)
add_executable(stratagus WIN32 ${stratagus_SRCS} ${stratagus_HDRS})
else
add_executable(stratagus ${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)
2012-07-15 06:10:42 -06:00
set_target_properties(stratagus PROPERTIES LINK_FLAGS "${LINK_FLAGS} -static-libgcc -static-libstdc++ -Wl,--stack,10485760")
2011-03-06 10:07:24 -07:00
endif()
2013-10-02 08:28:16 -06:00
if(APPLE)
2015-11-24 09:30:27 -07:00
set_target_properties(stratagus PROPERTIES LINK_FLAGS "${LINK_FLAGS} -lSDLmain")
2013-10-02 08:28:16 -06:00
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
2012-08-13 06:51:43 -06:00
src/network/net_lowlevel.cpp
2011-03-05 15:36:56 -07:00
)
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
2015-04-12 03:55:12 -06:00
if(WIN32)
target_link_libraries(metaserver winmm ws2_32)
endif()
if(WIN32 AND MINGW)
target_link_libraries(metaserver dxguid)
endif()
2011-04-01 12:47:26 -06:00
if(WIN32 AND MINGW AND ENABLE_STATIC)
2012-07-15 06:10:42 -06:00
set_target_properties(metaserver PROPERTIES LINK_FLAGS "${LINK_FLAGS} -static-libgcc -static-libstdc++")
2011-03-06 10:07:24 -07:00
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)
2012-07-15 06:10:42 -06:00
set_target_properties(png2stratagus PROPERTIES LINK_FLAGS "${LINK_FLAGS} -static-libgcc -static-libstdc++")
2011-03-06 10:07:24 -07:00
endif()
2011-03-05 15:36:56 -07:00
2011-08-08 07:28:05 -06:00
########### next target ###############
set(gameheaders_HDRS
gameheaders/stratagus-game-installer.nsi
2016-12-01 10:01:13 -07:00
gameheaders/stratagus-gameutils.h
2011-08-08 07:28:05 -06:00
gameheaders/stratagus-game-launcher.h
2016-11-19 07:17:58 -07:00
gameheaders/stratagus-tinyfiledialogs.h
2011-08-08 07:28:05 -06:00
)
source_group(gameheaders FILES ${gameheaders_HDRS})
2011-03-26 16:30:14 -06:00
########### next target ###############
2012-01-16 17:25:05 -07:00
set(doxygen_FILES
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
doc/Doxyfile-footer.html
doc/Doxyfile-header.html
${stratagus_SRCS}
${stratagus_HDRS}
${metaserver_SRCS}
${metaserver_HDRS}
${gameheaders_HDRS}
${png2stratagus_SRCS}
)
2011-03-27 02:18:56 -06:00
if(ENABLE_DOC AND DOXYGEN_FOUND)
2011-05-24 14:50:07 -06:00
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
add_custom_command(OUTPUT doxygen/index.html
2011-11-06 08:53:50 -07:00
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
2012-01-16 17:25:05 -07:00
DEPENDS ${doxygen_FILES}
2011-11-06 08:53:50 -07:00
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
2013-02-05 14:19:20 -07:00
COMMENT "Generating Stratagus souce code documentation with Doxygen"
VERBATIM
2011-03-26 16:30:14 -06:00
)
2011-05-24 14:50:07 -06:00
add_custom_target(doc ALL DEPENDS doxygen/index.html)
2013-02-08 06:37:06 -07:00
list(APPEND CLEAN_FILES doxygen)
2011-03-26 16:30:14 -06:00
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}
2013-02-05 14:19:20 -07:00
VERBATIM
2011-03-27 02:18:56 -06:00
)
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)
2015-11-30 06:12:32 -07:00
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/COPYING DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
2011-03-27 02:18:56 -06:00
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/win32/stratagus.ico DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
2015-11-30 06:12:32 -07:00
if(WITH_FLUIDSYNTH AND FLUIDSYNTH_FOUND)
file(COPY ${FLUIDSYNTH_DLL} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${GLIB_DLL} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${GTHREAD_DLL} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()
2016-03-07 03:15:25 -07:00
# also ship lua51.dll
find_file(LUA_DLL lua51.dll HINTS ${CMAKE_PREFIX_PATH} PATH_SUFFIXES bin lib)
file(COPY ${LUA_DLL} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
set(MAKENSIS_FLAGS ${MAKENSIS_FLAGS} -DLUADLL=lua51.dll)
2016-03-07 04:08:54 -07:00
# ship SDL.dll
find_file(SDL_DLL SDL.dll HINTS ${CMAKE_PREFIX_PATH} PATH_SUFFIXES bin lib)
file(COPY ${SDL_DLL} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
set(MAKENSIS_FLAGS ${MAKENSIS_FLAGS} -DSDL=SDL.dll)
2011-03-27 02:18:56 -06:00
add_custom_command(OUTPUT Stratagus-${STRATAGUS_VERSION}${MAKENSIS_SUFFIX}
2013-02-05 14:27:43 -07:00
COMMAND ${MAKENSIS} ARGS ${MAKENSIS_FLAGS} -DVERSION=${STRATAGUS_VERSION} -DVIVERSION=${STRATAGUS_VERSION_FULL} ${CMAKE_CURRENT_SOURCE_DIR}/src/win32/stratagus.nsi
2011-03-27 02:18:56 -06:00
DEPENDS src/win32/stratagus.nsi stratagus COPYING
2013-02-05 14:19:20 -07:00
COMMENT "Generating Stratagus Windows NSIS Installer"
VERBATIM
2011-03-27 02:18:56 -06:00
)
add_custom_target(nsis ALL DEPENDS Stratagus-${STRATAGUS_VERSION}${MAKENSIS_SUFFIX})
endif()
2011-03-05 15:36:56 -07:00
########### install files ###############
2012-06-19 10:41:00 -06:00
install(TARGETS stratagus DESTINATION ${GAMEDIR})
2012-05-20 11:48:55 -06:00
install(TARGETS png2stratagus DESTINATION ${BINDIR})
2011-03-27 02:18:56 -06:00
if(SQLITE_FOUND)
2016-11-14 05:43:46 -07:00
install(TARGETS metaserver DESTINATION ${BINDIR} RENAME stratagus-metaserver)
2011-03-27 02:18:56 -06:00
endif()
2011-05-24 14:50:07 -06:00
if(ENABLE_DOC AND DOXYGEN_FOUND)
2012-05-20 11:48:55 -06:00
install(FILES doc/stratagus.6 DESTINATION ${MANDIR})
2011-05-24 14:50:07 -06:00
install(FILES
doc/development.html
doc/faq.html
doc/gpl.html
doc/guichan-copyright.txt
2011-08-09 01:19:14 -06:00
doc/changelog.html
2011-05-24 14:50:07 -06:00
doc/index.html
doc/install.html
doc/media.html
doc/metaserver_protocol.txt
doc/README-SDL.txt
DESTINATION share/doc/stratagus
)
2012-05-20 11:48:55 -06:00
install(DIRECTORY doc/graphics doc/scripts ${CMAKE_CURRENT_BINARY_DIR}/doxygen DESTINATION ${DOCDIR})
2011-05-24 14:50:07 -06:00
endif(ENABLE_DOC AND DOXYGEN_FOUND)
2011-08-08 07:28:05 -06:00
if(ENABLE_DEV)
2012-05-20 11:48:55 -06:00
install(FILES ${gameheaders_HDRS} DESTINATION ${STRATAGUS_HEADERS})
2011-08-08 07:28:05 -06:00
endif()
2013-02-08 06:37:06 -07:00
########### clean files ###############
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEAN_FILES}")
2018-09-27 13:27:57 -06:00
# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()