mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Add a module to fetch and setup Windows prebuild libraries
This module downloads the given svn revision based on the current architecture selected. It also sets up the `CMAKE_PREFIX_PATH`. Add new option to disable fetching, which assumes that the libraries are already in the correct folders.
This commit is contained in:
parent
8bbf6476a6
commit
7e0a78d650
2 changed files with 43 additions and 0 deletions
|
|
@ -25,6 +25,11 @@ option(without-nvtt "Disable use of NVTT")
|
|||
option(without-pch "Disable generation and usage of precompiled headers")
|
||||
option(without-tests "Disable generation of test projects")
|
||||
|
||||
# Windows specific options
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
option(fetch-prebuild-libs "Fetch prebuild libraries from SVN. Defaults to ON." ON)
|
||||
endif()
|
||||
|
||||
# OS X specific options
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
option(macosx-version-min "Set minimum required version of the OS X API, the build will possibly fail if an older SDK is used, while newer API functions will be weakly linked (i.e. resolved at runtime)")
|
||||
|
|
@ -134,3 +139,8 @@ endif()
|
|||
|
||||
# Include the BuildFlags target only once after all setup is finished
|
||||
include(0ad-BuildFlags)
|
||||
|
||||
# +++++++++++++++++++++ Windows specific ++++++++++++++++++++
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
include(SetupWindowsLibs)
|
||||
endif()
|
||||
|
|
|
|||
33
cmake/SetupWindowsLibs.cmake
Normal file
33
cmake/SetupWindowsLibs.cmake
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Checks out the SVN Revision of windows libraries. Additionally sets up the environment for cmake.
|
||||
# To update the libraries change the 'SVN_REVISION'. Important: the '-r' in the Revision must be retained.
|
||||
message(STATUS "Fetching Windows prebuild Libraries for ${ARCH}")
|
||||
if(fetch-prebuild-libs)
|
||||
include(FetchContent)
|
||||
if(ARCH STREQUAL "amd64")
|
||||
set(REPO_NAME windows-libs-amd64)
|
||||
else()
|
||||
set(REPO_NAME windows-libs)
|
||||
endif()
|
||||
|
||||
FetchContent_Populate(
|
||||
prebuild_libs
|
||||
SVN_REPOSITORY https://svn.wildfiregames.com/public/${REPO_NAME}/trunk
|
||||
SVN_REVISION -r28278
|
||||
SOURCE_DIR ${0AD_EXT_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
message(STATUS "Copy dependencies' binaries to 'binaries/system/' and adding to 'CMAKE_PREFIX_PATH'")
|
||||
set(DIR_LIST cpp-httplib enet fcollada freetype gloox iconv icu libcurl libpng libsodium libxml2 microsoft miniupnpc nvtt openal sdl2 spidermonkey vorbis zlib)
|
||||
foreach(dir ${DIR_LIST})
|
||||
file(COPY ${0AD_EXT_LIBDIR}/${dir}/bin DESTINATION ${CMAKE_SOURCE_DIR}/binaries/system)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${0AD_EXT_LIBDIR}/${dir})
|
||||
endforeach()
|
||||
# Add the whole libraries directory to CMAKE_PREFIX_PATH. May be redundand but needed for wxWidgets
|
||||
list(APPEND CMAKE_PREFIX_PATH ${0AD_EXT_LIBDIR})
|
||||
# Add libraries not set during binary copy
|
||||
list(APPEND CMAKE_PREFIX_PATH ${0AD_EXT_LIBDIR}/fmt)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${0AD_EXT_LIBDIR}/libzip)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${0AD_EXT_LIBDIR}/cxxtest-4.4)
|
||||
|
||||
message(STATUS "Copy build tools to 'build/bin'")
|
||||
file(COPY ${0AD_EXT_LIBDIR}/cxxtest-4.4/bin DESTINATION ${CMAKE_SOURCE_DIR}/build/bin)
|
||||
Loading…
Reference in a new issue