2022-04-07 00:38:39 +00:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6...3.20)
|
2011-08-03 20:05:33 +00:00
|
|
|
PROJECT(Aquaria)
|
|
|
|
|
2022-04-07 00:38:39 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
|
|
|
|
2011-08-03 20:05:33 +00:00
|
|
|
INCLUDE(CheckCCompilerFlag)
|
2017-01-14 12:09:12 +00:00
|
|
|
INCLUDE(CheckCXXCompilerFlag)
|
2011-08-03 20:05:33 +00:00
|
|
|
INCLUDE(CheckFunctionExists)
|
|
|
|
|
2022-04-07 00:38:39 +00:00
|
|
|
# if no build type was provided, set a default one
|
2011-08-03 20:05:33 +00:00
|
|
|
IF(NOT CMAKE_BUILD_TYPE)
|
2022-04-07 00:38:39 +00:00
|
|
|
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug, RelWithDebInfo, Release)" FORCE)
|
2011-08-03 20:05:33 +00:00
|
|
|
ENDIF(NOT CMAKE_BUILD_TYPE)
|
|
|
|
|
2012-09-23 03:31:29 +00:00
|
|
|
IF(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
|
|
|
|
SET(HAIKU TRUE)
|
|
|
|
ENDIF()
|
|
|
|
|
2022-04-08 17:31:16 +00:00
|
|
|
# Recommended compiler flags that cmake doesn't set automatically
|
|
|
|
if(MSVC)
|
|
|
|
# /MP: parallel builds
|
|
|
|
# /GS-: disable security cookie (emits calls into vcrt)
|
|
|
|
# /Oi: enable intrinsic functions
|
|
|
|
# /fp:fast: -ffast-math
|
|
|
|
set(AQUARIA_EXTRA_COMPILE_FLAGS "/MP /GS- /Oi /fp:fast" CACHE STRING "Extra compiler flags for MSVC")
|
|
|
|
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
|
|
|
set(AQUARIA_EXTRA_COMPILE_FLAGS "-ffast-math" CACHE STRING "Extra compiler flags for GCC/Clang")
|
|
|
|
else()
|
|
|
|
set(AQUARIA_EXTRA_COMPILE_FLAGS "" CACHE STRING "Extra compiler flags")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(AQUARIA_EXTRA_COMPILE_FLAGS)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${AQUARIA_EXTRA_COMPILE_FLAGS}")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${AQUARIA_EXTRA_COMPILE_FLAGS}")
|
|
|
|
endif()
|
|
|
|
|
2013-06-19 15:44:37 +00:00
|
|
|
|
2012-02-10 19:28:35 +00:00
|
|
|
OPTION(AQUARIA_DEMO_BUILD "Demo Build?" FALSE)
|
[vfs, #3] All file reading code goes through the VFS now, new mod downloader & mod selector in place. Also a bunch of other stuff. (...)
- HTTP networking support, mods can be downloaded via the builtin downloader.
All network activity runs in a seperate thread, which is started
as soon as any network activity is requested.
- The master server is hard-coded to fg.wzff.de/aqmods/ if not specified otherwise;
this setting can be overridden in the config file.
- The mod selector screen is now a grid-view for much better navigation;
also works with joystick.
- VFS code is functionally similar to the old molebox-packed release
for win32. The game could also have its data shipped in a Zip file
or any other kind of archive.
- It is still possible to build without VFS support, but then the mod
downloader and soft-patching will not be available.
The full commit history can be found here:
https://github.com/fgenesis/Aquaria_clean/compare/master...vfs
The most important commit messages follow:
[...]
This replaces all std::ifstream with InStream, and fopen(), ... with vfopen(), ...
Some code is #ifdef'd for better performance and less memory-copying.
VFILE is defined to whatever type of file is in use:
- FILE if BBGE_BUILD_VFS is not defined
- tttvfs::VFSFile if it is.
Other changes:
- [un]packFile() is now unused and obsolete. That code has not been adjusted to use VFILE.
- glpng can now load from a memory buffer.
- TinyXML uses the VFS for reading operations now.
- The rather clunky binary stream loading of glfont2 got replaced with ByteBuffer,
which gets its data in one block (necessary to use the VFS without implementing
a somewhat STL-compliant std::ifstream replacement.)
-------------
Implement loading mods from zip files.
-------------
Implement soft-patching game data files. (Replacing textures/audio/... on the fly)
-------------
Misc bits:
- Extended GUI focus handling a bit
- Fixed weirdness in texture loading... not sure but this seems more correct to me.
Actually, considering that the texture will have its native size after restarting the game,
the lines removed with this commit seem pretty useless.
2012-06-01 15:52:19 +00:00
|
|
|
OPTION(AQUARIA_USE_VFS "Use Virtual File System? Required for some additional features." TRUE)
|
2011-08-03 20:05:33 +00:00
|
|
|
|
2016-08-06 18:03:51 +00:00
|
|
|
OPTION(AQUARIA_USE_SDL2 "Use SDL2" TRUE)
|
2015-07-12 20:16:55 +00:00
|
|
|
OPTION(AQUARIA_USE_GLM "Use GLM for matrix math" TRUE)
|
2013-07-18 21:29:55 +00:00
|
|
|
|
2011-08-03 20:05:33 +00:00
|
|
|
################ Look for external libraries
|
|
|
|
|
2022-04-07 00:38:39 +00:00
|
|
|
### Pick one: SDL 1.2 or SDL2
|
2011-08-03 20:05:33 +00:00
|
|
|
|
2022-03-30 20:54:03 +00:00
|
|
|
if(AQUARIA_USE_SDL2)
|
2022-04-07 00:38:39 +00:00
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
if(SDL2_FOUND)
|
|
|
|
set(SDL_FOUND TRUE)
|
|
|
|
set(SDL_INCLUDE_DIR ${SDL2_INCLUDE_DIR})
|
|
|
|
set(SDL_LIBRARY ${SDL2_LIBRARY})
|
|
|
|
endif(SDL2_FOUND)
|
2022-03-30 20:54:03 +00:00
|
|
|
else()
|
2022-04-07 00:38:39 +00:00
|
|
|
find_package(SDL REQUIRED)
|
2022-03-30 20:54:03 +00:00
|
|
|
endif()
|
2011-08-03 20:05:33 +00:00
|
|
|
|
2022-04-07 00:38:39 +00:00
|
|
|
SET(BBGEDIR ${CMAKE_CURRENT_SOURCE_DIR}/BBGE)
|
|
|
|
SET(EXTLIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/ExternalLibs)
|
2015-09-17 22:55:50 +00:00
|
|
|
|
2011-08-03 20:05:33 +00:00
|
|
|
################ End of external libraries
|
|
|
|
|
|
|
|
# Custom build ID: e.g. "-custom", " (my very own build)"
|
|
|
|
SET(AQUARIA_CUSTOM_BUILD_ID "" CACHE STRING
|
|
|
|
"Text to append to the Aquaria version ID on the title screen.")
|
|
|
|
if (NOT(AQUARIA_CUSTOM_BUILD_ID STREQUAL ""))
|
|
|
|
ADD_DEFINITIONS("-DAQUARIA_CUSTOM_BUILD_ID=\"${AQUARIA_CUSTOM_BUILD_ID}\"")
|
|
|
|
endif (NOT(AQUARIA_CUSTOM_BUILD_ID STREQUAL ""))
|
|
|
|
|
2013-06-24 01:09:58 +00:00
|
|
|
# Custom version string override (displayed as-is instead of "Aquaria vx.x.x ..." on the title screen
|
|
|
|
SET(AQUARIA_OVERRIDE_VERSION_STRING "" CACHE STRING
|
|
|
|
"Text to display instead of the Aquaria version ID on the title screen. (Overrides AQUARIA_CUSTOM_BUILD_ID as well)")
|
|
|
|
if (NOT(AQUARIA_OVERRIDE_VERSION_STRING STREQUAL ""))
|
2013-06-26 13:15:00 +00:00
|
|
|
ADD_DEFINITIONS("-DAQUARIA_OVERRIDE_VERSION_STRING=\"${AQUARIA_OVERRIDE_VERSION_STRING}\"")
|
2013-06-24 01:09:58 +00:00
|
|
|
endif (NOT(AQUARIA_OVERRIDE_VERSION_STRING STREQUAL ""))
|
|
|
|
|
2013-06-19 00:08:24 +00:00
|
|
|
# Custom data directories
|
|
|
|
SET(AQUARIA_DEFAULT_DATA_DIR "" CACHE STRING
|
|
|
|
"Default data directory (for package maintainers only)")
|
|
|
|
if(NOT(AQUARIA_DEFAULT_DATA_DIR STREQUAL ""))
|
|
|
|
ADD_DEFINITIONS("-DAQUARIA_DEFAULT_DATA_DIR=\"${AQUARIA_DEFAULT_DATA_DIR}\"")
|
|
|
|
endif(NOT(AQUARIA_DEFAULT_DATA_DIR STREQUAL ""))
|
|
|
|
|
|
|
|
SET(AQUARIA_EXTRA_DATA_DIR "" CACHE STRING
|
|
|
|
"Extra data directory, overrides files from default datadir (for package maintainers only)")
|
|
|
|
if(NOT(AQUARIA_EXTRA_DATA_DIR STREQUAL ""))
|
|
|
|
ADD_DEFINITIONS("-DAQUARIA_EXTRA_DATA_DIR=\"${AQUARIA_EXTRA_DATA_DIR}\"")
|
|
|
|
endif(NOT(AQUARIA_EXTRA_DATA_DIR STREQUAL ""))
|
|
|
|
|
2022-04-07 00:38:39 +00:00
|
|
|
# Without #define VFS_ENABLE_C_API this is just stubbed out
|
|
|
|
include_directories(ttvfs_cfileapi)
|
|
|
|
if(AQUARIA_USE_VFS)
|
2014-04-07 05:07:31 +00:00
|
|
|
ADD_DEFINITIONS(-DVFS_ENABLE_C_API=1)
|
2022-04-07 00:38:39 +00:00
|
|
|
ADD_DEFINITIONS(-DBBGE_BUILD_VFS=1)
|
2014-04-07 00:10:05 +00:00
|
|
|
INCLUDE_DIRECTORIES(${EXTLIBDIR}/ttvfs)
|
|
|
|
INCLUDE_DIRECTORIES(${EXTLIBDIR}/ttvfs_zip)
|
|
|
|
INCLUDE_DIRECTORIES(${EXTLIBDIR}/ttvfs_cfileapi)
|
[vfs, #3] All file reading code goes through the VFS now, new mod downloader & mod selector in place. Also a bunch of other stuff. (...)
- HTTP networking support, mods can be downloaded via the builtin downloader.
All network activity runs in a seperate thread, which is started
as soon as any network activity is requested.
- The master server is hard-coded to fg.wzff.de/aqmods/ if not specified otherwise;
this setting can be overridden in the config file.
- The mod selector screen is now a grid-view for much better navigation;
also works with joystick.
- VFS code is functionally similar to the old molebox-packed release
for win32. The game could also have its data shipped in a Zip file
or any other kind of archive.
- It is still possible to build without VFS support, but then the mod
downloader and soft-patching will not be available.
The full commit history can be found here:
https://github.com/fgenesis/Aquaria_clean/compare/master...vfs
The most important commit messages follow:
[...]
This replaces all std::ifstream with InStream, and fopen(), ... with vfopen(), ...
Some code is #ifdef'd for better performance and less memory-copying.
VFILE is defined to whatever type of file is in use:
- FILE if BBGE_BUILD_VFS is not defined
- tttvfs::VFSFile if it is.
Other changes:
- [un]packFile() is now unused and obsolete. That code has not been adjusted to use VFILE.
- glpng can now load from a memory buffer.
- TinyXML uses the VFS for reading operations now.
- The rather clunky binary stream loading of glfont2 got replaced with ByteBuffer,
which gets its data in one block (necessary to use the VFS without implementing
a somewhat STL-compliant std::ifstream replacement.)
-------------
Implement loading mods from zip files.
-------------
Implement soft-patching game data files. (Replacing textures/audio/... on the fly)
-------------
Misc bits:
- Extended GUI focus handling a bit
- Fixed weirdness in texture loading... not sure but this seems more correct to me.
Actually, considering that the texture will have its native size after restarting the game,
the lines removed with this commit seem pretty useless.
2012-06-01 15:52:19 +00:00
|
|
|
ENDIF(AQUARIA_USE_VFS)
|
2012-02-10 19:28:35 +00:00
|
|
|
|
2015-07-12 20:16:55 +00:00
|
|
|
IF(AQUARIA_USE_GLM)
|
|
|
|
ADD_DEFINITIONS(-DBBGE_USE_GLM=1)
|
|
|
|
ENDIF(AQUARIA_USE_GLM)
|
|
|
|
|
2022-04-07 00:38:39 +00:00
|
|
|
if(AQUARIA_INTERNAL_FTGL)
|
|
|
|
ADD_DEFINITIONS(-DAQUARIA_INTERNAL_FTGL=1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(AQUARIA_INTERNAL_LUA)
|
|
|
|
ADD_DEFINITIONS(-DAQUARIA_INTERNAL_LUA=1)
|
|
|
|
endif()
|
|
|
|
|
2012-02-10 19:28:35 +00:00
|
|
|
IF(AQUARIA_DEMO_BUILD)
|
|
|
|
message(STATUS "Demo build.")
|
|
|
|
ADD_DEFINITIONS(-DAQUARIA_DEMO=1)
|
|
|
|
ELSE(AQUARIA_DEMO_BUILD)
|
|
|
|
ADD_DEFINITIONS(-DAQUARIA_BUILD_CONSOLE=1)
|
|
|
|
ADD_DEFINITIONS(-DAQUARIA_BUILD_SCENEEDITOR=1)
|
|
|
|
ENDIF(AQUARIA_DEMO_BUILD)
|
2011-08-03 20:05:33 +00:00
|
|
|
|
2015-09-18 05:00:20 +00:00
|
|
|
IF(CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
|
|
ADD_DEFINITIONS(-DNDEBUG) # MSVC defines this in release mode by default, gcc/mingw do not
|
|
|
|
message(STATUS "This is a release build.")
|
|
|
|
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Release")
|
2011-08-11 00:26:46 +00:00
|
|
|
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
ADD_DEFINITIONS(-D_DEBUG) # MSVC defines this in debug mode by default, gcc/mingw do not
|
|
|
|
message(STATUS "This is a debug build.")
|
|
|
|
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
|
2022-04-07 00:38:39 +00:00
|
|
|
# FIXME: These should go
|
2011-08-03 20:05:33 +00:00
|
|
|
IF(UNIX)
|
|
|
|
ADD_DEFINITIONS(-DBBGE_BUILD_UNIX=1)
|
|
|
|
ENDIF(UNIX)
|
|
|
|
IF(MACOSX)
|
|
|
|
ADD_DEFINITIONS(-DBBGE_BUILD_MACOSX=1)
|
|
|
|
ENDIF(MACOSX)
|
|
|
|
IF(WIN32)
|
|
|
|
ADD_DEFINITIONS(-DBBGE_BUILD_WINDOWS=1)
|
2022-04-07 00:38:39 +00:00
|
|
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
|
|
|
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
|
2011-08-03 20:05:33 +00:00
|
|
|
ENDIF(WIN32)
|
|
|
|
|
|
|
|
IF(CMAKE_COMPILER_IS_GNUCC)
|
2017-09-02 18:28:19 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -pipe -fsigned-char")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -pipe -fsigned-char -std=gnu99")
|
2011-08-03 20:05:33 +00:00
|
|
|
|
|
|
|
# See if -fno-stack-protector is available to us.
|
|
|
|
# It doesn't seem to work well, and it adds bulk to the binary.
|
|
|
|
CHECK_C_COMPILER_FLAG("-fno-stack-protector" AQUARIA_GCC_HAS_STACKPROT)
|
|
|
|
IF(AQUARIA_GCC_HAS_STACKPROT)
|
2017-09-02 20:13:46 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-stack-protector")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-stack-protector")
|
2011-08-03 20:05:33 +00:00
|
|
|
ENDIF(AQUARIA_GCC_HAS_STACKPROT)
|
2014-05-30 20:51:12 +00:00
|
|
|
|
2011-08-03 20:05:33 +00:00
|
|
|
# !!! FIXME: probably not safe long-term.
|
|
|
|
# CMake mailing list had this hack for getting rid of -rdynamic:
|
|
|
|
# http://public.kitware.com/pipermail/cmake/2006-July/010404.html
|
|
|
|
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
|
|
|
|
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
|
|
|
|
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
|
|
|
|
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
|
|
|
|
IF(HAVE_STRCASECMP)
|
|
|
|
ADD_DEFINITIONS(-DHAVE_STRCASECMP)
|
|
|
|
ENDIF(HAVE_STRCASECMP)
|
|
|
|
|
2011-08-10 23:42:10 +00:00
|
|
|
|
2022-04-07 00:38:39 +00:00
|
|
|
add_subdirectory(ExternalLibs)
|
[vfs, #3] All file reading code goes through the VFS now, new mod downloader & mod selector in place. Also a bunch of other stuff. (...)
- HTTP networking support, mods can be downloaded via the builtin downloader.
All network activity runs in a seperate thread, which is started
as soon as any network activity is requested.
- The master server is hard-coded to fg.wzff.de/aqmods/ if not specified otherwise;
this setting can be overridden in the config file.
- The mod selector screen is now a grid-view for much better navigation;
also works with joystick.
- VFS code is functionally similar to the old molebox-packed release
for win32. The game could also have its data shipped in a Zip file
or any other kind of archive.
- It is still possible to build without VFS support, but then the mod
downloader and soft-patching will not be available.
The full commit history can be found here:
https://github.com/fgenesis/Aquaria_clean/compare/master...vfs
The most important commit messages follow:
[...]
This replaces all std::ifstream with InStream, and fopen(), ... with vfopen(), ...
Some code is #ifdef'd for better performance and less memory-copying.
VFILE is defined to whatever type of file is in use:
- FILE if BBGE_BUILD_VFS is not defined
- tttvfs::VFSFile if it is.
Other changes:
- [un]packFile() is now unused and obsolete. That code has not been adjusted to use VFILE.
- glpng can now load from a memory buffer.
- TinyXML uses the VFS for reading operations now.
- The rather clunky binary stream loading of glfont2 got replaced with ByteBuffer,
which gets its data in one block (necessary to use the VFS without implementing
a somewhat STL-compliant std::ifstream replacement.)
-------------
Implement loading mods from zip files.
-------------
Implement soft-patching game data files. (Replacing textures/audio/... on the fly)
-------------
Misc bits:
- Extended GUI focus handling a bit
- Fixed weirdness in texture loading... not sure but this seems more correct to me.
Actually, considering that the texture will have its native size after restarting the game,
the lines removed with this commit seem pretty useless.
2012-06-01 15:52:19 +00:00
|
|
|
|
2022-04-07 00:38:39 +00:00
|
|
|
# Set external libs as deps for BBGE & Aquaria...
|
|
|
|
INCLUDE_DIRECTORIES(${BBGEDIR})
|
|
|
|
message(STATUS "FTGL_INCLUDE_DIRS: ${FTGL_INCLUDE_DIRS}")
|
|
|
|
INCLUDE_DIRECTORIES(${FTGL_INCLUDE_DIRS})
|
|
|
|
message(STATUS "LUA_INCLUDE_DIR: ${LUA_INCLUDE_DIR}")
|
|
|
|
INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR})
|
|
|
|
message(STATUS "OGGVORBIS_INCLUDE_DIRS: ${OGGVORBIS_INCLUDE_DIRS}")
|
|
|
|
INCLUDE_DIRECTORIES(${OGGVORBIS_INCLUDE_DIRS})
|
|
|
|
message(STATUS "SDL_INCLUDE_DIR: ${SDL_INCLUDE_DIR}")
|
|
|
|
INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
|
|
|
|
message(STATUS "OPENAL_INCLUDE_DIR: ${OPENAL_INCLUDE_DIR}")
|
|
|
|
INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
|
|
|
|
message(STATUS "TINYXML2_INCLUDE_DIRS: ${TINYXML2_INCLUDE_DIRS}")
|
|
|
|
INCLUDE_DIRECTORIES(${TINYXML2_INCLUDE_DIRS})
|
|
|
|
INCLUDE_DIRECTORIES(${EXTLIBDIR})
|
2018-01-02 14:31:47 +00:00
|
|
|
|
2011-08-03 20:05:33 +00:00
|
|
|
|
2022-04-07 00:38:39 +00:00
|
|
|
add_subdirectory(Aquaria)
|
|
|
|
add_subdirectory(BBGE)
|