tornavis/build_files/build_environment/cmake/sdl.cmake

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
1.5 KiB
CMake
Raw Normal View History

# SPDX-FileCopyrightText: 2012-2022 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(SDL_PATCH
${PATCH_CMD} -p 0 -N -d
${BUILD_DIR}/sdl/src/external_sdl <
${PATCH_DIR}/sdl.diff
)
if(WIN32)
set(SDL_EXTRA_ARGS
-DSDL_STATIC=Off
)
else()
set(SDL_EXTRA_ARGS
-DSDL_STATIC=ON
-DSDL_SHARED=OFF
-DSDL_VIDEO=OFF
-DSNDIO=OFF
)
# Core Haptics only available once macOS 11.0 becomes minimum.
if(APPLE AND NOT BLENDER_PLATFORM_ARM)
list(APPEND SDL_EXTRA_ARGS -DSDL_HAPTICS=OFF)
set(SDL_PATCH
${SDL_PATCH} &&
${PATCH_CMD} -p 0 -N -d
${BUILD_DIR}/sdl/src/external_sdl <
${PATCH_DIR}/sdl_haptics.diff
)
endif()
endif()
ExternalProject_Add(external_sdl
Fix T86124: Self-hosting external libraries packages Allow downloading of source packages of Blender's dependencies, so that it's easier to provide a "full source archive" that contains the blender source + all dependencies archives. A `make` command for this will be introduced soon. This changes the deps builder slightly to be more flexible with the origin of our source packages. To support this a new CMake variable has been added called `PACKAGE_DIR` where all sources archives will be stored. default: a directory called `packages` in the build folder. alternative-default: if a directory called `packages` exists in the blender source folder that will be used. This is to support the "full source archive" use case. The download phase have been moved from the build phase to the configure phase. Configure will download all sources validate the hashes while downloading. All `[depname].cmake` files have been changed to take a local `file://[path_to_local_tarball]` path rather than a remote URI. A second requirement was that there needed to be an option to grab the sources from the blender SVN mirror rather than upstream. For this an option has been added PACKAGE_USE_UPSTREAM_SOURCES (default ON). The exact location in SVN still needs to be worked out, I tested with my local webserver and codewise it checks out. The path that is in there currently will not work (given there is no mirror there yet). To build this mirror our local package caches can be used. Reviewed By: lazydodo Differential Revision: https://developer.blender.org/D10598
2021-03-16 14:10:30 +01:00
URL file://${PACKAGE_DIR}/${SDL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
Fix T86124: Self-hosting external libraries packages Allow downloading of source packages of Blender's dependencies, so that it's easier to provide a "full source archive" that contains the blender source + all dependencies archives. A `make` command for this will be introduced soon. This changes the deps builder slightly to be more flexible with the origin of our source packages. To support this a new CMake variable has been added called `PACKAGE_DIR` where all sources archives will be stored. default: a directory called `packages` in the build folder. alternative-default: if a directory called `packages` exists in the blender source folder that will be used. This is to support the "full source archive" use case. The download phase have been moved from the build phase to the configure phase. Configure will download all sources validate the hashes while downloading. All `[depname].cmake` files have been changed to take a local `file://[path_to_local_tarball]` path rather than a remote URI. A second requirement was that there needed to be an option to grab the sources from the blender SVN mirror rather than upstream. For this an option has been added PACKAGE_USE_UPSTREAM_SOURCES (default ON). The exact location in SVN still needs to be worked out, I tested with my local webserver and codewise it checks out. The path that is in there currently will not work (given there is no mirror there yet). To build this mirror our local package caches can be used. Reviewed By: lazydodo Differential Revision: https://developer.blender.org/D10598
2021-03-16 14:10:30 +01:00
URL_HASH ${SDL_HASH_TYPE}=${SDL_HASH}
PREFIX ${BUILD_DIR}/sdl
PATCH_COMMAND ${SDL_PATCH}
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIBDIR}/sdl
${DEFAULT_CMAKE_FLAGS}
${SDL_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/sdl
)
2018-08-14 03:19:42 +02:00
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_sdl after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory
${LIBDIR}/sdl/include/sdl2
${HARVEST_TARGET}/sdl/include
COMMAND ${CMAKE_COMMAND} -E copy_directory
${LIBDIR}/sdl/lib
${HARVEST_TARGET}/sdl/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory
${LIBDIR}/sdl/bin
${HARVEST_TARGET}/sdl/lib
2018-08-14 03:19:42 +02:00
DEPENDEES install
)
endif()