2010-04-18 20:02:01 +00:00
|
|
|
cmake_minimum_required (VERSION 2.8.1)
|
2009-05-29 20:53:15 +00:00
|
|
|
project (clonk CXX C)
|
|
|
|
|
2009-08-13 16:09:00 +00:00
|
|
|
set(CMAKE_ADDITIONAL_DEPS_PATH deps CACHE PATH "Additional directory to search for libraries and headers")
|
|
|
|
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_ADDITIONAL_DEPS_PATH})
|
2009-07-12 16:46:54 +00:00
|
|
|
set(OC_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
|
|
separate_arguments(OC_CXX_FLAGS)
|
|
|
|
set(OC_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
|
|
|
separate_arguments(OC_CXX_FLAGS_DEBUG)
|
2009-07-01 20:25:45 +00:00
|
|
|
|
2010-01-12 21:09:16 +00:00
|
|
|
############################################################################
|
|
|
|
# User selectable options
|
|
|
|
############################################################################
|
|
|
|
option(PROJECT_FOLDERS "Put source files into subfolders in project file" ON)
|
|
|
|
option(USE_GL "Enable OpenGL support" ON)
|
|
|
|
if(APPLE)
|
|
|
|
SET(INITIAL_USE_SDL_MAINLOOP_VALUE ON)
|
|
|
|
else()
|
|
|
|
SET(INITIAL_USE_SDL_MAINLOOP_VALUE OFF)
|
|
|
|
endif()
|
|
|
|
option(USE_SDL_MAINLOOP "Use SDL to create windows etc." ${INITIAL_USE_SDL_MAINLOOP_VALUE})
|
|
|
|
if(WIN32)
|
|
|
|
option(USE_DIRECTX "Enable DirectX support" ON)
|
|
|
|
if(EXISTS $ENV{DXSDK_DIR})
|
|
|
|
include_directories(SYSTEM $ENV{DXSDK_DIR}/Include)
|
2010-02-28 00:42:57 +00:00
|
|
|
if(CMAKE_CL_64)
|
2010-01-12 21:09:16 +00:00
|
|
|
list(APPEND CMAKE_LIBRARY_PATH $ENV{DXSDK_DIR}/Lib/x64)
|
|
|
|
else()
|
|
|
|
list(APPEND CMAKE_LIBRARY_PATH $ENV{DXSDK_DIR}/Lib/x86)
|
|
|
|
endif()
|
2010-04-18 20:02:01 +00:00
|
|
|
else()
|
|
|
|
|
2010-01-12 21:09:16 +00:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
SET(USE_DIRECTX OFF)
|
|
|
|
SET(HAVE_FMOD OFF)
|
|
|
|
endif()
|
2010-02-09 18:01:53 +00:00
|
|
|
if(UNIX AND NOT USE_SDL_MAINLOOP)
|
2010-01-12 21:09:16 +00:00
|
|
|
option(USE_X11 "Use X11 to create windows etc." ON)
|
|
|
|
option(USE_GTK "Use GTK for the developer mode" ON)
|
|
|
|
else()
|
|
|
|
SET(USE_X11 OFF)
|
|
|
|
SET(USE_GTK OFF)
|
|
|
|
endif()
|
|
|
|
if(NOT USE_GL AND NOT USE_DIRECTX)
|
|
|
|
message(STATUS "No graphics display enabled; building dedicated server")
|
|
|
|
SET(USE_CONSOLE ON CACHE INTERNAL "Build dedicated server")
|
|
|
|
endif()
|
2010-02-08 20:51:48 +00:00
|
|
|
option(BUILD_TO_PLANET "Put build files to ./planet/" OFF)
|
2010-03-21 21:40:37 +00:00
|
|
|
option(DEBUGREC "Debug records" OFF)
|
2010-04-18 18:10:24 +00:00
|
|
|
option(OC_BUILD_MULTIPROCESSOR "Use all processor cores to build" OFF)
|
2010-01-12 21:09:16 +00:00
|
|
|
|
|
|
|
############################################################################
|
|
|
|
# Check for compiler quirks and features
|
|
|
|
############################################################################
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-std=gnu++0x" USE_GCC_STD_0X)
|
|
|
|
if(USE_GCC_STD_0X)
|
|
|
|
list(APPEND OC_CXX_FLAGS "-std=gnu++0x")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# ck 09-09-20: CMAKE_REQUIRED_FLAGS requires a string, not a list.
|
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
foreach(FLAG ${OC_CXX_FLAGS})
|
|
|
|
set(OC_REQUIRED_FLAGS "${OC_REQUIRED_FLAGS} ${FLAG}")
|
|
|
|
endforeach()
|
|
|
|
set(CMAKE_REQUIRED_FLAGS ${OC_REQUIRED_FLAGS})
|
|
|
|
CHECK_CXX_SOURCE_COMPILES("void f(struct D&&); int main() { return 0; }" HAVE_RVALUE_REF)
|
2010-01-24 01:48:55 +00:00
|
|
|
CHECK_CXX_SOURCE_COMPILES("int main() { void *d = nullptr; }" HAVE_NULLPTR)
|
|
|
|
if(HAVE_NULLPTR)
|
|
|
|
CHECK_CXX_SOURCE_COMPILES("#include <cstddef>
|
|
|
|
template<class T> void f(T &&); template<> void f(std::nullptr_t &&) {} int main() { f(NULL); }" NULL_IS_NULLPTR_T)
|
|
|
|
endif()
|
2010-01-12 21:09:16 +00:00
|
|
|
|
|
|
|
if(MSVC_VERSION GREATER 1499)
|
|
|
|
# Activate minimal rebuild
|
2010-04-18 18:10:24 +00:00
|
|
|
if(OC_BUILD_MULTIPROCESSOR)
|
|
|
|
list(APPEND OC_CXX_FLAGS /MP)
|
|
|
|
else()
|
|
|
|
list(APPEND OC_CXX_FLAGS_DEBUG /Gm)
|
|
|
|
endif()
|
2010-02-28 00:42:57 +00:00
|
|
|
if (NOT CMAKE_CL_64)
|
2010-01-12 21:09:16 +00:00
|
|
|
# Activate edit-and-continue
|
|
|
|
list(REMOVE_ITEM OC_CXX_FLAGS_DEBUG /Zi)
|
|
|
|
list(APPEND OC_CXX_FLAGS_DEBUG /ZI /Gy)
|
|
|
|
endif()
|
|
|
|
set(HAVE_PRECOMPILED_HEADERS ON CACHE INTERNAL "Compiler supports precompiled headers")
|
|
|
|
endif()
|
|
|
|
if(MSVC_VERSION)
|
|
|
|
# Suppress warnings about "non-secure" functions
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
|
|
|
|
# Disable warning C4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
|
|
|
list(APPEND OC_CXX_FLAGS "/wd4244")
|
|
|
|
endif()
|
|
|
|
|
2010-03-22 22:28:54 +00:00
|
|
|
############################################################################
|
|
|
|
# Generate hgrevision.h
|
|
|
|
############################################################################
|
|
|
|
if(CMAKE_HOST_WIN32 AND NOT CMAKE_HOST_UNIX)
|
|
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hgrevision.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/.hg/dirstate
|
|
|
|
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/get_hg_revision.bat" > "${CMAKE_CURRENT_BINARY_DIR}/hgrevision.h"
|
|
|
|
VERBATIM)
|
|
|
|
else()
|
|
|
|
# Assume all non-windows system to have /bin/sh.
|
|
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hgrevision.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/.hg/dirstate
|
|
|
|
COMMAND /bin/sh "${CMAKE_CURRENT_SOURCE_DIR}/tools/get_hg_revision.sh" > "${CMAKE_CURRENT_BINARY_DIR}/hgrevision.h"
|
|
|
|
VERBATIM)
|
|
|
|
endif()
|
|
|
|
|
2009-10-20 03:39:24 +00:00
|
|
|
############################################################################
|
|
|
|
# List target source files. Don't directly create a target since we condi-
|
|
|
|
# tionally add more sources depending on configuration options later.
|
|
|
|
############################################################################
|
|
|
|
# OC_CLONK_SOURCES: Sources for OpenClonk that are needed by every build.
|
|
|
|
# OC_SYSTEM_SOURCES: Sources for OpenClonk that are only needed by specific
|
|
|
|
# configurations.
|
2009-08-12 13:01:14 +00:00
|
|
|
set(OC_CLONK_SOURCES
|
|
|
|
src/C4Application.cpp
|
|
|
|
src/C4Application.h
|
|
|
|
src/C4FullScreen.cpp
|
|
|
|
src/C4FullScreen.h
|
|
|
|
src/C4Game.cpp
|
|
|
|
src/C4Game.h
|
2009-11-25 15:04:32 +00:00
|
|
|
src/C4Globals.cpp
|
2009-08-12 13:01:14 +00:00
|
|
|
src/C4GraphicsSystem.cpp
|
|
|
|
src/C4GraphicsSystem.h
|
|
|
|
src/c4group/C4Components.h
|
2009-08-13 23:46:32 +00:00
|
|
|
src/c4group/C4ComponentHost.cpp
|
|
|
|
src/c4group/C4ComponentHost.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/c4group/C4Extra.cpp
|
|
|
|
src/c4group/C4Extra.h
|
|
|
|
src/c4group/C4Group.cpp
|
|
|
|
src/c4group/C4Group.h
|
|
|
|
src/c4group/C4GroupSet.cpp
|
|
|
|
src/c4group/C4GroupSet.h
|
2009-08-13 23:46:32 +00:00
|
|
|
src/c4group/C4LangStringTable.cpp
|
|
|
|
src/c4group/C4LangStringTable.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/c4group/C4Language.cpp
|
|
|
|
src/c4group/C4Language.h
|
|
|
|
src/c4group/C4Update.cpp
|
|
|
|
src/c4group/C4Update.h
|
|
|
|
src/c4group/CStdFile.cpp
|
|
|
|
src/c4group/CStdFile.h
|
|
|
|
src/C4Include.h
|
|
|
|
src/C4Prototypes.h
|
|
|
|
src/C4Version.h
|
|
|
|
src/C4WinMain.cpp
|
|
|
|
src/config/C4Config.cpp
|
|
|
|
src/config/C4Config.h
|
|
|
|
src/config/C4ConfigShareware.cpp
|
|
|
|
src/config/C4ConfigShareware.h
|
2009-08-12 20:03:50 +00:00
|
|
|
src/config/C4Constants.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/config/C4SecurityCertificates.cpp
|
|
|
|
src/config/C4SecurityCertificates.h
|
|
|
|
src/control/C4Control.cpp
|
|
|
|
src/control/C4Control.h
|
|
|
|
src/control/C4GameControl.cpp
|
|
|
|
src/control/C4GameControl.h
|
|
|
|
src/control/C4GameParameters.cpp
|
|
|
|
src/control/C4GameParameters.h
|
|
|
|
src/control/C4GameSave.cpp
|
|
|
|
src/control/C4GameSave.h
|
2009-08-12 15:27:43 +00:00
|
|
|
src/control/C4PlayerControl.cpp
|
|
|
|
src/control/C4PlayerControl.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/control/C4PlayerInfoConflicts.cpp
|
|
|
|
src/control/C4PlayerInfo.cpp
|
|
|
|
src/control/C4PlayerInfo.h
|
|
|
|
src/control/C4Record.cpp
|
|
|
|
src/control/C4Record.h
|
|
|
|
src/control/C4RoundResults.cpp
|
|
|
|
src/control/C4RoundResults.h
|
|
|
|
src/control/C4Teams.cpp
|
|
|
|
src/control/C4Teams.h
|
|
|
|
src/editor/C4Console.cpp
|
|
|
|
src/editor/C4Console.h
|
|
|
|
src/editor/C4DevmodeDlg.cpp
|
|
|
|
src/editor/C4DevmodeDlg.h
|
|
|
|
src/editor/C4EditCursor.cpp
|
|
|
|
src/editor/C4EditCursor.h
|
|
|
|
src/editor/C4ObjectListDlg.cpp
|
|
|
|
src/editor/C4ObjectListDlg.h
|
|
|
|
src/editor/C4PropertyDlg.cpp
|
|
|
|
src/editor/C4PropertyDlg.h
|
|
|
|
src/editor/C4ToolsDlg.cpp
|
|
|
|
src/editor/C4ToolsDlg.h
|
|
|
|
src/game/C4GameVersion.h
|
|
|
|
src/game/C4Physics.h
|
|
|
|
src/game/landscape/C4Landscape.cpp
|
|
|
|
src/game/landscape/C4Landscape.h
|
|
|
|
src/game/landscape/C4Map.cpp
|
|
|
|
src/game/landscape/C4MapCreatorS2.cpp
|
|
|
|
src/game/landscape/C4MapCreatorS2.h
|
|
|
|
src/game/landscape/C4Map.h
|
|
|
|
src/game/landscape/C4MassMover.cpp
|
|
|
|
src/game/landscape/C4MassMover.h
|
|
|
|
src/game/landscape/C4Material.cpp
|
|
|
|
src/game/landscape/C4Material.h
|
|
|
|
src/game/landscape/C4MaterialList.cpp
|
|
|
|
src/game/landscape/C4MaterialList.h
|
|
|
|
src/game/landscape/C4Particles.cpp
|
|
|
|
src/game/landscape/C4Particles.h
|
|
|
|
src/game/landscape/C4PathFinder.cpp
|
|
|
|
src/game/landscape/C4PathFinder.h
|
|
|
|
src/game/landscape/C4PXS.cpp
|
|
|
|
src/game/landscape/C4PXS.h
|
|
|
|
src/game/landscape/C4Region.cpp
|
|
|
|
src/game/landscape/C4Region.h
|
|
|
|
src/game/landscape/C4Scenario.cpp
|
|
|
|
src/game/landscape/C4Scenario.h
|
|
|
|
src/game/landscape/C4Sky.cpp
|
|
|
|
src/game/landscape/C4Sky.h
|
|
|
|
src/game/landscape/C4SolidMask.cpp
|
|
|
|
src/game/landscape/C4SolidMask.h
|
|
|
|
src/game/landscape/C4Texture.cpp
|
|
|
|
src/game/landscape/C4Texture.h
|
|
|
|
src/game/landscape/C4Weather.cpp
|
|
|
|
src/game/landscape/C4Weather.h
|
|
|
|
src/game/object/C4Action.cpp
|
|
|
|
src/game/object/C4Command.cpp
|
|
|
|
src/game/object/C4Command.h
|
|
|
|
src/game/object/C4Def.cpp
|
|
|
|
src/game/object/C4DefGraphics.cpp
|
|
|
|
src/game/object/C4DefGraphics.h
|
|
|
|
src/game/object/C4Def.h
|
|
|
|
src/game/object/C4GameObjects.cpp
|
|
|
|
src/game/object/C4GameObjects.h
|
|
|
|
src/game/object/C4Id.cpp
|
|
|
|
src/game/object/C4Id.h
|
|
|
|
src/game/object/C4IDList.cpp
|
|
|
|
src/game/object/C4IDList.h
|
|
|
|
src/game/object/C4InfoCore.cpp
|
|
|
|
src/game/object/C4InfoCore.h
|
2010-01-22 18:27:02 +00:00
|
|
|
src/game/object/C4MeshAnimation.cpp
|
|
|
|
src/game/object/C4MeshAnimation.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/game/object/C4Movement.cpp
|
|
|
|
src/game/object/C4ObjectCom.cpp
|
|
|
|
src/game/object/C4ObjectCom.h
|
|
|
|
src/game/object/C4Object.cpp
|
|
|
|
src/game/object/C4Object.h
|
|
|
|
src/game/object/C4ObjectInfo.cpp
|
|
|
|
src/game/object/C4ObjectInfo.h
|
|
|
|
src/game/object/C4ObjectInfoList.cpp
|
|
|
|
src/game/object/C4ObjectInfoList.h
|
|
|
|
src/game/object/C4ObjectList.cpp
|
|
|
|
src/game/object/C4ObjectList.h
|
|
|
|
src/game/object/C4ObjectMenu.cpp
|
|
|
|
src/game/object/C4ObjectMenu.h
|
2010-03-30 21:08:15 +00:00
|
|
|
src/game/object/C4ObjectPtr.cpp
|
|
|
|
src/game/object/C4ObjectPtr.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/game/object/C4Sector.cpp
|
|
|
|
src/game/object/C4Sector.h
|
|
|
|
src/game/object/C4Shape.cpp
|
|
|
|
src/game/object/C4Shape.h
|
|
|
|
src/game/player/C4Player.cpp
|
|
|
|
src/game/player/C4Player.h
|
|
|
|
src/game/player/C4PlayerList.cpp
|
|
|
|
src/game/player/C4PlayerList.h
|
|
|
|
src/game/player/C4RankSystem.cpp
|
|
|
|
src/game/player/C4RankSystem.h
|
|
|
|
src/game/script/C4Effect.cpp
|
|
|
|
src/game/script/C4Effects.h
|
|
|
|
src/game/script/C4FindObject.cpp
|
|
|
|
src/game/script/C4FindObject.h
|
|
|
|
src/game/script/C4Script.cpp
|
|
|
|
src/game/script/C4Script.h
|
|
|
|
src/game/script/C4TransferZone.cpp
|
|
|
|
src/game/script/C4TransferZone.h
|
|
|
|
src/gui/C4ChatDlg.cpp
|
|
|
|
src/gui/C4ChatDlg.h
|
|
|
|
src/gui/C4DownloadDlg.cpp
|
|
|
|
src/gui/C4DownloadDlg.h
|
|
|
|
src/gui/C4FileSelDlg.cpp
|
|
|
|
src/gui/C4FileSelDlg.h
|
|
|
|
src/gui/C4Folder.cpp
|
|
|
|
src/gui/C4Folder.h
|
|
|
|
src/gui/C4GameDialogs.cpp
|
|
|
|
src/gui/C4GameDialogs.h
|
|
|
|
src/gui/C4GameLobby.cpp
|
|
|
|
src/gui/C4GameLobby.h
|
|
|
|
src/gui/C4GameMessage.cpp
|
|
|
|
src/gui/C4GameMessage.h
|
|
|
|
src/gui/C4GameOptions.cpp
|
|
|
|
src/gui/C4GameOptions.h
|
|
|
|
src/gui/C4GameOverDlg.cpp
|
|
|
|
src/gui/C4GameOverDlg.h
|
|
|
|
src/gui/C4GuiButton.cpp
|
|
|
|
src/gui/C4GuiCheckBox.cpp
|
|
|
|
src/gui/C4GuiComboBox.cpp
|
|
|
|
src/gui/C4GuiContainers.cpp
|
|
|
|
src/gui/C4Gui.cpp
|
|
|
|
src/gui/C4GuiDialogs.cpp
|
|
|
|
src/gui/C4GuiEdit.cpp
|
|
|
|
src/gui/C4Gui.h
|
|
|
|
src/gui/C4GuiLabels.cpp
|
|
|
|
src/gui/C4GuiListBox.cpp
|
|
|
|
src/gui/C4GuiMenu.cpp
|
|
|
|
src/gui/C4GuiTabular.cpp
|
|
|
|
src/gui/C4KeyboardInput.cpp
|
|
|
|
src/gui/C4KeyboardInput.h
|
|
|
|
src/gui/C4LoaderScreen.cpp
|
|
|
|
src/gui/C4LoaderScreen.h
|
|
|
|
src/gui/C4MainMenu.cpp
|
|
|
|
src/gui/C4MainMenu.h
|
|
|
|
src/gui/C4Menu.cpp
|
|
|
|
src/gui/C4Menu.h
|
|
|
|
src/gui/C4MessageBoard.cpp
|
|
|
|
src/gui/C4MessageBoard.h
|
|
|
|
src/gui/C4MessageInput.cpp
|
|
|
|
src/gui/C4MessageInput.h
|
|
|
|
src/gui/C4MouseControl.cpp
|
|
|
|
src/gui/C4MouseControl.h
|
|
|
|
src/gui/C4PlayerInfoListBox.cpp
|
|
|
|
src/gui/C4PlayerInfoListBox.h
|
|
|
|
src/gui/C4Scoreboard.cpp
|
|
|
|
src/gui/C4Scoreboard.h
|
|
|
|
src/gui/C4StartupAboutDlg.cpp
|
|
|
|
src/gui/C4StartupAboutDlg.h
|
|
|
|
src/gui/C4Startup.cpp
|
|
|
|
src/gui/C4Startup.h
|
|
|
|
src/gui/C4StartupMainDlg.cpp
|
|
|
|
src/gui/C4StartupMainDlg.h
|
|
|
|
src/gui/C4StartupNetDlg.cpp
|
|
|
|
src/gui/C4StartupNetDlg.h
|
|
|
|
src/gui/C4StartupOptionsDlg.cpp
|
|
|
|
src/gui/C4StartupOptionsDlg.h
|
|
|
|
src/gui/C4StartupPlrSelDlg.cpp
|
|
|
|
src/gui/C4StartupPlrSelDlg.h
|
|
|
|
src/gui/C4StartupScenSelDlg.cpp
|
|
|
|
src/gui/C4StartupScenSelDlg.h
|
|
|
|
src/gui/C4UpdateDlg.cpp
|
|
|
|
src/gui/C4UpdateDlg.h
|
|
|
|
src/gui/C4UpperBoard.cpp
|
|
|
|
src/gui/C4UpperBoard.h
|
|
|
|
src/gui/C4UserMessages.h
|
|
|
|
src/gui/C4Viewport.cpp
|
|
|
|
src/gui/C4Viewport.h
|
|
|
|
src/lib/C4InputValidation.cpp
|
|
|
|
src/lib/C4InputValidation.h
|
|
|
|
src/lib/C4LogBuf.cpp
|
|
|
|
src/lib/C4LogBuf.h
|
|
|
|
src/lib/C4Log.cpp
|
|
|
|
src/lib/C4Log.h
|
|
|
|
src/lib/C4NameList.cpp
|
|
|
|
src/lib/C4NameList.h
|
|
|
|
src/lib/C4Random.cpp
|
|
|
|
src/lib/C4Random.h
|
2009-08-13 23:46:32 +00:00
|
|
|
src/lib/C4Rect.cpp
|
|
|
|
src/lib/C4Rect.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/lib/C4RTF.cpp
|
2009-12-30 19:42:31 +00:00
|
|
|
src/lib/C4RTF.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/lib/C4Stat.cpp
|
|
|
|
src/lib/C4Stat.h
|
|
|
|
src/lib/Fixed.cpp
|
|
|
|
src/lib/Fixed.h
|
|
|
|
src/lib/PathFinder.cpp
|
|
|
|
src/lib/PathFinder.h
|
|
|
|
src/lib/Standard.cpp
|
|
|
|
src/lib/Standard.h
|
|
|
|
src/lib/StdAdaptors.h
|
|
|
|
src/lib/StdBase64.cpp
|
|
|
|
src/lib/StdBase64.h
|
|
|
|
src/lib/StdBuf.cpp
|
|
|
|
src/lib/StdBuf.h
|
|
|
|
src/lib/StdColors.h
|
|
|
|
src/lib/StdCompiler.cpp
|
|
|
|
src/lib/StdCompiler.h
|
|
|
|
src/lib/StdMarkup.cpp
|
|
|
|
src/lib/StdMarkup.h
|
|
|
|
src/lib/StdResStr2.cpp
|
|
|
|
src/lib/StdResStr2.h
|
|
|
|
src/lib/StdResStr.h
|
|
|
|
src/lib/texture/C4Facet.cpp
|
|
|
|
src/lib/texture/C4FacetEx.cpp
|
|
|
|
src/lib/texture/C4FacetEx.h
|
|
|
|
src/lib/texture/C4Facet.h
|
|
|
|
src/lib/texture/C4GraphicsResource.cpp
|
|
|
|
src/lib/texture/C4GraphicsResource.h
|
|
|
|
src/lib/texture/C4Surface.cpp
|
|
|
|
src/lib/texture/C4SurfaceFile.cpp
|
|
|
|
src/lib/texture/C4SurfaceFile.h
|
|
|
|
src/lib/texture/C4Surface.h
|
|
|
|
src/lib/texture/StdPNG.cpp
|
|
|
|
src/lib/texture/StdPNG.h
|
|
|
|
src/network/C4Client.cpp
|
|
|
|
src/network/C4Client.h
|
|
|
|
src/network/C4GameControlNetwork.cpp
|
|
|
|
src/network/C4GameControlNetwork.h
|
|
|
|
src/network/C4InteractiveThread.cpp
|
|
|
|
src/network/C4InteractiveThread.h
|
|
|
|
src/network/C4League.cpp
|
|
|
|
src/network/C4League.h
|
|
|
|
src/network/C4NetIO.cpp
|
|
|
|
src/network/C4NetIO.h
|
|
|
|
src/network/C4Network2Client.cpp
|
|
|
|
src/network/C4Network2Client.h
|
|
|
|
src/network/C4Network2.cpp
|
|
|
|
src/network/C4Network2Dialogs.cpp
|
|
|
|
src/network/C4Network2Dialogs.h
|
|
|
|
src/network/C4Network2Discover.cpp
|
|
|
|
src/network/C4Network2Discover.h
|
|
|
|
src/network/C4Network2.h
|
|
|
|
src/network/C4Network2IO.cpp
|
|
|
|
src/network/C4Network2IO.h
|
|
|
|
src/network/C4Network2IRC.cpp
|
|
|
|
src/network/C4Network2IRC.h
|
|
|
|
src/network/C4Network2Players.cpp
|
|
|
|
src/network/C4Network2Players.h
|
|
|
|
src/network/C4Network2Reference.cpp
|
|
|
|
src/network/C4Network2Reference.h
|
|
|
|
src/network/C4Network2Res.cpp
|
|
|
|
src/network/C4Network2ResDlg.cpp
|
|
|
|
src/network/C4Network2Res.h
|
|
|
|
src/network/C4Network2Stats.cpp
|
|
|
|
src/network/C4Network2Stats.h
|
|
|
|
src/network/C4Packet2.cpp
|
|
|
|
src/network/C4PacketBase.h
|
|
|
|
src/platform/Bitmap256.cpp
|
|
|
|
src/platform/Bitmap256.h
|
|
|
|
src/platform/C4FileClasses.h
|
|
|
|
src/platform/C4FileMonitor.cpp
|
|
|
|
src/platform/C4FileMonitor.h
|
|
|
|
src/platform/C4Fonts.cpp
|
|
|
|
src/platform/C4Fonts.h
|
|
|
|
src/platform/C4GamePadCon.cpp
|
|
|
|
src/platform/C4GamePadCon.h
|
|
|
|
src/platform/C4MusicFile.cpp
|
|
|
|
src/platform/C4MusicFile.h
|
|
|
|
src/platform/C4MusicSystem.cpp
|
|
|
|
src/platform/C4MusicSystem.h
|
|
|
|
src/platform/C4SoundSystem.cpp
|
|
|
|
src/platform/C4SoundSystem.h
|
|
|
|
src/platform/C4Video.cpp
|
|
|
|
src/platform/C4Video.h
|
|
|
|
src/platform/C4VideoPlayback.cpp
|
|
|
|
src/platform/C4VideoPlayback.h
|
|
|
|
src/platform/OpenURL.cpp
|
2010-03-08 22:59:11 +00:00
|
|
|
src/platform/PlatformAbstraction.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/platform/StdConfig.cpp
|
|
|
|
src/platform/StdConfig.h
|
|
|
|
src/platform/StdD3D.cpp
|
|
|
|
src/platform/StdD3D.h
|
|
|
|
src/platform/StdD3DShader.cpp
|
|
|
|
src/platform/StdD3DShader.h
|
|
|
|
src/platform/StdDDraw2.cpp
|
|
|
|
src/platform/StdDDraw2.h
|
|
|
|
src/platform/StdFacet.h
|
|
|
|
src/platform/StdFile.cpp
|
|
|
|
src/platform/StdFile.h
|
|
|
|
src/platform/StdFont.cpp
|
|
|
|
src/platform/StdFont.h
|
|
|
|
src/platform/StdGL.cpp
|
|
|
|
src/platform/StdGLCtx.cpp
|
|
|
|
src/platform/StdGL.h
|
2009-08-28 01:35:55 +00:00
|
|
|
src/platform/StdMesh.cpp
|
|
|
|
src/platform/StdMesh.h
|
2010-03-02 16:12:28 +00:00
|
|
|
src/platform/StdMeshLoader.h
|
|
|
|
src/platform/StdMeshLoaderBinary.cpp
|
|
|
|
src/platform/StdMeshLoaderBinaryChunks.cpp
|
|
|
|
src/platform/StdMeshLoaderBinaryChunks.h
|
|
|
|
src/platform/StdMeshLoaderDataStream.h
|
|
|
|
src/platform/StdMeshLoaderXml.cpp
|
2009-08-28 01:35:55 +00:00
|
|
|
src/platform/StdMeshMaterial.cpp
|
|
|
|
src/platform/StdMeshMaterial.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/platform/StdNoGfx.cpp
|
|
|
|
src/platform/StdNoGfx.h
|
|
|
|
src/platform/StdRegistry.cpp
|
|
|
|
src/platform/StdRegistry.h
|
|
|
|
src/platform/StdScheduler.cpp
|
|
|
|
src/platform/StdScheduler.h
|
|
|
|
src/platform/StdSurface2.cpp
|
|
|
|
src/platform/StdSurface2.h
|
|
|
|
src/platform/StdSurface8.cpp
|
|
|
|
src/platform/StdSurface8.h
|
|
|
|
src/platform/StdSync.h
|
|
|
|
src/platform/StdVideo.cpp
|
|
|
|
src/platform/StdVideo.h
|
|
|
|
src/platform/StdWindow.h
|
|
|
|
src/script/C4AList.cpp
|
|
|
|
src/script/C4AList.h
|
|
|
|
src/script/C4Aul.cpp
|
2010-02-24 16:40:18 +00:00
|
|
|
src/script/C4AulExec.h
|
2009-08-12 13:01:14 +00:00
|
|
|
src/script/C4AulExec.cpp
|
2010-02-24 16:40:18 +00:00
|
|
|
src/script/C4AulDebug.h
|
|
|
|
src/script/C4AulDebug.cpp
|
2009-08-12 13:01:14 +00:00
|
|
|
src/script/C4Aul.h
|
|
|
|
src/script/C4AulLink.cpp
|
|
|
|
src/script/C4AulParse.cpp
|
|
|
|
src/script/C4PropList.cpp
|
|
|
|
src/script/C4PropList.h
|
|
|
|
src/script/C4ScriptHost.cpp
|
|
|
|
src/script/C4ScriptHost.h
|
|
|
|
src/script/C4StringTable.cpp
|
|
|
|
src/script/C4StringTable.h
|
|
|
|
src/script/C4Value.cpp
|
|
|
|
src/script/C4Value.h
|
|
|
|
src/script/C4ValueList.cpp
|
|
|
|
src/script/C4ValueList.h
|
|
|
|
src/script/C4ValueMap.cpp
|
|
|
|
src/script/C4ValueMap.h
|
2009-08-28 01:35:55 +00:00
|
|
|
src/tinyxml/tinystr.cpp
|
|
|
|
src/tinyxml/tinystr.h
|
|
|
|
src/tinyxml/tinyxml.cpp
|
|
|
|
src/tinyxml/tinyxml.h
|
|
|
|
src/tinyxml/tinyxmlerror.cpp
|
|
|
|
src/tinyxml/tinyxmlparser.cpp
|
2009-08-12 13:01:14 +00:00
|
|
|
src/zlib/gzio.c
|
|
|
|
src/zlib/zutil.h
|
2010-03-22 22:28:54 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/hgrevision.h
|
2009-08-12 13:01:14 +00:00
|
|
|
)
|
|
|
|
mark_as_advanced(OC_CLONK_SOURCES)
|
2009-08-12 20:44:09 +00:00
|
|
|
mark_as_advanced(OC_SYSTEM_SOURCES)
|
2009-08-12 13:01:14 +00:00
|
|
|
|
2009-05-29 21:05:50 +00:00
|
|
|
if(WIN32)
|
2009-08-12 13:01:14 +00:00
|
|
|
list(APPEND OC_SYSTEM_SOURCES
|
2009-08-10 15:59:18 +00:00
|
|
|
src/platform/StdWindow.cpp
|
|
|
|
src/platform/StdJoystick.cpp
|
|
|
|
src/platform/StdJoystick.h
|
|
|
|
src/platform/C4FileClasses.cpp
|
|
|
|
src/res/resource.h
|
2009-05-29 21:05:50 +00:00
|
|
|
)
|
2010-02-20 21:25:57 +00:00
|
|
|
|
|
|
|
if(MINGW)
|
|
|
|
# cmake does not support compiling resources with MinGW
|
|
|
|
# natively, see http://www.cmake.org/Bug/view.php?id=4068.
|
|
|
|
# cross-compiler sets CMAKE_RC_COMPILER in toolchain file
|
|
|
|
if(NOT CMAKE_RC_COMPILER)
|
|
|
|
SET(CMAKE_RC_COMPILER windres)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/engine_rc.o
|
|
|
|
COMMAND ${CMAKE_RC_COMPILER} -I${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
|
|
-i${CMAKE_CURRENT_SOURCE_DIR}/src/res/engine.rc
|
|
|
|
-o ${CMAKE_CURRENT_BINARY_DIR}/engine_rc.o)
|
|
|
|
|
|
|
|
list(APPEND OC_SYSTEM_SOURCES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/engine_rc.o
|
|
|
|
)
|
|
|
|
else(MINGW)
|
|
|
|
list(APPEND OC_SYSTEM_SOURCES
|
|
|
|
src/res/engine.rc
|
|
|
|
)
|
|
|
|
endif(MINGW)
|
2009-08-16 16:27:44 +00:00
|
|
|
elseif(USE_SDL_MAINLOOP)
|
2009-08-12 13:01:14 +00:00
|
|
|
list(APPEND OC_SYSTEM_SOURCES
|
2009-08-10 15:59:18 +00:00
|
|
|
src/platform/StdSDLApp.cpp
|
|
|
|
src/platform/StdSDLWindow.cpp
|
2009-05-29 21:05:50 +00:00
|
|
|
)
|
|
|
|
elseif(USE_X11)
|
2009-08-12 13:01:14 +00:00
|
|
|
list(APPEND OC_SYSTEM_SOURCES
|
2009-08-10 15:59:18 +00:00
|
|
|
src/platform/StdXApp.cpp
|
|
|
|
src/platform/StdXWindow.cpp
|
|
|
|
src/platform/StdXPrivate.h
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(APPLE)
|
2009-08-12 13:01:14 +00:00
|
|
|
list(APPEND OC_SYSTEM_SOURCES
|
2009-08-10 15:59:18 +00:00
|
|
|
src/platform/MacUtility.mm
|
2010-02-11 13:19:13 +00:00
|
|
|
src/platform/StdMacApp.mm
|
2009-05-29 21:05:50 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(USE_GTK)
|
2009-08-12 13:01:14 +00:00
|
|
|
list(APPEND OC_CLONK_SOURCES
|
|
|
|
src/res/Brush.h
|
|
|
|
src/res/Cursor.h
|
|
|
|
src/res/Dynamic.h
|
|
|
|
src/res/Exact.h
|
|
|
|
src/res/Fill.h
|
|
|
|
src/res/Halt.h
|
|
|
|
src/res/Ift.h
|
|
|
|
src/res/Line.h
|
|
|
|
src/res/Mouse.h
|
|
|
|
src/res/NoIft.h
|
|
|
|
src/res/Picker.h
|
|
|
|
src/res/Play.h
|
|
|
|
src/res/Rect.h
|
|
|
|
src/res/resource.h
|
|
|
|
src/res/Static.h
|
|
|
|
)
|
|
|
|
|
|
|
|
list(APPEND OC_SYSTEM_SOURCES
|
2009-08-10 15:59:18 +00:00
|
|
|
src/platform/StdGtkWindow.cpp
|
|
|
|
src/platform/StdGtkWindow.h
|
2009-05-29 21:05:50 +00:00
|
|
|
)
|
|
|
|
endif()
|
2009-08-10 15:59:18 +00:00
|
|
|
|
2009-08-29 21:12:31 +00:00
|
|
|
if(PROJECT_FOLDERS)
|
|
|
|
source_group("Unsorted" .*)
|
|
|
|
source_group("Library\\Platform abstraction" src/platform/.*)
|
|
|
|
source_group("Library\\Utility" src/lib/.*)
|
|
|
|
source_group("Library\\C4Group" src/c4group/.*)
|
|
|
|
source_group("Library\\Graphics" src/lib/texture/.*)
|
|
|
|
source_group("GUI" src/gui/.*)
|
|
|
|
source_group("Network" src/network/.*)
|
|
|
|
source_group("Game\\Objects" src/game/object/.*)
|
|
|
|
source_group("Game\\Scenario" src/game/landscape/.*)
|
|
|
|
source_group("Game\\Player" src/game/player/.*)
|
|
|
|
source_group("Game\\Script" src/game/script/.*)
|
|
|
|
source_group("Scripting" src/script/.*)
|
|
|
|
source_group("Config" src/config/.*)
|
|
|
|
source_group("Control" src/control/.*)
|
|
|
|
source_group("Editing" src/editor/.*)
|
|
|
|
endif()
|
2009-08-12 13:15:05 +00:00
|
|
|
|
2009-05-29 20:53:15 +00:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2009-08-10 15:59:18 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/c4group
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/network
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/lib
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/platform
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/config
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/res
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/control
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/gui
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/editor
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/game/landscape
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/game/player
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/game/script
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/game
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/game/object
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/texture
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/script
|
2009-05-29 20:53:15 +00:00
|
|
|
)
|
|
|
|
|
2009-10-20 03:39:24 +00:00
|
|
|
############################################################################
|
|
|
|
# Check for required system headers
|
|
|
|
############################################################################
|
2009-05-29 20:53:15 +00:00
|
|
|
include(CheckIncludeFileCXX)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(direct.h HAVE_DIRECT_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(io.h HAVE_IO_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(locale.h HAVE_LOCALE_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(share.h HAVE_SHARE_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(signal.h HAVE_SIGNAL_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(stdint.h HAVE_STDINT_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(sys/stat.h HAVE_SYS_STAT_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(sys/types.h HAVE_SYS_TYPES_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(unistd.h HAVE_UNISTD_H)
|
2009-05-29 21:05:50 +00:00
|
|
|
CHECK_INCLUDE_FILE_CXX(execinfo.h HAVE_EXECINFO_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(langinfo.h HAVE_LANGINFO_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(poll.h HAVE_POLL_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(sys/inotify.h HAVE_SYS_INOTIFY_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(sys/socket.h HAVE_SYS_SOCKET_H)
|
2009-09-20 20:03:44 +00:00
|
|
|
|
|
|
|
# ck 09-09-20: The following headers require Xlib.h for things such as
|
|
|
|
# 'Bool' and 'Window' to be defined. Unfortunately, this doesn't exist
|
|
|
|
# as a CXX version (yet?).
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
CHECK_INCLUDE_FILES(X11/Xlib.h X11/extensions/xf86vmode.h HAVE_X11_EXTENSIONS_XF86VMODE_H)
|
|
|
|
CHECK_INCLUDE_FILES(X11/Xlib.h X11/extensions/Xrandr.h HAVE_X11_EXTENSIONS_XRANDR_H)
|
|
|
|
CHECK_INCLUDE_FILES(X11/Xlib.h X11/keysym.h HAVE_X11_KEYSYM_H)
|
|
|
|
CHECK_INCLUDE_FILES(X11/Xlib.h X11/xpm.h HAVE_X11_XPM_H)
|
2009-05-29 21:05:50 +00:00
|
|
|
CHECK_INCLUDE_FILE_CXX(iconv.h HAVE_ICONV)
|
|
|
|
|
|
|
|
if(HAVE_ICONV)
|
|
|
|
SET(ICONV_CONST ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(CheckFunctionExists)
|
|
|
|
CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
|
2009-05-29 20:53:15 +00:00
|
|
|
|
2010-02-09 18:21:00 +00:00
|
|
|
if(HAVE_ICONV)
|
|
|
|
CHECK_FUNCTION_EXISTS(iconv HAVE_ICONV_WO_LINK)
|
|
|
|
mark_as_advanced(HAVE_ICONV_WO_LINK)
|
2010-02-09 18:01:53 +00:00
|
|
|
|
2010-02-09 18:21:00 +00:00
|
|
|
if(NOT HAVE_ICONV_WO_LINK)
|
|
|
|
FIND_LIBRARY( ICONV_LIBRARY NAMES iconv )
|
|
|
|
MARK_AS_ADVANCED( ICONV_LIBRARY )
|
|
|
|
endif()
|
2010-02-09 18:01:53 +00:00
|
|
|
endif()
|
|
|
|
|
2009-10-20 03:39:24 +00:00
|
|
|
############################################################################
|
|
|
|
# Locate necessary libraries
|
|
|
|
############################################################################
|
|
|
|
# Find win32 SDK, since a lot of users don't have the include path in their environment
|
2010-01-07 13:30:45 +00:00
|
|
|
if(MSVC)
|
2009-10-20 03:39:24 +00:00
|
|
|
get_filename_component(WINSDK_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
|
|
|
|
mark_as_advanced(WINSDK_ROOT)
|
|
|
|
include_directories(SYSTEM ${WINSDK_ROOT}/Include)
|
|
|
|
if(${FIND_LIBRARY_USE_LIB64_PATHS})
|
|
|
|
list(APPEND CMAKE_LIBRARY_PATH ${WINSDK_ROOT}/Lib/x64)
|
|
|
|
else()
|
|
|
|
list(APPEND CMAKE_LIBRARY_PATH ${WINSDK_ROOT}/Lib)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
SET(JPEG_NAMES ${JPEG_NAMES} libjpeg)
|
|
|
|
include(FindJPEG)
|
|
|
|
include(FindPNG)
|
|
|
|
include(FindZLIB)
|
2010-03-02 16:12:28 +00:00
|
|
|
include(FindBoost)
|
|
|
|
if(NOT Boost_INCLUDE_DIR)
|
|
|
|
message(SEND_ERROR "Could not find the Boost C++ Libraries")
|
2010-03-02 17:56:10 +00:00
|
|
|
else()
|
|
|
|
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
|
2010-03-02 16:12:28 +00:00
|
|
|
endif()
|
2009-10-20 03:39:24 +00:00
|
|
|
|
|
|
|
include(FindThreads)
|
|
|
|
if(NOT WIN32)
|
|
|
|
SET(HAVE_PTHREAD ${CMAKE_USE_PTHREADS_INIT} CACHE INTERNAL "libpthread available")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# isilkor 09-05-29: FindFreetype only checks for no-ver and 219
|
|
|
|
find_library(FREETYPE_LIBRARY NAMES freetype239)
|
|
|
|
include(FindFreetype)
|
|
|
|
include_directories(${FREETYPE_INCLUDE_DIRS})
|
|
|
|
SET(HAVE_FREETYPE ${FREETYPE_FOUND} CACHE INTERNAL "Rename of FREETYPE_FOUND for config.h")
|
|
|
|
|
|
|
|
# FINDLIB works the same as find_library, but also marks the resulting var as
|
|
|
|
# advanced so it doesn't show in GUIs by default
|
|
|
|
macro(FINDLIB lib)
|
|
|
|
find_library(${ARGV})
|
|
|
|
mark_as_advanced(${lib})
|
|
|
|
endmacro(FINDLIB)
|
|
|
|
# isilkor 09-05-29: Don't use FindOpenSSL, because that wants to link to ssleay
|
|
|
|
FINDLIB(OPENSSL_LIBRARIES NAMES crypto libeay32)
|
2010-04-18 20:02:01 +00:00
|
|
|
include(FindOpenSSL)
|
|
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
2009-10-20 03:39:24 +00:00
|
|
|
|
|
|
|
############################################################################
|
|
|
|
# Precompiled header support, part 1 (pre-target)
|
|
|
|
############################################################################
|
|
|
|
if(HAVE_PRECOMPILED_HEADERS)
|
2009-10-20 04:05:49 +00:00
|
|
|
if(MSVC_VERSION)
|
|
|
|
list(INSERT OC_SYSTEM_SOURCES 0 src/C4Include.cpp)
|
|
|
|
endif()
|
2009-10-20 03:39:24 +00:00
|
|
|
endif()
|
2009-05-29 20:53:15 +00:00
|
|
|
|
2009-10-20 03:39:24 +00:00
|
|
|
############################################################################
|
|
|
|
# Generate output files
|
|
|
|
############################################################################
|
|
|
|
add_definitions(-DHAVE_CONFIG_H)
|
|
|
|
add_executable(clonk WIN32 MACOSX_BUNDLE
|
|
|
|
${OC_SYSTEM_SOURCES}
|
|
|
|
${OC_CLONK_SOURCES}
|
|
|
|
)
|
|
|
|
add_executable(c4group
|
|
|
|
src/c4group/c4group_ng.cpp
|
|
|
|
src/c4group/C4Group.cpp
|
|
|
|
src/lib/C4InputValidation.cpp
|
|
|
|
src/config/C4SecurityCertificates.cpp
|
|
|
|
src/c4group/C4Update.cpp
|
|
|
|
src/lib/Standard.cpp
|
|
|
|
src/c4group/CStdFile.cpp
|
|
|
|
src/lib/StdMarkup.cpp
|
|
|
|
src/lib/StdBuf.cpp
|
|
|
|
src/lib/StdCompiler.cpp
|
|
|
|
src/platform/StdFile.cpp
|
|
|
|
src/platform/StdRegistry.cpp
|
|
|
|
src/lib/StdResStr2.cpp
|
|
|
|
src/platform/StdConfig.cpp
|
|
|
|
src/zlib/gzio.c
|
2009-10-23 13:24:12 +00:00
|
|
|
src/C4Include.cpp
|
2009-10-20 03:39:24 +00:00
|
|
|
)
|
|
|
|
target_link_libraries(clonk
|
|
|
|
${FREETYPE_LIBRARIES}
|
|
|
|
${ZLIB_LIBRARIES}
|
|
|
|
${PNG_LIBRARIES}
|
|
|
|
${JPEG_LIBRARIES}
|
|
|
|
${OPENSSL_LIBRARIES}
|
2010-02-09 18:01:53 +00:00
|
|
|
${ICONV_LIBRARY}
|
2009-10-20 03:39:24 +00:00
|
|
|
)
|
|
|
|
target_link_libraries(c4group
|
|
|
|
${ZLIB_LIBRARIES}
|
|
|
|
${OPENSSL_LIBRARIES}
|
|
|
|
)
|
2010-02-17 21:59:46 +00:00
|
|
|
set_property(TARGET clonk APPEND PROPERTY COMPILE_DEFINITIONS GLEW_STATIC)
|
2009-10-20 03:39:24 +00:00
|
|
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG _DEBUG)
|
|
|
|
|
2010-02-08 20:51:48 +00:00
|
|
|
############################################################################
|
|
|
|
# build to planet
|
|
|
|
############################################################################
|
|
|
|
if(BUILD_TO_PLANET)
|
|
|
|
if(MSVC) #get the files out of the Build folders
|
|
|
|
if(CMAKE_VERSION VERSION_LESS "2.8")
|
|
|
|
message(SEND_ERROR "You need CMake 2.8 or higher for BUILD_TO_PLANET to get the builds out of MSVCs folders. You have ${CMAKE_VERSION}")
|
|
|
|
else()
|
|
|
|
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_RELEASE "../Clonk")
|
|
|
|
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_DEBUG "../ClonkD")
|
|
|
|
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_MINSIZEREL "../ClonkMSR")
|
|
|
|
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_RELWITHDEBINFO "../ClonkRD")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/planet)
|
|
|
|
endif()
|
|
|
|
|
2009-10-20 03:39:24 +00:00
|
|
|
############################################################################
|
|
|
|
# Precompiled header support, part 2 (post-target)
|
|
|
|
############################################################################
|
|
|
|
if(HAVE_PRECOMPILED_HEADERS)
|
2009-10-20 04:05:49 +00:00
|
|
|
if(MSVC_VERSION)
|
|
|
|
get_property(OC_SOURCES TARGET clonk PROPERTY SOURCES)
|
|
|
|
foreach(FILE ${OC_SOURCES})
|
|
|
|
get_filename_component(FILE_EXT ${FILE} EXT)
|
2010-01-04 02:15:50 +00:00
|
|
|
get_filename_component(FILE_NAME_WE ${FILE} NAME_WE)
|
|
|
|
if(FILE_EXT STREQUAL ".cpp" AND NOT FILE_NAME_WE MATCHES "tiny.*")
|
2009-10-20 04:05:49 +00:00
|
|
|
# This check is necessary since gzio.c gets compiled as C
|
|
|
|
# code, which can't use C++ PCH.
|
|
|
|
set_property(SOURCE ${FILE} PROPERTY COMPILE_FLAGS /YuC4Include.h)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
set_property(SOURCE src/C4Include.cpp PROPERTY COMPILE_FLAGS /YcC4Include.h)
|
|
|
|
endif()
|
2009-10-20 03:39:24 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
############################################################################
|
|
|
|
# Assemble compiler flags
|
|
|
|
############################################################################
|
|
|
|
if(OC_CXX_FLAGS)
|
|
|
|
list(REMOVE_DUPLICATES OC_CXX_FLAGS)
|
|
|
|
endif()
|
|
|
|
set(CMAKE_CXX_FLAGS "" CACHE STRING "C++ compiler flags" FORCE)
|
|
|
|
foreach(FLAG ${OC_CXX_FLAGS})
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}" CACHE STRING "C++ compiler flags" FORCE)
|
|
|
|
endforeach()
|
|
|
|
list(REMOVE_DUPLICATES OC_CXX_FLAGS_DEBUG)
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
|
|
|
|
foreach(FLAG ${OC_CXX_FLAGS_DEBUG})
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
|
|
|
|
endforeach()
|
2009-05-29 20:53:15 +00:00
|
|
|
|
2009-10-20 03:39:24 +00:00
|
|
|
############################################################################
|
|
|
|
# Locate optional libraries (if so desired)
|
|
|
|
############################################################################
|
2009-05-29 20:53:15 +00:00
|
|
|
if(USE_GL)
|
|
|
|
include(FindOpenGL)
|
2009-08-16 12:17:27 +00:00
|
|
|
FINDLIB(GLEW_LIBRARIES NAMES GLEW glew32 glew32s)
|
2010-04-18 20:02:01 +00:00
|
|
|
FIND_PATH(GLEW_INCLUDE_DIR NAMES GL/glew.h)
|
2009-08-13 16:09:00 +00:00
|
|
|
target_link_libraries(clonk
|
2009-08-16 12:17:27 +00:00
|
|
|
${GLEW_LIBRARIES}
|
2009-08-15 19:55:26 +00:00
|
|
|
${OPENGL_LIBRARIES}
|
2009-08-13 16:09:00 +00:00
|
|
|
)
|
2010-04-18 20:02:01 +00:00
|
|
|
include_directories(${GLEW_INCLUDE_DIR})
|
2009-05-29 20:53:15 +00:00
|
|
|
endif()
|
|
|
|
if(USE_DIRECTX)
|
2009-08-16 12:17:27 +00:00
|
|
|
FINDLIB(DIRECT3D_LIBRARIES d3d9)
|
|
|
|
FINDLIB(DIRECT3DX_LIBRARIES d3dx9)
|
2010-04-18 20:02:01 +00:00
|
|
|
FIND_PATH(DIRECT3D_INCLUDE_DIR NAMES d3d9.h)
|
|
|
|
FIND_PATH(DIRECT3DX_INCLUDE_DIR NAMES d3dx9.h)
|
2009-08-13 16:09:00 +00:00
|
|
|
target_link_libraries(clonk
|
2009-08-16 12:17:27 +00:00
|
|
|
${DIRECT3D_LIBRARIES}
|
|
|
|
${DIRECT3DX_LIBRARIES}
|
2009-08-13 16:09:00 +00:00
|
|
|
)
|
2010-04-18 20:02:01 +00:00
|
|
|
include_directories(
|
|
|
|
${DIRECT3D_INCLUDE_DIR}
|
|
|
|
${DIRECT3DX_INCLUDE_DIR}
|
|
|
|
)
|
2009-05-29 20:53:15 +00:00
|
|
|
endif()
|
2009-05-29 21:05:50 +00:00
|
|
|
if(USE_GTK)
|
|
|
|
include(FindPkgConfig)
|
|
|
|
if (PKG_CONFIG_FOUND)
|
|
|
|
pkg_check_modules(GTK glib-2.0>=2.4 gtk+-2.0>=2.4)
|
|
|
|
endif()
|
|
|
|
if(GTK_FOUND)
|
|
|
|
include_directories(${GTK_INCLUDE_DIRS})
|
|
|
|
link_directories(${GTK_LIBRARY_DIRS})
|
|
|
|
SET(WITH_DEVELOPER_MODE ${GTK_FOUND})
|
|
|
|
SET(WITH_GLIB ${GTK_FOUND})
|
2009-08-13 16:09:00 +00:00
|
|
|
target_link_libraries(clonk
|
|
|
|
${GTK_LIBRARIES}
|
|
|
|
)
|
2009-05-29 21:05:50 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(USE_X11)
|
2009-08-16 12:17:27 +00:00
|
|
|
FINDLIB(X11_LIBRARIES X11)
|
|
|
|
FINDLIB(XPM_LIBRARIES Xpm)
|
|
|
|
FINDLIB(XXF86VM_LIBRARIES Xxf86vm)
|
|
|
|
FINDLIB(XRANDR_LIBRARIES Xrandr)
|
2009-08-13 16:09:00 +00:00
|
|
|
target_link_libraries(clonk
|
2009-08-16 12:17:27 +00:00
|
|
|
${X11_LIBRARIES}
|
|
|
|
${XPM_LIBRARIES}
|
|
|
|
${XXF86VM_LIBRARIES}
|
|
|
|
${XRANDR_LIBRARIES}
|
2009-08-13 16:09:00 +00:00
|
|
|
)
|
2009-05-29 21:05:50 +00:00
|
|
|
endif()
|
|
|
|
if (WIN32)
|
2010-01-07 13:30:45 +00:00
|
|
|
# CMake is too incompetent to check whether these libraries can be linked to
|
|
|
|
# So just pretend that everything is fine
|
2010-04-18 20:02:01 +00:00
|
|
|
FINDLIB(VFW32_LIBRARIES vfw32)
|
|
|
|
if (VFW32_LIBRARIES)
|
|
|
|
target_link_libraries(clonk vfw32)
|
|
|
|
else()
|
|
|
|
# Mingw64 has the AviStream* and _DrawDibDraw* symbols in
|
|
|
|
# other library files
|
|
|
|
target_link_libraries(clonk wavifil32 msvfw32)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_link_libraries(clonk ws2_32 winmm)
|
2010-01-07 13:30:45 +00:00
|
|
|
target_link_libraries(c4group ws2_32)
|
2009-05-29 20:53:15 +00:00
|
|
|
|
2009-11-02 13:18:47 +00:00
|
|
|
if(MSVC_VERSION)
|
2010-04-18 19:38:17 +00:00
|
|
|
if(CMAKE_CL_64)
|
|
|
|
FINDLIB(FMOD_LIBRARIES fmod64vc)
|
|
|
|
else()
|
|
|
|
FINDLIB(FMOD_LIBRARIES fmodvc)
|
|
|
|
endif()
|
2009-11-02 13:18:47 +00:00
|
|
|
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
FINDLIB(FMOD_LIBRARIES fmod)
|
|
|
|
endif()
|
|
|
|
if(FMOD_LIBRARIES)
|
|
|
|
set(HAVE_FMOD TRUE)
|
|
|
|
target_link_libraries(clonk
|
|
|
|
${FMOD_LIBRARIES}
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
set(HAVE_FMOD FALSE)
|
2009-07-11 17:44:14 +00:00
|
|
|
endif()
|
2009-07-11 01:14:57 +00:00
|
|
|
endif()
|
2010-02-09 18:01:53 +00:00
|
|
|
if(NOT HAVE_FMOD OR USE_SDL_MAINLOOP)
|
2009-11-02 13:18:47 +00:00
|
|
|
include(FindSDL)
|
|
|
|
SET(HAVE_SDL ${SDL_FOUND})
|
|
|
|
if(SDL_FOUND)
|
|
|
|
include_directories(${SDL_INCLUDE_DIR})
|
|
|
|
FINDLIB(SDLMIXER_LIBRARIES SDL_mixer)
|
|
|
|
if(SDLMIXER_LIBRARIES)
|
|
|
|
SET(HAVE_LIBSDL_MIXER ON)
|
|
|
|
endif()
|
|
|
|
target_link_libraries(clonk
|
|
|
|
${SDL_LIBRARY}
|
|
|
|
${SDLMIXER_LIBRARIES}
|
|
|
|
)
|
2009-07-12 16:46:54 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2009-05-29 20:53:15 +00:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|