2015-08-20 22:53:48 +02:00
|
|
|
#
|
|
|
|
#==============================================================================
|
|
|
|
#
|
|
|
|
# file : CMakeLists.txt
|
|
|
|
# created : Aug 5 2015
|
2019-02-07 02:35:08 +01:00
|
|
|
# copyright : (C) 2015-2019 Joe Thompson
|
2015-08-20 22:53:48 +02:00
|
|
|
# email : beaglejoe@users.sourceforge.net
|
2019-02-07 02:35:08 +01:00
|
|
|
# version : $Id$
|
2015-08-20 22:53:48 +02: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 3 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/>.
|
|
|
|
#
|
|
|
|
#==============================================================================
|
|
|
|
#
|
|
|
|
# (hashtag) starts a comment
|
2018-11-09 05:03:38 +01:00
|
|
|
cmake_minimum_required(VERSION 3.4.0 FATAL_ERROR)
|
2015-08-20 22:53:48 +02:00
|
|
|
|
2016-08-14 16:37:39 +02:00
|
|
|
project(3rdParty-2.3)
|
2015-08-20 22:53:48 +02:00
|
|
|
|
|
|
|
include(ExternalProject)
|
|
|
|
include(CMakeDependentOption)
|
|
|
|
|
|
|
|
|
|
|
|
# Setup some defualts...
|
|
|
|
|
|
|
|
# Setup the configuration
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING
|
|
|
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
|
|
|
FORCE)
|
|
|
|
message("No CMAKE_BUILD_TYPE specified, defaulting to ${CMAKE_BUILD_TYPE}")
|
|
|
|
endif(NOT CMAKE_BUILD_TYPE)
|
|
|
|
|
|
|
|
# Setup the install prefix.
|
|
|
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
|
|
set(CMAKE_INSTALL_PREFIX "./installed" CACHE PATH "Prefix prepended to install directories" FORCE)
|
|
|
|
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
|
|
|
|
|
|
|
2015-08-23 04:34:49 +02:00
|
|
|
if(MINGW)
|
|
|
|
link_directories(/usr/lib /usr/local/lib)
|
|
|
|
include_directories(AFTER /usr/include /usr/local/include)
|
|
|
|
endif(MINGW)
|
2015-08-20 22:53:48 +02:00
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
|
|
|
message(STATUS "CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}")
|
|
|
|
|
|
|
|
set(EXTERNALS_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/externals" CACHE PATH "")
|
|
|
|
set(EXTERNALS_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/3rdParty" CACHE PATH "")
|
|
|
|
set(EXTERNALS_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALS_INSTALL_DIR} CACHE PATH "")
|
|
|
|
|
|
|
|
set_property(DIRECTORY PROPERTY EP_BASE ${EXTERNALS_PREFIX})
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set(OPTION_OPENGL_HEADERS true CACHE BOOL "Download the OpenGL headers")
|
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
|
|
|
|
option(OPTION_SDL_1x "Download and Build SDL 1.x" true)
|
|
|
|
option(OPTION_SDL_2x "Download and Build SDL 2.x" true)
|
|
|
|
option(OPTION_OPENAL "Download and Build OpenAL" true)
|
|
|
|
option(OPTION_PLIB "Download and Build PLIB" true)
|
|
|
|
cmake_dependent_option(OPTION_PLIB_USE_HEAD "Download and Build PLIB from the latest revision" true "OPTION_PLIB" false)
|
|
|
|
option(OPTION_JPEG "Download and Build libjpeg" true)
|
|
|
|
option(OPTION_FREESOLID "Download and Build FreeSOLID" true)
|
|
|
|
option(OPTION_ENET "Download and Build Enet" true)
|
|
|
|
option(OPTION_OGG "Download and Build libogg" true)
|
|
|
|
option(OPTION_VORBIS "Download and Build libvorbis" true)
|
|
|
|
option(OPTION_EXPAT "Download and Build Expat" true)
|
|
|
|
option(OPTION_ZLIB "Download and Build zlib" true)
|
|
|
|
option(OPTION_PNG "Download and Build libpng" true)
|
2015-12-15 01:35:50 +01:00
|
|
|
option(OPTION_SQLITE3 "Download and Build sqlite3" false)
|
2015-08-20 22:53:48 +02:00
|
|
|
option(OPTION_FREETYPE "Download and Build FreeType" true)
|
|
|
|
option(OPTION_CURL "Download and Build curl" true)
|
|
|
|
option(OPTION_OSG "Download and Build OpenSceneGraph" true)
|
|
|
|
|
|
|
|
|
|
|
|
# CMAKE_BUILD_TYPE does NOT work for Visual Studio or Xcode
|
|
|
|
# need to switch on configuration somehow
|
|
|
|
# or limit the choices
|
|
|
|
if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
|
|
set(SUPER_BUILD_POSTFIX "d")
|
|
|
|
else()
|
|
|
|
set(SUPER_BUILD_POSTFIX "")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# OpenGL extensions (Windows only??)
|
|
|
|
message(STATUS "OpenGL extensions (Windows only??)")
|
|
|
|
if(WIN32 AND OPTION_OPENGL_HEADERS)
|
|
|
|
ExternalProject_Add(OpenGL-headers
|
|
|
|
URL ${CMAKE_CURRENT_SOURCE_DIR}/patches/openglheaders.zip
|
2019-01-30 02:49:33 +01:00
|
|
|
URL_HASH SHA256=e66ae96912231de021e17c80a978765c126b26cfde1103f63e9f33e4780f7fad
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS})
|
|
|
|
endif(WIN32 AND OPTION_OPENGL_HEADERS)
|
|
|
|
|
|
|
|
if(OPTION_SDL_1x)
|
|
|
|
ExternalProject_Add(SDL-1.2.15
|
|
|
|
URL https://www.libsdl.org/release/SDL-1.2.15.tar.gz
|
2017-01-17 21:10:19 +01:00
|
|
|
URL_HASH SHA256=d6d316a793e5e348155f0dd93b979798933fb98aa1edebcc108829d6474aad00
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS}
|
|
|
|
DEPENDS OpenGL-headers
|
|
|
|
)
|
|
|
|
ExternalProject_Add_Step(SDL-1.2.15 sdl1x_add_cmake
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
"${CMAKE_SOURCE_DIR}/patches/sdl-1.2.15.CMakeLists.txt"
|
|
|
|
"<SOURCE_DIR>/CMakeLists.txt"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
|
|
|
endif(OPTION_SDL_1x)
|
|
|
|
|
|
|
|
# TODO - need to disable SDL2 static (it is overwritten by dll's SDL2.lib)
|
2015-12-15 03:28:20 +01:00
|
|
|
# message(WARNING "TODO - need to disable SDL2 static (it is overwritten by dll's SDL2.lib)")
|
2015-08-20 22:53:48 +02:00
|
|
|
|
|
|
|
if(OPTION_SDL_2x)
|
2019-08-21 02:41:35 +02:00
|
|
|
set(SDL2_PROJECT SDL2-2.0.10)
|
2018-11-14 06:58:11 +01:00
|
|
|
set(SDL2_ARGS ${EXTERNALS_CMAKE_ARGS} -DSDL_STATIC=Off -DSDL_CMAKE_DEBUG_POSTFIX=)
|
|
|
|
# set(SDL2_ARGS ${EXTERNALS_CMAKE_ARGS} -DSDL_STATIC=Off)
|
2016-08-15 07:43:59 +02:00
|
|
|
ExternalProject_Add(${SDL2_PROJECT}
|
2019-08-21 02:41:35 +02:00
|
|
|
URL https://www.libsdl.org/release/SDL2-2.0.10.tar.gz
|
|
|
|
URL_HASH SHA256=b4656c13a1f0d0023ae2f4a9cf08ec92fffb464e0f24238337784159b8b91d57
|
2016-10-20 15:37:50 +02:00
|
|
|
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${SDL2_ARGS}
|
|
|
|
DEPENDS OpenGL-headers
|
|
|
|
)
|
2018-11-14 06:58:11 +01:00
|
|
|
message(WARNING "Remove the step below when SDL2 CMake is fixed")
|
|
|
|
ExternalProject_Add_Step(${SDL2_PROJECT} sdl2_fix_cmake
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
2019-08-21 02:41:35 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/patches/sdl-2.0.10.CMakeLists.txt"
|
2018-11-14 06:58:11 +01:00
|
|
|
"<SOURCE_DIR>/CMakeLists.txt"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
|
|
|
# end message(WARNING "Remove the step below when SDL2 CMake is fixed")
|
2016-10-20 15:37:50 +02:00
|
|
|
|
2016-08-15 07:43:59 +02:00
|
|
|
else(OPTION_SDL_2x)
|
|
|
|
set(SDL2_PROJECT )
|
2015-08-20 22:53:48 +02:00
|
|
|
endif(OPTION_SDL_2x)
|
|
|
|
|
|
|
|
if(OPTION_OPENAL)
|
2018-11-08 23:38:05 +01:00
|
|
|
if(MSVC_VERSION LESS 1900)
|
2018-11-09 05:03:38 +01:00
|
|
|
message("openal-soft versions newer than 1.18.2 need Visual Studio 2015")
|
2018-11-08 23:38:05 +01:00
|
|
|
ExternalProject_Add(openal-soft-1.18.2
|
|
|
|
URL http://www.openal-soft.org/openal-releases/openal-soft-1.18.2.tar.bz2
|
|
|
|
URL_HASH SHA256=9f8ac1e27fba15a59758a13f0c7f6540a0605b6c3a691def9d420570506d7e82
|
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS})
|
2019-04-23 07:31:31 +02:00
|
|
|
ExternalProject_Add_Step(openal-soft-1.18.2 openal_patch_cmake
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
"${CMAKE_SOURCE_DIR}/patches/openal-soft-1.18.2.CMakeLists.txt"
|
|
|
|
"<SOURCE_DIR>/CMakeLists.txt"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
2018-11-08 23:38:05 +01:00
|
|
|
else(MSVC_VERSION LESS 1900)
|
|
|
|
ExternalProject_Add(openal-soft-1.19.1
|
|
|
|
URL http://www.openal-soft.org/openal-releases/openal-soft-1.19.1.tar.bz2
|
|
|
|
URL_HASH SHA256=5c2f87ff5188b95e0dc4769719a9d89ce435b8322b4478b95dd4b427fe84b2e9
|
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS})
|
|
|
|
endif(MSVC_VERSION LESS 1900)
|
2015-08-20 22:53:48 +02:00
|
|
|
endif(OPTION_OPENAL)
|
|
|
|
|
|
|
|
if(OPTION_PLIB)
|
|
|
|
if(OPTION_PLIB_USE_HEAD)
|
|
|
|
ExternalProject_Add(plib-1.8.5-head
|
|
|
|
SVN_REPOSITORY svn://svn.code.sf.net/p/plib/code/trunk
|
2019-02-07 02:35:08 +01:00
|
|
|
SVN_REVISION -r2173 #-r2173 as of 2012-08-24 can also use -rHEAD, but specific revision is supposed to prevent calling svn update
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS}
|
|
|
|
DEPENDS OpenGL-headers
|
|
|
|
)
|
|
|
|
ExternalProject_Add_Step(plib-1.8.5-head plib_add_cmake
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
"${CMAKE_SOURCE_DIR}/patches/plib-1.8.5.CMakeLists.txt"
|
|
|
|
"<SOURCE_DIR>/CMakeLists.txt"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
|
|
|
|
|
|
|
else(OPTION_PLIB_USE_HEAD)
|
|
|
|
|
|
|
|
ExternalProject_Add(plib-1.8.5
|
2019-01-30 02:49:33 +01:00
|
|
|
URL http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz
|
2017-01-17 21:10:19 +01:00
|
|
|
URL_HASH SHA256=485b22bf6fdc0da067e34ead5e26f002b76326f6371e2ae006415dea6a380a32
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS}
|
|
|
|
DEPENDS OpenGL-headers
|
|
|
|
)
|
|
|
|
ExternalProject_Add_Step(plib-1.8.5 plib_add_cmake
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
"${CMAKE_SOURCE_DIR}/patches/plib-1.8.5.CMakeLists.txt"
|
|
|
|
"<SOURCE_DIR>/CMakeLists.txt"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
|
|
|
endif(OPTION_PLIB_USE_HEAD)
|
|
|
|
endif(OPTION_PLIB)
|
|
|
|
|
|
|
|
if(OPTION_JPEG)
|
2018-09-29 19:12:06 +02:00
|
|
|
set(JPG_PROJECT jpeg-9c)
|
2016-08-15 02:46:47 +02:00
|
|
|
ExternalProject_Add(${JPG_PROJECT}
|
2018-09-29 19:12:06 +02:00
|
|
|
URL http://ijg.org/files/jpegsrc.v9c.tar.gz
|
|
|
|
URL_HASH SHA256=650250979303a649e21f87b5ccd02672af1ea6954b911342ea491f351ceb7122
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS}
|
|
|
|
)
|
2016-08-15 02:46:47 +02:00
|
|
|
ExternalProject_Add_Step(${JPG_PROJECT} jpeg_add_cmake
|
2015-08-20 22:53:48 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
2018-09-29 19:12:06 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/patches/jpeg-9c.CMakeLists.txt"
|
2015-08-20 22:53:48 +02:00
|
|
|
"<SOURCE_DIR>/CMakeLists.txt"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
2016-08-15 02:46:47 +02:00
|
|
|
ExternalProject_Add_Step(${JPG_PROJECT} jpeg_config
|
2015-08-20 22:53:48 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
"<SOURCE_DIR>/jconfig.vc"
|
|
|
|
"<SOURCE_DIR>/jconfig.h"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
2016-08-15 02:46:47 +02:00
|
|
|
else(OPTION_JPEG)
|
|
|
|
set(JPG_PROJECT )
|
2015-08-20 22:53:48 +02:00
|
|
|
endif(OPTION_JPEG)
|
|
|
|
|
|
|
|
if(OPTION_FREESOLID)
|
2015-12-15 03:28:20 +01:00
|
|
|
#message(WARNING "TODO - need to decide between the patches for FreeSOLID-2.1.1 OR FreeSOLID-2.1.2")
|
2015-08-20 22:53:48 +02:00
|
|
|
#ExternalProject_Add(FreeSOLID-2.1.1
|
|
|
|
# DOWNLOAD_NAME FreeSOLID-2.1.1.zip
|
2016-08-15 07:43:59 +02:00
|
|
|
# URL https://sourceforge.net/projects/freesolid/files/FreeSOLID/FreeSOLID-2.1.1.zip/FreeSOLID-2.1.1.zip/download
|
2017-01-17 21:10:19 +01:00
|
|
|
# URL_HASH SHA256=5a4f8576e27223f03ad0add76a79b06db6cd8f15c8d2767ea35e0c540ba1bee8
|
2015-08-20 22:53:48 +02:00
|
|
|
# CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS}
|
|
|
|
# UPDATE_COMMAND ""
|
|
|
|
# PATCH_COMMAND ""
|
|
|
|
# CONFIGURE_COMMAND ""
|
|
|
|
# BUILD_COMMAND ""
|
|
|
|
# INSTALL_COMMAND ""
|
|
|
|
# )
|
|
|
|
|
|
|
|
set(FreeSOLID_ARGS ${EXTERNALS_CMAKE_ARGS} -D'CMAKE_DEBUG_POSTFIX=""')
|
|
|
|
ExternalProject_Add(FreeSOLID-2.1.2
|
|
|
|
DOWNLOAD_NAME FreeSOLID-2.1.2.zip
|
2016-08-15 07:43:59 +02:00
|
|
|
URL https://sourceforge.net/projects/freesolid/files/FreeSOLID-2.1.2.zip/download
|
2017-01-17 21:10:19 +01:00
|
|
|
URL_HASH SHA256=89edc6afdd9d60c8020b2b865b61558c86a8928dc6f1773b9f4708b5c28eb873
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${FreeSOLID_ARGS}
|
|
|
|
)
|
|
|
|
ExternalProject_Add_Step(FreeSOLID-2.1.2 freesolid_add_cmake
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
"${CMAKE_SOURCE_DIR}/patches/FreeSOLID-2.1.2.CMakeLists.txt"
|
|
|
|
"<SOURCE_DIR>/CMakeLists.txt"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
|
|
|
endif(OPTION_FREESOLID)
|
|
|
|
|
|
|
|
if(OPTION_ENET)
|
2019-02-07 03:03:49 +01:00
|
|
|
set(ENET_PROJECT enet-1.3.14)
|
|
|
|
ExternalProject_Add(${ENET_PROJECT}
|
|
|
|
URL http://enet.bespin.org/download/enet-1.3.14.tar.gz
|
|
|
|
URL_HASH SHA256=98f6f57aab0a424469619ed3047728f0d3901ce8f0dea919c11e7966d807e870
|
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS}
|
2015-08-20 22:53:48 +02:00
|
|
|
)
|
2019-02-07 03:03:49 +01:00
|
|
|
ExternalProject_Add_Step(${ENET_PROJECT} enet_add_cmake
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
"${CMAKE_SOURCE_DIR}/patches/enet-1.3.14.CMakeLists.txt"
|
|
|
|
"<SOURCE_DIR>/CMakeLists.txt"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
2015-08-20 22:53:48 +02:00
|
|
|
)
|
2019-02-07 03:03:49 +01:00
|
|
|
else(OPTION_ENET)
|
|
|
|
set(ENET_PROJECT )
|
2015-08-20 22:53:48 +02:00
|
|
|
endif(OPTION_ENET)
|
|
|
|
|
|
|
|
if(OPTION_OGG)
|
2018-09-29 19:12:06 +02:00
|
|
|
ExternalProject_Add(libogg-1.3.3
|
|
|
|
URL http://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.gz
|
|
|
|
URL_HASH SHA256=c2e8a485110b97550f453226ec644ebac6cb29d1caef2902c007edab4308d985
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS}
|
|
|
|
)
|
2018-09-29 19:12:06 +02:00
|
|
|
ExternalProject_Add_Step(libogg-1.3.3 libogg_add_cmake
|
2015-08-20 22:53:48 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
2018-09-29 19:12:06 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/patches/libogg-1.3.3.CMakeLists.txt"
|
2015-08-20 22:53:48 +02:00
|
|
|
"<SOURCE_DIR>/CMakeLists.txt"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
|
|
|
endif(OPTION_OGG)
|
|
|
|
|
|
|
|
if(OPTION_VORBIS)
|
2018-09-29 19:12:06 +02:00
|
|
|
ExternalProject_Add(libvorbis-1.3.6
|
|
|
|
URL http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.tar.gz
|
|
|
|
URL_HASH SHA256=6ed40e0241089a42c48604dc00e362beee00036af2d8b3f46338031c9e0351cb
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS}
|
2018-09-29 19:12:06 +02:00
|
|
|
DEPENDS "libogg-1.3.3"
|
2015-08-20 22:53:48 +02:00
|
|
|
)
|
2018-09-29 19:12:06 +02:00
|
|
|
ExternalProject_Add_Step(libvorbis-1.3.6 libvorbis_add_cmake
|
2015-08-20 22:53:48 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
2018-09-29 19:12:06 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/patches/libvorbis-1.3.6.CMakeLists.txt"
|
2015-08-20 22:53:48 +02:00
|
|
|
"<SOURCE_DIR>/CMakeLists.txt"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
|
|
|
endif(OPTION_VORBIS)
|
|
|
|
|
2018-11-08 23:38:05 +01:00
|
|
|
if(OPTION_EXPAT)
|
2019-06-21 22:31:27 +02:00
|
|
|
set(EXPAT_PROJECT expat-2.2.7)
|
2015-11-11 09:05:11 +01:00
|
|
|
#disable building unneeded sub projects (they failed with VS2008)
|
2016-08-15 17:12:22 +02:00
|
|
|
set(EXPAT_ARGS ${EXTERNALS_CMAKE_ARGS} -DBUILD_tests=off -DBUILD_examples=off -DBUILD_tools=off -DCMAKE_DEBUG_POSTFIX='')
|
2019-06-21 22:31:27 +02:00
|
|
|
ExternalProject_Add(${EXPAT_PROJECT}
|
|
|
|
DOWNLOAD_NAME ${EXPAT_PROJECT}.tar.bz2
|
|
|
|
URL https://sourceforge.net/projects/expat/files/expat/2.2.7/expat-2.2.7.tar.bz2/download
|
|
|
|
URL_HASH SHA256=cbc9102f4a31a8dafd42d642e9a3aa31e79a0aedaa1f6efd2795ebc83174ec18
|
2015-11-11 09:05:11 +01:00
|
|
|
CMAKE_ARGS ${EXPAT_ARGS}
|
2015-08-20 22:53:48 +02:00
|
|
|
#UPDATE_COMMAND ""
|
|
|
|
#PATCH_COMMAND ""
|
|
|
|
#CONFIGURE_COMMAND ""
|
|
|
|
#BUILD_COMMAND ""
|
|
|
|
#INSTALL_COMMAND ""
|
|
|
|
)
|
2019-06-21 22:31:27 +02:00
|
|
|
else(OPTION_EXPAT)
|
|
|
|
set(EXPAT_PROJECT )
|
2015-08-20 22:53:48 +02:00
|
|
|
endif(OPTION_EXPAT)
|
|
|
|
|
|
|
|
if(OPTION_ZLIB)
|
2018-11-08 23:38:05 +01:00
|
|
|
set(ZLIB_PROJECT zlib-1.2.11)
|
|
|
|
#set(ZLIB_ARGS ${EXTERNALS_CMAKE_ARGS} -DSKIP_INSTALL_LIBRARIES=On -DSKIP_INSTALL_LIBRARIES=On -D'CMAKE_DEBUG_POSTFIX=""')
|
|
|
|
#set(ZLIB_ARGS ${EXTERNALS_CMAKE_ARGS} -D'CMAKE_BUILD_POSTFIX=hello')
|
|
|
|
ExternalProject_Add(${ZLIB_PROJECT}
|
|
|
|
DOWNLOAD_NAME ${ZLIB_PROJECT}.tar.gz
|
|
|
|
URL https://sourceforge.net/projects/libpng/files/zlib/1.2.11/zlib-1.2.11.tar.gz/download
|
|
|
|
URL_HASH SHA256=c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
|
2015-08-20 22:53:48 +02:00
|
|
|
#CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS} -DBUILD_SHARED_LIBS:BOOL=on
|
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS}
|
|
|
|
#UPDATE_COMMAND ""
|
|
|
|
PATCH_COMMAND ${CMAKE_COMMAND} -E remove -f <SOURCE_DIR>/zconf.h
|
|
|
|
#CONFIGURE_COMMAND ""
|
|
|
|
#BUILD_COMMAND ""
|
|
|
|
#INSTALL_COMMAND ${CMAKE_COMMAND} install(TARGETS zlibstatic)
|
|
|
|
)
|
2018-11-08 23:38:05 +01:00
|
|
|
ExternalProject_Add_Step(${ZLIB_PROJECT} sd_zlib_remove_dll
|
2015-08-20 22:53:48 +02:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E remove -f ${EXTERNALS_INSTALL_DIR}/bin/zlib${SUPER_BUILD_POSTFIX}.dll
|
|
|
|
DEPENDEES install
|
|
|
|
)
|
2018-11-08 23:38:05 +01:00
|
|
|
ExternalProject_Add_Step(${ZLIB_PROJECT} sd_zlib_remove_lib
|
2015-08-20 22:53:48 +02:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E remove -f ${EXTERNALS_INSTALL_DIR}/lib/zlib${SUPER_BUILD_POSTFIX}.lib
|
|
|
|
DEPENDEES sd_zlib_remove_dll
|
|
|
|
)
|
2018-11-08 23:38:05 +01:00
|
|
|
ExternalProject_Add_Step(${ZLIB_PROJECT} sd_zlib_rename_lib
|
2015-08-20 22:53:48 +02:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E rename ${EXTERNALS_INSTALL_DIR}/lib/zlibstatic${SUPER_BUILD_POSTFIX}.lib ${EXTERNALS_INSTALL_DIR}/lib/zlib.lib
|
|
|
|
DEPENDEES sd_zlib_remove_lib
|
|
|
|
)
|
2018-11-08 23:38:05 +01:00
|
|
|
else(OPTION_ZLIB)
|
|
|
|
set(ZLIB_PROJECT )
|
2015-08-20 22:53:48 +02:00
|
|
|
endif(OPTION_ZLIB)
|
|
|
|
|
|
|
|
if(OPTION_PNG)
|
2019-04-22 22:12:14 +02:00
|
|
|
set(PNG_PROJECT libpng-1.6.37)
|
2015-12-15 03:28:20 +01:00
|
|
|
set(PNG_ARGS ${EXTERNALS_CMAKE_ARGS} -DPNG_SHARED=off -DPNG_TESTS=off -DCMAKE_DEBUG_POSTFIX='')
|
|
|
|
ExternalProject_Add(${PNG_PROJECT}
|
|
|
|
DOWNLOAD_NAME ${PNG_PROJECT}.tar.gz
|
2019-04-22 22:12:14 +02:00
|
|
|
URL https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.gz/download
|
|
|
|
URL_HASH SHA256=daeb2620d829575513e35fecc83f0d3791a620b9b93d800b763542ece9390fb4
|
2015-12-15 03:28:20 +01:00
|
|
|
CMAKE_ARGS ${PNG_ARGS}
|
2018-11-08 23:38:05 +01:00
|
|
|
DEPENDS ${ZLIB_PROJECT}
|
2015-12-15 03:28:20 +01:00
|
|
|
)
|
|
|
|
ExternalProject_Add_Step(${PNG_PROJECT} sd_libpng_rename
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E rename ${EXTERNALS_INSTALL_DIR}/lib/libpng16_static${SUPER_BUILD_POSTFIX}.lib ${EXTERNALS_INSTALL_DIR}/lib/libpng.lib
|
|
|
|
DEPENDEES install
|
|
|
|
)
|
|
|
|
else(OPTION_PNG)
|
2016-08-15 05:05:13 +02:00
|
|
|
set(PNG_PROJECT )
|
2015-08-20 22:53:48 +02:00
|
|
|
endif(OPTION_PNG)
|
|
|
|
|
|
|
|
if(OPTION_SQLITE3)
|
|
|
|
# may only be needed for Simon's replay stuff
|
2018-11-08 23:49:10 +01:00
|
|
|
ExternalProject_Add(sqlite3-3.25.3
|
|
|
|
URL https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz
|
|
|
|
URL_HASH SHA256=00ebf97be13928941940cc71de3d67e9f852698233cd98ce2d178fd08092f3dd
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS}
|
|
|
|
UPDATE_COMMAND ""
|
|
|
|
PATCH_COMMAND ""
|
|
|
|
CONFIGURE_COMMAND ""
|
|
|
|
BUILD_COMMAND ""
|
|
|
|
INSTALL_COMMAND ""
|
|
|
|
)
|
|
|
|
endif(OPTION_SQLITE3)
|
|
|
|
|
|
|
|
# ========== For OpenSceneGraph =============
|
|
|
|
|
|
|
|
if(OPTION_FREETYPE)
|
2019-07-03 21:09:23 +02:00
|
|
|
set(FREETYPE_PROJECT freetype-2.10.1)
|
2018-11-08 23:38:05 +01:00
|
|
|
set(FREETYPE_ARGS ${EXTERNALS_CMAKE_ARGS} -DBUILD_SHARED_LIBS:BOOL=false
|
|
|
|
-DDISABLE_FORCE_DEBUG_POSTFIX:BOOL=true
|
2018-11-09 05:03:38 +01:00
|
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE
|
|
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE
|
2018-11-08 23:38:05 +01:00
|
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE
|
|
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=TRUE)
|
2015-08-20 22:53:48 +02:00
|
|
|
|
2016-08-15 15:59:18 +02:00
|
|
|
ExternalProject_Add(${FREETYPE_PROJECT}
|
2019-07-03 21:09:23 +02:00
|
|
|
URL https://sourceforge.net/projects/freetype/files/freetype2/2.10.1/ft2101.zip/download
|
|
|
|
URL_HASH SHA256=6f22061c6972395526acf9e311c96ce3f900e4c713d8746c659af0a2bef685eb
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${FREETYPE_ARGS}
|
2019-04-22 23:04:28 +02:00
|
|
|
DEPENDS ${ZLIB_PROJECT} ${PNG_PROJECT}
|
2015-08-20 22:53:48 +02:00
|
|
|
)
|
2016-08-15 15:59:18 +02:00
|
|
|
else(OPTION_FREETYPE)
|
|
|
|
set(FREETYPE_PROJECT )
|
2015-08-20 22:53:48 +02:00
|
|
|
endif(OPTION_FREETYPE)
|
|
|
|
|
|
|
|
if(OPTION_CURL)
|
2019-07-22 17:19:59 +02:00
|
|
|
set(CURL_PROJECT curl-7.65.3)
|
2018-11-14 06:58:11 +01:00
|
|
|
set(CURL_ARGS ${EXTERNALS_CMAKE_ARGS} -DBUILD_TESTING=Off -DCMAKE_DEBUG_POSTFIX=)
|
2016-08-15 10:14:21 +02:00
|
|
|
ExternalProject_Add(${CURL_PROJECT}
|
2019-07-22 17:19:59 +02:00
|
|
|
URL https://curl.haxx.se/download/curl-7.65.3.tar.bz2
|
|
|
|
URL_HASH SHA256=0a855e83be482d7bc9ea00e05bdb1551a44966076762f9650959179c89fce509
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${CURL_ARGS}
|
2018-11-08 23:38:05 +01:00
|
|
|
DEPENDS ${ZLIB_PROJECT}
|
2015-08-20 22:53:48 +02:00
|
|
|
)
|
2016-08-15 10:14:21 +02:00
|
|
|
else(OPTION_CURL)
|
|
|
|
set(CURL_PROJECT )
|
2015-08-20 22:53:48 +02:00
|
|
|
endif(OPTION_CURL)
|
|
|
|
|
|
|
|
if(OPTION_OSG)
|
2018-11-08 23:38:05 +01:00
|
|
|
set(OSG_ARGS ${EXTERNALS_CMAKE_ARGS} -DCMAKE_DEBUG_POSTFIX='' -DUSE_3RDPARTY_BIN=Off)
|
2015-08-20 22:53:48 +02:00
|
|
|
|
2019-08-23 06:43:39 +02:00
|
|
|
# if(MSVC_VERSION LESS 1900)
|
|
|
|
# message("Disable Targa plugin, OSG newer than 3.6.3 need Visual Studio 2015")
|
|
|
|
# set(OSG_ARGS ${OSG_ARGS} -D BUILD_OSG_PLUGIN_TGA=0)
|
|
|
|
# endif()
|
|
|
|
|
2019-08-21 06:01:00 +02:00
|
|
|
ExternalProject_Add(osg-OpenSceneGraph-3.6.4
|
|
|
|
URL https://github.com/openscenegraph/OpenSceneGraph/archive/OpenSceneGraph-3.6.4.zip
|
|
|
|
URL_HASH SHA256=4c1f82b0541f905da49ea70b4b4c9fee20c78fb5b9534b3f8990357ea05874ab
|
2015-08-20 22:53:48 +02:00
|
|
|
CMAKE_ARGS ${OSG_ARGS}
|
2018-11-08 23:38:05 +01:00
|
|
|
DEPENDS ${ZLIB_PROJECT} ${CURL_PROJECT} ${FREETYPE_PROJECT} OpenGL-headers ${JPG_PROJECT} ${PNG_PROJECT} SDL-1.2.15 ${SDL2_PROJECT}
|
2015-08-20 22:53:48 +02:00
|
|
|
)
|
2019-08-23 06:43:39 +02:00
|
|
|
if(MSVC_VERSION LESS 1900)
|
|
|
|
message(WARNING "Remove this block when OSG TGA Plugin is fixed")
|
|
|
|
ExternalProject_Add_Step(osg-OpenSceneGraph-3.6.4 ReaderWriterTGA-fixed
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
"${CMAKE_SOURCE_DIR}/patches/ReaderWriterTGA-fixed.cpp"
|
|
|
|
"<SOURCE_DIR>/src/osgPlugins/tga/ReaderWriterTGA.cpp"
|
|
|
|
DEPENDEES update # do after update
|
|
|
|
DEPENDERS patch # do before patch
|
|
|
|
)
|
|
|
|
endif()
|
2015-08-20 22:53:48 +02:00
|
|
|
endif(OPTION_OSG)
|
|
|
|
|
|
|
|
#add_subdirectory(src)
|
|
|
|
|
|
|
|
# no-output target, for having some files available in IDEs.
|
2015-12-15 01:35:50 +01:00
|
|
|
set(DOCSOURCES COPYING LICENSE readme.txt)
|
2015-08-20 22:53:48 +02:00
|
|
|
|
|
|
|
add_custom_target(rootdoc SOURCES ${DOCSOURCES})
|
|
|
|
|
2019-01-30 03:20:05 +01:00
|
|
|
file(GLOB_RECURSE _INFO_FILES "${EXTERNALS_PREFIX}/Stamp/*info.txt")
|
|
|
|
|
|
|
|
# ========== Installation =============
|
|
|
|
|
|
|
|
install(FILES ${_INFO_FILES} DESTINATION ${EXTERNALS_INSTALL_DIR}/source_info)
|
|
|
|
|
2018-11-29 00:08:54 +01:00
|
|
|
install(FILES ${DOCSOURCES} DESTINATION ${EXTERNALS_INSTALL_DIR})
|
|
|
|
|
|
|
|
install(DIRECTORY Licenses/ DESTINATION ${EXTERNALS_INSTALL_DIR}/Licenses)
|
2015-08-20 22:53:48 +02:00
|
|
|
|
2019-01-30 03:20:05 +01:00
|
|
|
install(DIRECTORY ${EXTERNALS_INSTALL_DIR} DESTINATION .)
|
|
|
|
|
2015-08-20 22:53:48 +02:00
|
|
|
|
|
|
|
# ========== Packaging =============
|
2015-12-15 03:36:10 +01:00
|
|
|
if(MSVC)
|
|
|
|
if(CMAKE_CL_64)
|
|
|
|
set(SD_PACKAGE_FILE_NAME ${CMAKE_PROJECT_NAME}-win64-${CMAKE_C_COMPILER_ID}-${CMAKE_C_COMPILER_VERSION}-${CMAKE_BUILD_TYPE})
|
|
|
|
else(CMAKE_CL_64)
|
|
|
|
set(SD_PACKAGE_FILE_NAME ${CMAKE_PROJECT_NAME}-win32-${CMAKE_C_COMPILER_ID}-${CMAKE_C_COMPILER_VERSION}-${CMAKE_BUILD_TYPE})
|
|
|
|
endif(CMAKE_CL_64)
|
|
|
|
else(MSVC)
|
|
|
|
set(SD_PACKAGE_FILE_NAME ${CMAKE_PROJECT_NAME}-${CMAKE_C_COMPILER_ID}-${CMAKE_C_COMPILER_VERSION}-${CMAKE_BUILD_TYPE})
|
|
|
|
endif(MSVC)
|
|
|
|
|
2015-08-20 22:53:48 +02:00
|
|
|
set(CPACK_PACKAGE_FILE_NAME ${SD_PACKAGE_FILE_NAME} CACHE STRING "")
|
|
|
|
|
|
|
|
set(CPACK_GENERATOR "ZIP")
|
|
|
|
|
|
|
|
include(CPack)
|
|
|
|
|
|
|
|
|