diff --git a/.gitignore b/.gitignore index b753d1cf66..6c60a2834b 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ build external_deps/* !external_deps/build.sh !external_deps/sdk-build.sh +!external_deps/versions.cmake !external_deps/cygtar.py !external_deps/*.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 752b0230dc..387f9738ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,9 +204,7 @@ else() set(FULL_OUTPUT_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}) endif() -# Dependencies versions -set(DEPS_VERSION 11) # This must match the number in external_deps/build.sh -set(SAIGOSDK_VERSION 20261030) # This must match the number in external_deps/sdk-build.sh +include(${CMAKE_CURRENT_SOURCE_DIR}/external_deps/versions.cmake) option(USE_EXTERNAL_DEPS "Download or reuse dependencies from EXTERNAL_DEPS_DIR (mandatory for building and running NaCl .nexe binaries)." ON) diff --git a/external_deps/build.sh b/external_deps/build.sh index f3ae7b1f98..bbdd8f848c 100755 --- a/external_deps/build.sh +++ b/external_deps/build.sh @@ -6,10 +6,9 @@ set -u -e -o pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" WORK_DIR="${PWD}" -# This should match the DEPS_VERSION in CMakeLists.txt. -# This is mostly to ensure the path the files end up at if you build deps yourself -# are the same as the ones when extracting from the downloaded packages. -DEPS_VERSION=11 +# Define DEPS_VERSION +versions_out="$(cmake -P "${SCRIPT_DIR}/versions.cmake" 2>&1)" +eval "${versions_out}" # Package download pages PKGCONFIG_BASEURL='https://pkg-config.freedesktop.org/releases' diff --git a/external_deps/sdk-build.sh b/external_deps/sdk-build.sh index a912a1edde..4574b347c7 100755 --- a/external_deps/sdk-build.sh +++ b/external_deps/sdk-build.sh @@ -7,12 +7,9 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" WORK_DIR="${PWD}" DOWNLOAD_DIR="${WORK_DIR}/download_cache" -# This should match the SAIGOSDK_VERSION in CMakeLists.txt. -# This is mostly to ensure the path the files end up at if you build deps yourself -# are the same as the ones when extracting from the downloaded packages. -SAIGOSDK_VERSION=20261030 -# Can be a tag like v${SAIGOSDK_VERSION}, or a full commit hash -SAIGOSDK_REF="v${SAIGOSDK_VERSION}" +# Define SAIGOSDK_VERSION/SAIGOSDK_REF +versions_out="$(cmake -P "${SCRIPT_DIR}/versions.cmake" 2>&1)" +eval "${versions_out}" REPO_BASENAME=saigo-nacl-sdk REPO_URL="https://github.com/DaemonEngine/${REPO_BASENAME}" diff --git a/external_deps/versions.cmake b/external_deps/versions.cmake new file mode 100644 index 0000000000..85661aad72 --- /dev/null +++ b/external_deps/versions.cmake @@ -0,0 +1,49 @@ +# Daemon BSD Source Code +# Copyright (c) 2026, Daemon Developers +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the Daemon developers nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL DAEMON DEVELOPERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +macro(DefineVersionConstant name value) + set(${name} "${value}") + if (CMAKE_SCRIPT_MODE_FILE MATCHES versions.cmake) + # For use by shell scripts via cmake -P mode + message("${name}='${value}'") + endif() +endmacro() + + +# DEPS_VERSION and SAIGOSDK_VERSION are used to version packages which may be auto-downloaded +# by CMake. The numbers are also included in the install path if you use the scripts to build them +# yourself, so that they end up in the same path used by the download. + +# Version for the target-specific library and runtime dependencies package. +# Can be auto-downloaded by CMake or built with build.sh. +DefineVersionConstant(DEPS_VERSION 11) + +# Version for the host mode Saigo NaCl SDK package. +# Can be auto-downloaded by CMake (when building NaCl gamelogic) or built with sdk-build.sh. +DefineVersionConstant(SAIGOSDK_VERSION 20261030) +# Only used by sdk-build.sh, but it's closely coupled to SAIGOSDK_VERSION. +# Can be a tag like v${SAIGOSDK_VERSION}, or a full commit hash. +DefineVersionConstant(SAIGOSDK_REF "v${SAIGOSDK_VERSION}")