From 3366c22e9966228cd5ee2ca18cd4aa81fad7fc48 Mon Sep 17 00:00:00 2001 From: qwertyquerty Date: Thu, 9 Apr 2026 18:22:53 -0700 Subject: [PATCH] CI/CD, CMake improvements, more targets, fix gcc (#258) * CI attempt * syntax * fix cmake for linux * fix include directories and merge main * fix PDB fighting * fix gcc compiling * fix SSCACHE for windows * try and fix gcc * more CI presets * remove the android target for now * bump cmake minimum to fix debug information format * yet another attempt at fixing gcc * yet another attempt at fixing gcc * better CI matrixing * yet another attempt at fixing GCC * fix arm * fix CI * placeholder icons * compile dawn from source for windows arm64 * fix icons and linker warnings * fix cmake * fetch libjpegturbo --------- Co-authored-by: Luke Street --- .github/workflows/build.yml | 206 +++ CMakeLists.txt | 296 ++++- CMakePresets.json | 603 +++++++++ ci/build-appimage.sh | 18 + include/dusk/config_var.hpp | 2 +- include/dusk/time.h | 7 +- include/global.h | 5 +- ios.toolchain.cmake | 1177 +++++++++++++++++ libs/JSystem/src/JGadget/linklist.cpp | 2 +- .../homebuttonLib/nw4hbm/math/triangular.h | 2 +- platforms/freedesktop/1024x1024/apps/dusk.png | Bin 0 -> 5337 bytes platforms/freedesktop/128x128/apps/dusk.png | Bin 0 -> 306 bytes platforms/freedesktop/16x16/apps/dusk.png | Bin 0 -> 79 bytes platforms/freedesktop/256x256/apps/dusk.png | Bin 0 -> 761 bytes platforms/freedesktop/32x32/apps/dusk.png | Bin 0 -> 99 bytes platforms/freedesktop/48x48/apps/dusk.png | Bin 0 -> 123 bytes platforms/freedesktop/512x512/apps/dusk.png | Bin 0 -> 1881 bytes platforms/freedesktop/64x64/apps/dusk.png | Bin 0 -> 179 bytes platforms/freedesktop/dusk.desktop | 9 + .../01J-lp-oVM-view-Ze5-6b-2t3.nib | Bin 0 -> 1186 bytes .../LaunchScreen.storyboardc/Info.plist | Bin 0 -> 258 bytes .../UIViewController-01J-lp-oVM.nib | Bin 0 -> 896 bytes platforms/ios/Info.plist.in | 79 ++ platforms/macos/Info.plist.in | 30 + .../BYZ-38-t0r-view-8bC-Xf-vdC.nib | Bin 0 -> 2001 bytes .../LaunchScreen.storyboardc/Info.plist | Bin 0 -> 258 bytes .../UIViewController-BYZ-38-t0r.nib | Bin 0 -> 896 bytes platforms/tvos/Info.plist.in | 49 + src/d/actor/d_a_b_bq.cpp | 84 +- src/d/actor/d_a_b_ob.cpp | 36 +- src/d/actor/d_a_e_ymb.cpp | 2 +- src/d/actor/d_a_tbox.cpp | 2 +- src/d/d_camera.cpp | 72 +- src/m_Do/m_Do_main.cpp | 6 + version.h.in | 20 + 35 files changed, 2561 insertions(+), 146 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 CMakePresets.json create mode 100755 ci/build-appimage.sh create mode 100644 ios.toolchain.cmake create mode 100644 platforms/freedesktop/1024x1024/apps/dusk.png create mode 100644 platforms/freedesktop/128x128/apps/dusk.png create mode 100644 platforms/freedesktop/16x16/apps/dusk.png create mode 100644 platforms/freedesktop/256x256/apps/dusk.png create mode 100644 platforms/freedesktop/32x32/apps/dusk.png create mode 100644 platforms/freedesktop/48x48/apps/dusk.png create mode 100644 platforms/freedesktop/512x512/apps/dusk.png create mode 100644 platforms/freedesktop/64x64/apps/dusk.png create mode 100644 platforms/freedesktop/dusk.desktop create mode 100644 platforms/ios/Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib create mode 100644 platforms/ios/Base.lproj/LaunchScreen.storyboardc/Info.plist create mode 100644 platforms/ios/Base.lproj/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib create mode 100644 platforms/ios/Info.plist.in create mode 100644 platforms/macos/Info.plist.in create mode 100644 platforms/tvos/Base.lproj/LaunchScreen.storyboardc/BYZ-38-t0r-view-8bC-Xf-vdC.nib create mode 100644 platforms/tvos/Base.lproj/LaunchScreen.storyboardc/Info.plist create mode 100644 platforms/tvos/Base.lproj/LaunchScreen.storyboardc/UIViewController-BYZ-38-t0r.nib create mode 100644 platforms/tvos/Info.plist.in create mode 100644 version.h.in diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..1412aec639 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,206 @@ +name: Build + +on: + push: + paths-ignore: + - '*.md' + - '*LICENSE' + pull_request: + +env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + +jobs: + build-linux: + name: Build Linux (${{matrix.name}}) + runs-on: ${{matrix.runner}} + + strategy: + fail-fast: false + matrix: + include: + - name: GCC x86_64 + runner: ubuntu-latest + preset: gcc + artifact_arch: x86_64 + - name: GCC aarch64 + runner: ubuntu-24.04-arm + preset: gcc + artifact_arch: aarch64 + # - name: Clang x86_64 + # runner: ubuntu-latest + # preset: clang + # artifact_arch: x86_64 + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + submodules: recursive + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get -y install ninja-build clang lld openssl libcurl4-openssl-dev \ + zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \ + libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev libfreetype-dev \ + libxinerama-dev libxcursor-dev python3-markupsafe libgtk-3-dev libssl-dev \ + libxss-dev libfuse2 + + - name: Setup sccache + uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Configure CMake + run: cmake --preset x-linux-ci-${{matrix.preset}} + + - name: Build + run: cmake --build --preset x-linux-ci-${{matrix.preset}} + + - name: Generate AppImage + run: ci/build-appimage.sh + + - name: Upload artifacts + uses: actions/upload-artifact@v7 + with: + name: dusk-${{env.DUSK_VERSION}}-linux-${{matrix.preset}}-${{matrix.artifact_arch}} + path: | + build/install/Dusk-*.AppImage + build/install/debug.tar.* + + + build-apple: + name: Build Apple (${{matrix.name}}) + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + include: + - name: AppleClang macOS universal + platform: macos + preset: x-macos-ci + artifact_name: macos-appleclang-universal + # - name: AppleClang iOS arm64 # TODO enable when CI is free + # platform: ios + # preset: x-ios-ci + # artifact_name: ios-appleclang-arm64 + # - name: AppleClang tvOS arm64 # TODO enable when CI is free + # platform: tvos + # preset: x-tvos-ci + # artifact_name: tvos-appleclang-arm64 + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + submodules: recursive + + - name: Update Homebrew + if: matrix.platform == 'tvos' + run: | + brew update + brew upgrade --formula + + - name: Install dependencies + run: brew install cmake ninja + + - name: Install markupsafe + if: matrix.platform == 'tvos' + run: pip3 install --break-system-packages markupsafe + + - name: Install Rust iOS target + if: matrix.platform == 'ios' + run: rustup target add aarch64-apple-ios + + - name: Install Rust tvOS target + if: matrix.platform == 'tvos' + run: | + rustup toolchain install nightly + rustup target add --toolchain nightly aarch64-apple-tvos + + - name: Setup sccache + uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Configure CMake + run: cmake --preset ${{matrix.preset}} + + - name: Build + run: cmake --build --preset ${{matrix.preset}} + + - name: Upload artifacts + uses: actions/upload-artifact@v7 + with: + name: dusk-${{env.DUSK_VERSION}}-${{matrix.artifact_name}} + path: | + build/install/Dusk.app + build/install/debug.tar.* + + build-windows: + name: Build Windows (${{matrix.name}}) + runs-on: ${{matrix.runner}} + + env: + BUILD_DIR: C:\build + SCCACHE_DIR: C:\sccache + + strategy: + fail-fast: false + matrix: + include: + - name: MSVC x86_64 + runner: windows-latest + preset: msvc + msvc_arch: amd64 + vcpkg_arch: x64 + artifact_arch: x86_64 + - name: MSVC arm64 + runner: windows-11-arm + preset: arm64-msvc + msvc_arch: arm64 + vcpkg_arch: arm64 + artifact_arch: arm64 + # - name: Clang x86_64 + # runner: windows-latest + # preset: clang + # msvc_arch: amd64 + # vcpkg_arch: x64 + # artifact_arch: x86_64 + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + submodules: recursive + + - name: Enable Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{matrix.msvc_arch}} + + # msvc-dev-cmd sets VCPKG_ROOT, set it back + - name: Override VCPKG_ROOT + run: echo "VCPKG_ROOT=C:\vcpkg" >> $env:GITHUB_ENV + + - name: Setup sccache + uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Install dependencies + run: | + choco install ninja + vcpkg install zlib:${{matrix.vcpkg_arch}}-windows-static bzip2:${{matrix.vcpkg_arch}}-windows-static ` + zstd:${{matrix.vcpkg_arch}}-windows-static liblzma:${{matrix.vcpkg_arch}}-windows-static ` + freetype:${{matrix.vcpkg_arch}}-windows-static + + - name: Configure CMake + run: cmake --preset x-windows-ci-${{matrix.preset}} + + - name: Build + run: cmake --build --preset x-windows-ci-${{matrix.preset}} + + - name: Upload artifacts + uses: actions/upload-artifact@v7 + with: + name: dusk-${{env.DUSK_VERSION}}-win32-msvc-${{matrix.artifact_arch}} + path: | + ${{env.BUILD_DIR}}/install/*.exe + ${{env.BUILD_DIR}}/install/debug.7z diff --git a/CMakeLists.txt b/CMakeLists.txt index dd848c776f..4cca061f1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,86 @@ -cmake_minimum_required(VERSION 3.16) -if (APPLE) - project(dusk LANGUAGES C CXX OBJC OBJCXX) -else () - project(dusk LANGUAGES C CXX) +cmake_minimum_required(VERSION 3.25) + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING + "Build type options: Debug Release RelWithDebInfo MinSizeRel" FORCE) endif () +# obtain revision info from git +find_package(Git) +if (GIT_FOUND) + # make sure version information gets re-run when the current Git HEAD changes + execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --git-path HEAD + OUTPUT_VARIABLE dusk_git_head_filename + OUTPUT_STRIP_TRAILING_WHITESPACE) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${dusk_git_head_filename}") + + execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --symbolic-full-name HEAD + OUTPUT_VARIABLE dusk_git_head_symbolic + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${GIT_EXECUTABLE} rev-parse --git-path ${dusk_git_head_symbolic} + OUTPUT_VARIABLE dusk_git_head_symbolic_filename + OUTPUT_STRIP_TRAILING_WHITESPACE) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${dusk_git_head_symbolic_filename}") + + # defines DUSK_WC_REVISION + execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + OUTPUT_VARIABLE DUSK_WC_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE) + # defines DUSK_WC_DESCRIBE + execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --tags --long --dirty --match "v*" + OUTPUT_VARIABLE DUSK_WC_DESCRIBE + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # remove the git hash, then collapse a clean "-0" suffix only + string(REGEX REPLACE "-[^-]+(-dirty|)$" "\\1" DUSK_WC_DESCRIBE "${DUSK_WC_DESCRIBE}") + string(REGEX REPLACE "-0$" "" DUSK_WC_DESCRIBE "${DUSK_WC_DESCRIBE}") + + # defines DUSK_WC_BRANCH + execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE DUSK_WC_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE) + # defines DUSK_WC_DATE + execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} log -1 --format=%ad + OUTPUT_VARIABLE DUSK_WC_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE) +else () + message(STATUS "Unable to find git, commit information will not be available") +endif () + +if (DUSK_WC_DESCRIBE) + string(REGEX REPLACE "v([0-9]+)\.([0-9]+)\.([0-9]+)\-([0-9]+).*" "\\1.\\2.\\3.\\4" DUSK_VERSION_STRING "${DUSK_WC_DESCRIBE}") + string(REGEX REPLACE "v([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\1.\\2.\\3" DUSK_SHORT_VERSION_STRING "${DUSK_WC_DESCRIBE}") +else () + set(DUSK_WC_DESCRIBE "UNKNOWN-VERSION") + set(DUSK_VERSION_STRING "0.0.0") +endif () + +# Add version information to CI environment variables +if(DEFINED ENV{GITHUB_ENV}) + file(APPEND "$ENV{GITHUB_ENV}" "DUSK_VERSION=${DUSK_WC_DESCRIBE}\n") +endif() +message(STATUS "Dusk version set to ${DUSK_WC_DESCRIBE}") +message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +project(dusk LANGUAGES C CXX VERSION ${DUSK_VERSION_STRING}) +if (APPLE AND NOT TVOS AND CMAKE_SYSTEM_NAME STREQUAL tvOS) + # ios.toolchain.cmake hack for SDL + set(TVOS ON) + set(IOS OFF) +endif () + +if(APPLE AND NOT CMAKE_OSX_SYSROOT) + # If the Xcode SDK is lagging behind system version, CMake needs this done first + execute_process(COMMAND xcrun --sdk macosx --show-sdk-path + OUTPUT_VARIABLE CMAKE_OSX_SYSROOT + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) if (CMAKE_SYSTEM_NAME STREQUAL Linux) set(DAWN_USE_WAYLAND ON CACHE BOOL "Enable support for Wayland surface" FORCE) @@ -19,15 +91,46 @@ add_subdirectory(extern/aurora EXCLUDE_FROM_ALL) add_subdirectory(libs/freeverb) -option(DUSK_BUILD_WARNINGS "If off, compiler warnings will be suppressed") +option(DUSK_BUILD_WARNINGS "Enable compiler warnings (off by default)") option(DUSK_SELECTED_OPT "If on, selected parts of the project will be compiled with optimizations on Debug, intending to make the game run at 30 FPS. Note for MSVC: you will need to remove '/RTC1' from your debug flags in CMake.") option(DUSK_MOVIE_SUPPORT "If on, compile against libjpeg-turbo to enable THP file decoding" ON) -find_package(libjpeg-turbo) -set(DUSK_MOVIE_SUPPORT_REAL ${DUSK_MOVIE_SUPPORT}) -if (DUSK_MOVIE_SUPPORT AND NOT libjpeg-turbo_FOUND) - message(WARNING "libjpeg-turbo not found but DUSK_MOVIE_SUPPORT set, movie playback will not be available!") - set(DUSK_MOVIE_SUPPORT_REAL OFF) +if (DUSK_MOVIE_SUPPORT) + find_package(libjpeg-turbo QUIET) + if (libjpeg-turbo_FOUND) + message(STATUS "dusk: Using system libjpeg-turbo") + else () + message(STATUS "dusk: Fetching libjpeg-turbo") + include(ExternalProject) + set(_jpeg_install_dir ${CMAKE_BINARY_DIR}/libjpeg-turbo-install) + if (WIN32) + set(_jpeg_lib ${_jpeg_install_dir}/lib/turbojpeg-static.lib) + else () + set(_jpeg_lib ${_jpeg_install_dir}/lib/libturbojpeg.a) + endif () + ExternalProject_Add(libjpeg-turbo-ext + URL https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/3.1.0.tar.gz + URL_HASH SHA256=35fec2e1ddfb05ecf6d93e50bc57c1e54bc81c16d611ddf6eff73fff266d8285 + CMAKE_ARGS + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_INSTALL_PREFIX=${_jpeg_install_dir} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER} + -DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY} + -DENABLE_SHARED=OFF + -DWITH_TURBOJPEG=ON + -DWITH_JAVA=OFF + BUILD_BYPRODUCTS ${_jpeg_lib} + ) + file(MAKE_DIRECTORY ${_jpeg_install_dir}/include) + add_library(libjpeg-turbo::turbojpeg-static STATIC IMPORTED GLOBAL) + set_target_properties(libjpeg-turbo::turbojpeg-static PROPERTIES + IMPORTED_LOCATION ${_jpeg_lib} + INTERFACE_INCLUDE_DIRECTORIES ${_jpeg_install_dir}/include + ) + add_dependencies(libjpeg-turbo::turbojpeg-static libjpeg-turbo-ext) + endif () endif () if (CMAKE_SYSTEM_NAME STREQUAL Linux) @@ -48,6 +151,8 @@ elseif (MSVC) add_compile_options(/bigobj) add_compile_options(/Zc:strictStrings-) add_compile_options(/MP) + add_compile_options(/FS) + if (NOT DUSK_BUILD_WARNINGS) add_compile_options(/W0) else () @@ -63,33 +168,34 @@ endif () include(FetchContent) +# Declare all dependencies first so CMake can download them in parallel message(STATUS "dusk: Fetching cxxopts") -FetchContent_Declare( - cxxopts - GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git - GIT_TAG v3.3.1 +FetchContent_Declare(cxxopts + URL https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.3.1.tar.gz + URL_HASH SHA256=3bfc70542c521d4b55a46429d808178916a579b28d048bd8c727ee76c39e2072 + DOWNLOAD_EXTRACT_TIMESTAMP TRUE ) - -FetchContent_MakeAvailable(cxxopts) +message(STATUS "dusk: Fetching nlohmann/json") FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz URL_HASH SHA256=42f6e95cad6ec532fd372391373363b62a14af6d771056dbfc86160e6dfff7aa DOWNLOAD_EXTRACT_TIMESTAMP TRUE ) -FetchContent_MakeAvailable(json) +FetchContent_MakeAvailable(cxxopts json) + +configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h) include(files.cmake) # TODO: version handling for res includes +set(DUSK_BUNDLE_NAME Dusk) +set(DUSK_BUNDLE_IDENTIFIER dev.decomp.dusk) set(DUSK_GAME_NAME "GZ2E") set(DUSK_GAME_VERSION "01") - set(DUSK_TP_VERSION ${DUSK_GAME_NAME}${DUSK_GAME_VERSION}) -message(STATUS "dusk: Game Name: ${DUSK_GAME_NAME}") -message(STATUS "dusk: Game Version: ${DUSK_GAME_VERSION}") -message(STATUS "dusk: TP Version: ${DUSK_TP_VERSION}") +message(STATUS "dusk: Game Version: ${DUSK_TP_VERSION}") source_group("dolzel" FILES ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${JSYSTEM_FILES} ${JSYSTEM_DEBUG_FILES} ${REL_FILES}) source_group("dusk" FILES ${DUSK_FILES}) @@ -104,20 +210,15 @@ set(GAME_INCLUDE_DIRS libs/JSystem/include libs extern/aurora/include/dolphin - extern) + extern + ${CMAKE_BINARY_DIR}) set(GAME_LIBS aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient) -if (DUSK_MOVIE_SUPPORT_REAL) - if (TARGET libjpeg-turbo::turbojpeg-static) - message(STATUS "dusk: Linking against libjpeg-turbo static library") - list(APPEND GAME_LIBS "libjpeg-turbo::turbojpeg-static") - else () - message(STATUS "dusk: Linking against libjpeg-turbo shared library") - list(APPEND GAME_LIBS "libjpeg-turbo::turbojpeg") - endif () - list(APPEND GAME_COMPILE_DEFS MOVIE_SUPPORT=1) +if (DUSK_MOVIE_SUPPORT) + list(APPEND GAME_LIBS libjpeg-turbo::turbojpeg-static) + list(APPEND GAME_COMPILE_DEFS MOVIE_SUPPORT=1) endif () # game_debug is for game code files that we know work when compiled with DEBUG=1 @@ -125,17 +226,13 @@ endif () add_library(game_debug OBJECT ${JSYSTEM_DEBUG_FILES} ${SSYSTEM_FILES} src/dusk/audio/DuskAudioSystem.cpp src/dusk/audio/JASCriticalSection.cpp - src/dusk/audio/DuskDsp.hpp src/dusk/audio/DuskDsp.cpp src/dusk/audio/Adpcm.cpp - src/dusk/audio/Adpcm.hpp - src/dusk/audio/DspStub.cpp) + src/dusk/audio/DspStub.cpp + src/dusk/imgui/ImGuiAudio.cpp) # game_base is for all other game code files -add_library(game_base OBJECT ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${JSYSTEM_FILES} ${REL_FILES} ${DUSK_FILES} - ${DOLPHIN_FILES} - src/dusk/imgui/ImGuiStubLog.cpp - src/dusk/imgui/ImGuiAudio.cpp) +add_library(game_base OBJECT ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${JSYSTEM_FILES} ${REL_FILES} ${DUSK_FILES} ${DOLPHIN_FILES}) target_compile_definitions(game_debug PRIVATE ${GAME_COMPILE_DEFS} $<$:DEBUG=1> $<$:PARTIAL_DEBUG=1>) target_compile_definitions(game_base PRIVATE ${GAME_COMPILE_DEFS} NDEBUG=1 NDEBUG_DEFINED=1 DEBUG_DEFINED=0 $<$:PARTIAL_DEBUG=1>) @@ -160,7 +257,7 @@ target_link_libraries(game PUBLIC ${GAME_LIBS}) add_executable(dusk src/dusk/main.cpp) target_compile_definitions(dusk PRIVATE TARGET_PC AVOID_UB=1 VERSION=0) target_include_directories(dusk PRIVATE include) -target_link_libraries(dusk PRIVATE game aurora::main freeverb) +target_link_libraries(dusk PRIVATE game aurora::main) add_custom_command(TARGET dusk POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory @@ -169,6 +266,49 @@ add_custom_command(TARGET dusk POST_BUILD COMMENT "Copying resources" ) +if (APPLE) + if (IOS) + set(DUSK_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios) + set(DUSK_INFO_PLIST ${DUSK_RESOURCE_DIR}/Info.plist.in) + file(GLOB_RECURSE DUSK_RESOURCE_FILES "${DUSK_RESOURCE_DIR}/Base.lproj/*") + endif () + if (IOS OR TVOS) + target_sources(dusk PRIVATE ${DUSK_RESOURCE_FILES}) + foreach (FILE ${DUSK_RESOURCE_FILES}) + file(RELATIVE_PATH NEW_FILE "${DUSK_RESOURCE_DIR}" ${FILE}) + get_filename_component(NEW_FILE_PATH ${NEW_FILE} DIRECTORY) + set_property(SOURCE ${FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources/${NEW_FILE_PATH}") + endforeach () + set_target_properties( + dusk PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_BUNDLE_NAME ${DUSK_BUNDLE_NAME} + MACOSX_BUNDLE_GUI_IDENTIFIER ${DUSK_BUNDLE_IDENTIFIER} + MACOSX_BUNDLE_BUNDLE_VERSION ${DUSK_VERSION_STRING} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${DUSK_SHORT_VERSION_STRING} + OUTPUT_NAME dusk + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "YES" + XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "YES" + ) + if (CMAKE_GENERATOR STREQUAL "Xcode") + set_target_properties(dusk PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${DUSK_INFO_PLIST}) + elseif (DEFINED DUSK_INFO_PLIST) + set(MACOSX_BUNDLE_EXECUTABLE_NAME dusk) + set(MACOSX_BUNDLE_GUI_IDENTIFIER ${DUSK_BUNDLE_IDENTIFIER}) + set(MACOSX_BUNDLE_BUNDLE_NAME ${DUSK_BUNDLE_NAME}) + set(MACOSX_BUNDLE_BUNDLE_VERSION ${DUSK_VERSION_STRING}) + set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${DUSK_SHORT_VERSION_STRING}) + set(DUSK_GENERATED_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/dusk.Info.plist) + configure_file(${DUSK_INFO_PLIST} ${DUSK_GENERATED_INFO_PLIST}) + add_custom_command( + TARGET dusk POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DUSK_GENERATED_INFO_PLIST} $/Info.plist + VERBATIM + ) + endif () + endif () +endif () + include(extern/aurora/cmake/AuroraCopyRuntimeDLLs.cmake) aurora_copy_runtime_dlls(dusk) @@ -183,3 +323,79 @@ if (DUSK_SELECTED_OPT) target_compile_options(aurora_gx PRIVATE ${_opt_flags}) target_compile_options(freeverb PRIVATE ${_opt_flags}) endif () + +# Packaging logic +function(get_target_output_name target result_var) + get_target_property(output_name ${target} OUTPUT_NAME) + if (NOT output_name) + set(${result_var} "${target}" PARENT_SCOPE) + else () + set(${result_var} "${output_name}" PARENT_SCOPE) + endif () +endfunction() +function(get_target_prefix target result_var) + set(${result_var} "" PARENT_SCOPE) + if (APPLE) + # Have to recreate some bundle logic here, since CMake can't tell us + get_target_property(is_bundle ${target} MACOSX_BUNDLE) + if (is_bundle) + get_target_output_name(${target} output_name) + if (CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(${result_var} "${output_name}.app/Contents/MacOS/" PARENT_SCOPE) + else () + set(${result_var} "${output_name}.app/" PARENT_SCOPE) + endif () + endif () + endif () +endfunction() +list(APPEND BINARY_TARGETS dusk) +set(EXTRA_TARGETS "") +if (TARGET crashpad_handler) + list(APPEND EXTRA_TARGETS crashpad_handler) +endif () +install(TARGETS ${BINARY_TARGETS} ${EXTRA_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX}) +if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) + set(DEBUG_FILES_LIST "") + foreach (target IN LISTS BINARY_TARGETS EXTRA_TARGETS) + get_target_output_name(${target} output_name) + if (WIN32) + install(FILES $ DESTINATION ${CMAKE_INSTALL_PREFIX} OPTIONAL) + elseif (APPLE) + get_target_prefix(${target} target_prefix) + install(CODE "execute_process(WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\" COMMAND rm -fr \"$.dSYM\")") + install(CODE "execute_process(WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\" COMMAND dsymutil \"${target_prefix}$\")") + install(CODE "execute_process(WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\" COMMAND strip -S \"${target_prefix}$\")") + if (NOT target_prefix STREQUAL "") + install(CODE "execute_process(WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\" COMMAND mv \"${target_prefix}$.dSYM\" .)") + endif () + elseif (UNIX) + get_target_prefix(${target} target_prefix) + install(CODE "execute_process(WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\" COMMAND objcopy --only-keep-debug \"${target_prefix}$\" \"${target_prefix}$.dbg\")") + install(CODE "execute_process(WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\" COMMAND objcopy --strip-debug --add-gnu-debuglink=$.dbg \"${target_prefix}$\")") + endif () + list(APPEND DEBUG_FILES_LIST "${output_name}") + endforeach () + if (WIN32) + list(TRANSFORM DEBUG_FILES_LIST APPEND ".pdb") + list(JOIN DEBUG_FILES_LIST " " DEBUG_FILES) + install(CODE "execute_process(WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\" COMMAND 7z a -t7z \"${CMAKE_INSTALL_PREFIX}/debug.7z\" ${DEBUG_FILES})") + elseif (APPLE) + list(TRANSFORM DEBUG_FILES_LIST APPEND ".dSYM") + list(JOIN DEBUG_FILES_LIST " " DEBUG_FILES) + install(CODE "execute_process(WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\" COMMAND tar acfv \"${CMAKE_INSTALL_PREFIX}/debug.tar.xz\" ${DEBUG_FILES})") + elseif (UNIX) + list(TRANSFORM DEBUG_FILES_LIST APPEND ".dbg") + list(JOIN DEBUG_FILES_LIST " " DEBUG_FILES) + install(CODE "execute_process(WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\" COMMAND tar -I \"xz -9 -T0\" -cvf \"${CMAKE_INSTALL_PREFIX}/debug.tar.xz\" ${DEBUG_FILES})") + endif () +endif () +foreach (target IN LISTS BINARY_TARGETS) + get_target_prefix(${target} target_prefix) + foreach (extra_target IN LISTS EXTRA_TARGETS) + get_target_prefix(${extra_target} extra_prefix) + if (NOT "${target_prefix}" STREQUAL "${extra_prefix}") + # Copy extra target to target prefix + install(CODE "execute_process(WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\" COMMAND cp \"${extra_prefix}$\" \"${target_prefix}$\")") + endif () + endforeach () +endforeach () diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000000..73c9915aba --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,603 @@ +{ + "version": 2, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "configurePresets": [ + { + "name": "debug", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDebugDLL" + } + }, + { + "name": "relwithdebinfo", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded" + } + }, + { + "name": "linux-default", + "displayName": "Linux (default)", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Linux" + ] + }, + "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { + "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" + } + } + }, + { + "name": "linux-default-debug", + "displayName": "Linux (default) Debug", + "inherits": [ + "debug", + "linux-default" + ] + }, + { + "name": "linux-default-relwithdebinfo", + "displayName": "Linux (default) RelWithDebInfo", + "inherits": [ + "relwithdebinfo", + "linux-default" + ] + }, + { + "name": "linux-clang", + "displayName": "Linux (Clang)", + "inherits": [ + "linux-default" + ], + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++" + } + }, + { + "name": "linux-clang-debug", + "displayName": "Linux (Clang) Debug", + "inherits": [ + "debug", + "linux-clang" + ] + }, + { + "name": "linux-clang-relwithdebinfo", + "displayName": "Linux (Clang) RelWithDebInfo", + "inherits": [ + "relwithdebinfo", + "linux-clang" + ] + }, + { + "name": "windows-msvc", + "displayName": "Windows (MSVC)", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_C_COMPILER": "cl", + "CMAKE_CXX_COMPILER": "cl", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Windows" + ] + } + } + }, + { + "name": "windows-msvc-debug", + "displayName": "Windows (MSVC) Debug", + "inherits": [ + "debug", + "windows-msvc" + ] + }, + { + "name": "windows-msvc-relwithdebinfo", + "displayName": "Windows (MSVC) RelWithDebInfo", + "inherits": [ + "relwithdebinfo", + "windows-msvc" + ] + }, + { + "name": "windows-arm64-msvc", + "displayName": "Windows ARM64 (MSVC)", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "architecture": { + "value": "arm64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_C_COMPILER": "cl", + "CMAKE_CXX_COMPILER": "cl", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install", + "AURORA_DAWN_PROVIDER": "vendor" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Windows" + ] + } + } + }, + { + "name": "windows-clang", + "displayName": "Windows (Clang)", + "inherits": [ + "windows-msvc" + ], + "cacheVariables": { + "CMAKE_C_COMPILER": "clang-cl", + "CMAKE_CXX_COMPILER": "clang-cl", + "CMAKE_LINKER": "lld-link" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "intelliSenseMode": "windows-clang-x64" + } + } + }, + { + "name": "windows-clang-debug", + "displayName": "Windows (Clang) Debug", + "inherits": [ + "debug", + "windows-clang" + ] + }, + { + "name": "windows-clang-relwithdebinfo", + "displayName": "Windows (Clang) RelWithDebInfo", + "inherits": [ + "relwithdebinfo", + "windows-clang" + ] + }, + { + "name": "macos-default", + "displayName": "macOS (default)", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "macOS" + ] + } + } + }, + { + "name": "macos-default-debug", + "displayName": "macOS (default) Debug", + "inherits": [ + "debug", + "macos-default" + ] + }, + { + "name": "macos-default-relwithdebinfo", + "displayName": "macOS (default) RelWithDebInfo", + "inherits": [ + "relwithdebinfo", + "macos-default" + ] + }, + { + "name": "ios-default", + "displayName": "iOS", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "inherits": [ + "relwithdebinfo" + ], + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "ios.toolchain.cmake", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install", + "PLATFORM": "OS64", + "DEPLOYMENT_TARGET": "14.0", + "ENABLE_BITCODE": { + "type": "BOOL", + "value": false + }, + "ENABLE_ARC": { + "type": "BOOL", + "value": false + }, + "Rust_CARGO_TARGET": "aarch64-apple-ios", + "BUILD_SHARED_LIBS": { + "type": "BOOL", + "value": false + }, + "CMAKE_DISABLE_FIND_PACKAGE_BZip2": { + "type": "BOOL", + "value": true + }, + "CMAKE_DISABLE_FIND_PACKAGE_LibLZMA": { + "type": "BOOL", + "value": true + }, + "CMAKE_DISABLE_FIND_PACKAGE_zstd": { + "type": "BOOL", + "value": true + }, + "CMAKE_DISABLE_FIND_PACKAGE_Freetype": { + "type": "BOOL", + "value": true + } + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "macOS" + ] + } + } + }, + { + "name": "tvos-default", + "displayName": "tvOS", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "inherits": [ + "relwithdebinfo" + ], + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "ios.toolchain.cmake", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install", + "PLATFORM": "TVOS", + "DEPLOYMENT_TARGET": "14.5", + "ENABLE_BITCODE": { + "type": "BOOL", + "value": false + }, + "Rust_CARGO_TARGET": "aarch64-apple-tvos", + "Rust_TOOLCHAIN": "nightly", + "BUILD_SHARED_LIBS": { + "type": "BOOL", + "value": false + }, + "CMAKE_DISABLE_FIND_PACKAGE_BZip2": { + "type": "BOOL", + "value": true + }, + "CMAKE_DISABLE_FIND_PACKAGE_LibLZMA": { + "type": "BOOL", + "value": true + }, + "CMAKE_DISABLE_FIND_PACKAGE_zstd": { + "type": "BOOL", + "value": true + } + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "macOS" + ] + } + } + }, + { + "name": "android-base", + "hidden": true, + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "inherits": [ + "relwithdebinfo" + ], + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install", + "CMAKE_TOOLCHAIN_FILE": "$env{ANDROID_HOME}/ndk/$env{ANDROID_NDK_VERSION}/build/cmake/android.toolchain.cmake", + "ANDROID_PLATFORM": "android-24" + } + }, + { + "name": "android-arm64", + "displayName": "Android (arm64-v8a)", + "inherits": [ + "android-base" + ], + "cacheVariables": { + "ANDROID_ABI": "arm64-v8a" + } + }, + { + "name": "android-x86_64", + "displayName": "Android (x86_64)", + "inherits": [ + "android-base" + ], + "cacheVariables": { + "ANDROID_ABI": "x86_64" + } + }, + { + "name": "x-linux-ci", + "hidden": true, + "inherits": [ + "relwithdebinfo" + ], + "cacheVariables": { + "CMAKE_C_COMPILER_LAUNCHER": "sccache", + "CMAKE_CXX_COMPILER_LAUNCHER": "sccache" + } + }, + { + "name": "x-linux-ci-gcc", + "inherits": [ + "x-linux-ci", + "linux-default" + ] + }, + { + "name": "x-linux-ci-clang", + "inherits": [ + "x-linux-ci", + "linux-clang" + ] + }, + { + "name": "x-macos-ci", + "inherits": [ + "macos-default-relwithdebinfo" + ], + "cacheVariables": { + "CMAKE_C_COMPILER_LAUNCHER": "sccache", + "CMAKE_CXX_COMPILER_LAUNCHER": "sccache" + } + }, + { + "name": "x-ios-ci", + "inherits": [ + "ios-default" + ], + "cacheVariables": { + "CMAKE_C_COMPILER_LAUNCHER": "sccache", + "CMAKE_CXX_COMPILER_LAUNCHER": "sccache" + } + }, + { + "name": "x-tvos-ci", + "inherits": [ + "tvos-default" + ], + "cacheVariables": { + "CMAKE_C_COMPILER_LAUNCHER": "sccache", + "CMAKE_CXX_COMPILER_LAUNCHER": "sccache" + } + }, + { + "name": "x-windows-ci", + "hidden": true, + "inherits": [ + "relwithdebinfo" + ], + "binaryDir": "$env{BUILD_DIR}", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "$env{BUILD_DIR}/install", + "CMAKE_C_COMPILER_LAUNCHER": "sccache", + "CMAKE_CXX_COMPILER_LAUNCHER": "sccache", + "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT": "Embedded" + } + }, + { + "name": "x-windows-ci-msvc", + "inherits": [ + "x-windows-ci", + "windows-msvc" + ] + }, + { + "name": "x-windows-ci-clang", + "inherits": [ + "x-windows-ci", + "windows-clang" + ] + }, + { + "name": "x-windows-ci-arm64-msvc", + "inherits": [ + "x-windows-ci", + "windows-arm64-msvc" + ] + } + ], + "buildPresets": [ + { + "name": "linux-default-debug", + "configurePreset": "linux-default-debug", + "description": "Linux (default) debug build", + "displayName": "Linux (default) Debug" + }, + { + "name": "linux-default-relwithdebinfo", + "configurePreset": "linux-default-relwithdebinfo", + "description": "Linux (default) release build with debug info", + "displayName": "Linux (default) RelWithDebInfo" + }, + { + "name": "linux-clang-debug", + "configurePreset": "linux-clang-debug", + "description": "Linux (Clang) debug build", + "displayName": "Linux (Clang) Debug" + }, + { + "name": "linux-clang-relwithdebinfo", + "configurePreset": "linux-clang-relwithdebinfo", + "description": "Linux (Clang) release build with debug info", + "displayName": "Linux (Clang) RelWithDebInfo" + }, + { + "name": "macos-default-debug", + "configurePreset": "macos-default-debug", + "description": "macOS debug build", + "displayName": "macOS Debug" + }, + { + "name": "macos-default-relwithdebinfo", + "configurePreset": "macos-default-relwithdebinfo", + "description": "macOS release build with debug info", + "displayName": "macOS RelWithDebInfo" + }, + { + "name": "ios-default", + "configurePreset": "ios-default", + "description": "iOS release build with debug info", + "displayName": "iOS RelWithDebInfo", + "targets": [ + "dusk" + ] + }, + { + "name": "tvos-default", + "configurePreset": "tvos-default", + "description": "tvOS release build with debug info", + "displayName": "tvOS RelWithDebInfo", + "targets": [ + "dusk" + ] + }, + { + "name": "android-arm64", + "configurePreset": "android-arm64", + "description": "Android arm64-v8a release build with debug info", + "displayName": "Android arm64-v8a RelWithDebInfo", + "targets": [ + "dusk" + ] + }, + { + "name": "android-x86_64", + "configurePreset": "android-x86_64", + "description": "Android x86_64 release build with debug info", + "displayName": "Android x86_64 RelWithDebInfo", + "targets": [ + "dusk" + ] + }, + { + "name": "windows-msvc-debug", + "configurePreset": "windows-msvc-debug", + "description": "Windows (MSVC) debug build", + "displayName": "Windows (MSVC) Debug" + }, + { + "name": "windows-msvc-relwithdebinfo", + "configurePreset": "windows-msvc-relwithdebinfo", + "description": "Windows (MSVC) release build with debug info", + "displayName": "Windows (MSVC) RelWithDebInfo" + }, + { + "name": "windows-clang-debug", + "configurePreset": "windows-clang-debug", + "description": "Windows (Clang) debug build", + "displayName": "Windows (Clang) Debug" + }, + { + "name": "windows-clang-relwithdebinfo", + "configurePreset": "windows-clang-relwithdebinfo", + "description": "Windows (Clang) release build with debug info", + "displayName": "Windows (Clang) RelWithDebInfo" + }, + { + "name": "x-linux-ci-gcc", + "configurePreset": "x-linux-ci-gcc", + "description": "(Internal) Linux CI GCC", + "displayName": "(Internal) Linux CI GCC", + "targets": [ + "install" + ] + }, + { + "name": "x-linux-ci-clang", + "configurePreset": "x-linux-ci-clang", + "description": "(Internal) Linux CI Clang", + "displayName": "(Internal) Linux CI Clang", + "targets": [ + "install" + ] + }, + { + "name": "x-macos-ci", + "configurePreset": "x-macos-ci", + "description": "(Internal) macOS CI", + "displayName": "(Internal) macOS CI", + "targets": [ + "install" + ] + }, + { + "name": "x-ios-ci", + "configurePreset": "x-ios-ci", + "description": "(Internal) iOS CI", + "displayName": "(Internal) iOS CI", + "targets": [ + "install" + ] + }, + { + "name": "x-tvos-ci", + "configurePreset": "x-tvos-ci", + "description": "(Internal) tvOS CI", + "displayName": "(Internal) tvOS CI", + "targets": [ + "install" + ] + }, + { + "name": "x-windows-ci-msvc", + "configurePreset": "x-windows-ci-msvc", + "description": "(Internal) Windows CI MSVC", + "displayName": "(Internal) Windows CI MSVC", + "targets": [ + "install" + ] + }, + { + "name": "x-windows-ci-clang", + "configurePreset": "x-windows-ci-clang", + "description": "(Internal) Windows CI Clang", + "displayName": "(Internal) Windows CI Clang", + "targets": [ + "install" + ] + }, + { + "name": "x-windows-ci-arm64-msvc", + "configurePreset": "x-windows-ci-arm64-msvc", + "description": "(Internal) Windows CI MSVC arm64", + "displayName": "(Internal) Windows CI MSVC arm64", + "targets": [ + "install" + ] + } + ] +} diff --git a/ci/build-appimage.sh b/ci/build-appimage.sh new file mode 100755 index 0000000000..82c4cffaeb --- /dev/null +++ b/ci/build-appimage.sh @@ -0,0 +1,18 @@ +#!/bin/bash -ex +shopt -s extglob + +# Get linuxdeploy +cd "$RUNNER_WORKSPACE" +curl -fOL https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$(uname -m).AppImage +chmod +x linuxdeploy-$(uname -m).AppImage + +# Build AppImage +cd "$GITHUB_WORKSPACE" +mkdir -p build/appdir/usr/{bin,share/{applications,icons/hicolor}} +cp build/install/!(*.*) build/appdir/usr/bin +cp -r platforms/freedesktop/{16x16,32x32,48x48,64x64,128x128,256x256,512x512,1024x1024} build/appdir/usr/share/icons/hicolor +cp platforms/freedesktop/dusk.desktop build/appdir/usr/share/applications + +cd build/install +VERSION="$DUSK_VERSION" NO_STRIP=1 "$RUNNER_WORKSPACE"/linuxdeploy-$(uname -m).AppImage \ + --appdir "$GITHUB_WORKSPACE"/build/appdir --output appimage diff --git a/include/dusk/config_var.hpp b/include/dusk/config_var.hpp index 064d37028d..6b78ee2e33 100644 --- a/include/dusk/config_var.hpp +++ b/include/dusk/config_var.hpp @@ -165,7 +165,7 @@ public: * @param arg Arguments to forward to construct the default value. */ template - explicit ConfigVar(const char* name, Args&&... arg) + ConfigVar(const char* name, Args&&... arg) : ConfigVarBase(name, GetConfigImpl()), defaultValue(std::forward(arg)...), value(), overrideValue() {} diff --git a/include/dusk/time.h b/include/dusk/time.h index 501875971b..94f819f76b 100644 --- a/include/dusk/time.h +++ b/include/dusk/time.h @@ -14,6 +14,7 @@ #endif #include #include +#include #endif #include "dusk/logging.h" @@ -92,7 +93,11 @@ private: } do { QueryPerformanceCounter(¤t); - _mm_pause(); // Yield CPU +#if defined(_M_ARM64) || defined(_M_ARM) + __yield(); +#else + _mm_pause(); +#endif } while (current.QuadPart - start.QuadPart < ticksToWait); } #else diff --git a/include/global.h b/include/global.h index bb30611486..ff2d18427d 100644 --- a/include/global.h +++ b/include/global.h @@ -194,15 +194,12 @@ static const float INF = 2000000000.0f; #endif // potential fakematch? -#if DEBUG #define FABSF fabsf -#else -#define FABSF std::fabsf -#endif #ifndef __MWERKS__ #if __cplusplus #include +#include using std::isnan; #endif #endif diff --git a/ios.toolchain.cmake b/ios.toolchain.cmake new file mode 100644 index 0000000000..fb6052fc9b --- /dev/null +++ b/ios.toolchain.cmake @@ -0,0 +1,1177 @@ +# This file is part of the ios-cmake project. It was retrieved from +# https://github.com/leetal/ios-cmake.git, which is a fork of +# https://github.com/gerstrong/ios-cmake.git, which is a fork of +# https://github.com/cristeab/ios-cmake.git, which is a fork of +# https://code.google.com/p/ios-cmake/. Which in turn is based off of +# the Platform/Darwin.cmake and Platform/UnixPaths.cmake files which +# are included with CMake 2.8.4 +# +# The ios-cmake project is licensed under the new BSD license. +# +# Copyright (c) 2014, Bogdan Cristea and LTE Engineering Software, +# Kitware, Inc., Insight Software Consortium. All rights reserved. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. 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. +# +# 3. Neither the name of the copyright holder 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 THE +# COPYRIGHT HOLDER OR CONTRIBUTORS 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. +# +# This file is based on the Platform/Darwin.cmake and +# Platform/UnixPaths.cmake files which are included with CMake 2.8.4 +# It has been altered for iOS development. +# +# Updated by Alex Stewart (alexs.mac@gmail.com) +# +# ***************************************************************************** +# Now maintained by Alexander Widerberg (widerbergaren [at] gmail.com) +# under the BSD-3-Clause license +# https://github.com/leetal/ios-cmake +# ***************************************************************************** +# +# INFORMATION / HELP +# +############################################################################### +# OPTIONS # +############################################################################### +# +# PLATFORM: (default "OS64") +# OS = Build for iPhoneOS. +# OS64 = Build for arm64 iphoneOS. +# OS64COMBINED = Build for arm64 x86_64 iphoneOS + iphoneOS Simulator. Combined into FAT STATIC lib (only supported on 3.14+ of CMake with "-G Xcode" argument in combination with the "cmake --install" CMake build step) +# SIMULATOR = Build for x86 i386 iphoneOS Simulator. +# SIMULATOR64 = Build for x86_64 iphoneOS Simulator. +# SIMULATORARM64 = Build for arm64 iphoneOS Simulator. +# SIMULATOR64COMBINED = Build for arm64 x86_64 iphoneOS Simulator. Combined into FAT STATIC lib (supported on 3.14+ of CMakewith "-G Xcode" argument ONLY) +# TVOS = Build for arm64 tvOS. +# TVOSCOMBINED = Build for arm64 x86_64 tvOS + tvOS Simulator. Combined into FAT STATIC lib (only supported on 3.14+ of CMake with "-G Xcode" argument in combination with the "cmake --install" CMake build step) +# SIMULATOR_TVOS = Build for x86_64 tvOS Simulator. +# SIMULATORARM64_TVOS = Build for arm64 tvOS Simulator. +# VISIONOSCOMBINED = Build for arm64 visionOS + visionOS Simulator. Combined into FAT STATIC lib (only supported on 3.14+ of CMake with "-G Xcode" argument in combination with the "cmake --install" CMake build step) +# VISIONOS = Build for arm64 visionOS. +# SIMULATOR_VISIONOS = Build for arm64 visionOS Simulator. +# WATCHOS = Build for armv7k arm64_32 for watchOS. +# WATCHOSCOMBINED = Build for armv7k arm64_32 x86_64 watchOS + watchOS Simulator. Combined into FAT STATIC lib (only supported on 3.14+ of CMake with "-G Xcode" argument in combination with the "cmake --install" CMake build step) +# SIMULATOR_WATCHOS = Build for x86_64 for watchOS Simulator. +# SIMULATORARM64_WATCHOS = Build for arm64 for watchOS Simulator. +# SIMULATOR_WATCHOSCOMBINED = Build for arm64 x86_64 for watchOS Simulator. Combined into FAT STATIC lib (supported on 3.14+ of CMakewith "-G Xcode" argument ONLY) +# MAC = Build for x86_64 macOS. +# MAC_ARM64 = Build for Apple Silicon macOS. +# MAC_UNIVERSAL = Combined build for x86_64 and Apple Silicon on macOS. +# MAC_CATALYST = Build for x86_64 macOS with Catalyst support (iOS toolchain on macOS). +# Note: The build argument "MACOSX_DEPLOYMENT_TARGET" can be used to control min-version of macOS +# MAC_CATALYST_ARM64 = Build for Apple Silicon macOS with Catalyst support (iOS toolchain on macOS). +# Note: The build argument "MACOSX_DEPLOYMENT_TARGET" can be used to control min-version of macOS +# MAC_CATALYST_UNIVERSAL = Combined build for x86_64 and Apple Silicon on Catalyst. +# +# CMAKE_OSX_SYSROOT: Path to the SDK to use. By default this is +# automatically determined from PLATFORM and xcodebuild, but +# can also be manually specified (although this should not be required). +# +# CMAKE_DEVELOPER_ROOT: Path to the Developer directory for the platform +# being compiled for. By default, this is automatically determined from +# CMAKE_OSX_SYSROOT, but can also be manually specified (although this should +# not be required). +# +# DEPLOYMENT_TARGET: Minimum SDK version to target. Default 6.0 on watchOS, 13.0 on tvOS+iOS/iPadOS, 11.0 on macOS, 1.0 on visionOS +# +# NAMED_LANGUAGE_SUPPORT: +# ON (default) = Will require "enable_language(OBJC) and/or enable_language(OBJCXX)" for full OBJC|OBJCXX support +# OFF = Will embed the OBJC and OBJCXX flags into the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (legacy behavior, CMake version < 3.16) +# +# ENABLE_BITCODE: (ON|OFF) Enables or disables bitcode support. Default OFF +# +# ENABLE_ARC: (ON|OFF) Enables or disables ARC support. Default ON (ARC enabled by default) +# +# ENABLE_VISIBILITY: (ON|OFF) Enables or disables symbol visibility support. Default OFF (visibility hidden by default) +# +# ENABLE_STRICT_TRY_COMPILE: (ON|OFF) Enables or disables strict try_compile() on all Check* directives (will run linker +# to actually check if linking is possible). Default OFF (will set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY) +# +# ARCHS: (armv7 armv7s armv7k arm64 arm64_32 i386 x86_64) If specified, will override the default architectures for the given PLATFORM +# OS = armv7 armv7s arm64 (if applicable) +# OS64 = arm64 (if applicable) +# SIMULATOR = i386 +# SIMULATOR64 = x86_64 +# SIMULATORARM64 = arm64 +# TVOS = arm64 +# SIMULATOR_TVOS = x86_64 (i386 has since long been deprecated) +# SIMULATORARM64_TVOS = arm64 +# WATCHOS = armv7k arm64_32 (if applicable) +# SIMULATOR_WATCHOS = x86_64 (i386 has since long been deprecated) +# SIMULATORARM64_WATCHOS = arm64 +# MAC = x86_64 +# MAC_ARM64 = arm64 +# MAC_UNIVERSAL = x86_64 arm64 +# MAC_CATALYST = x86_64 +# MAC_CATALYST_ARM64 = arm64 +# MAC_CATALYST_UNIVERSAL = x86_64 arm64 +# +# NOTE: When manually specifying ARCHS, put a semi-colon between the entries. E.g., -DARCHS="armv7;arm64" +# +############################################################################### +# END OPTIONS # +############################################################################### +# +# This toolchain defines the following properties (available via get_property()) for use externally: +# +# PLATFORM: The currently targeted platform. +# XCODE_VERSION: Version number (not including Build version) of Xcode detected. +# SDK_VERSION: Version of SDK being used. +# OSX_ARCHITECTURES: Architectures being compiled for (generated from PLATFORM). +# APPLE_TARGET_TRIPLE: Used by autoconf build systems. NOTE: If "ARCHS" is overridden, this will *NOT* be set! +# +# This toolchain defines the following macros for use externally: +# +# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE XCODE_VARIANT) +# A convenience macro for setting xcode specific properties on targets. +# Available variants are: All, Release, RelWithDebInfo, Debug, MinSizeRel +# example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1" "all"). +# +# find_host_package (PROGRAM ARGS) +# A macro used to find executable programs on the host system, not within the +# environment. Thanks to the android-cmake project for providing the +# command. +# + +cmake_minimum_required(VERSION 3.8..3.30) + +# CMake invokes the toolchain file twice during the first build, but only once during subsequent rebuilds. +# NOTE: To improve single-library build-times, provide the flag "OS_SINGLE_BUILD" as a build argument. +if(DEFINED OS_SINGLE_BUILD AND DEFINED ENV{_IOS_TOOLCHAIN_HAS_RUN}) + return() +endif() +set(ENV{_IOS_TOOLCHAIN_HAS_RUN} true) + +# List of supported platform values +list(APPEND _supported_platforms + "OS" "OS64" "OS64COMBINED" "SIMULATOR" "SIMULATOR64" "SIMULATORARM64" "SIMULATOR64COMBINED" + "TVOS" "TVOSCOMBINED" "SIMULATOR_TVOS" "SIMULATORARM64_TVOS" + "WATCHOS" "WATCHOSCOMBINED" "SIMULATOR_WATCHOS" "SIMULATORARM64_WATCHOS" "SIMULATOR_WATCHOSCOMBINED" + "MAC" "MAC_ARM64" "MAC_UNIVERSAL" + "VISIONOS" "SIMULATOR_VISIONOS" "VISIONOSCOMBINED" + "MAC_CATALYST" "MAC_CATALYST_ARM64" "MAC_CATALYST_UNIVERSAL") + +# Cache what generator is used +set(USED_CMAKE_GENERATOR "${CMAKE_GENERATOR}") + +# Check if using a CMake version capable of building combined FAT builds (simulator and target slices combined in one static lib) +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14") + set(MODERN_CMAKE YES) +endif() + +# Get the Xcode version being used. +# Problem: CMake runs toolchain files multiple times, but can't read cache variables on some runs. +# Workaround: On the first run (in which cache variables are always accessible), set an intermediary environment variable. +# +# NOTE: This pattern is used in many places in this toolchain to speed up checks of all sorts +if(DEFINED XCODE_VERSION_INT) + # Environment variables are always preserved. + set(ENV{_XCODE_VERSION_INT} "${XCODE_VERSION_INT}") +elseif(DEFINED ENV{_XCODE_VERSION_INT}) + set(XCODE_VERSION_INT "$ENV{_XCODE_VERSION_INT}") +elseif(NOT DEFINED XCODE_VERSION_INT) + find_program(XCODEBUILD_EXECUTABLE xcodebuild) + if(NOT XCODEBUILD_EXECUTABLE) + message(FATAL_ERROR "xcodebuild not found. Please install either the standalone commandline tools or Xcode.") + endif() + execute_process(COMMAND ${XCODEBUILD_EXECUTABLE} -version + OUTPUT_VARIABLE XCODE_VERSION_INT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX MATCH "Xcode [0-9\\.]+" XCODE_VERSION_INT "${XCODE_VERSION_INT}") + string(REGEX REPLACE "Xcode ([0-9\\.]+)" "\\1" XCODE_VERSION_INT "${XCODE_VERSION_INT}") + set(XCODE_VERSION_INT "${XCODE_VERSION_INT}" CACHE INTERNAL "") +endif() + +# Assuming that xcode 12.0 is installed you most probably have ios sdk 14.0 or later installed (tested on Big Sur) +# if you don't set a deployment target it will be set the way you only get 64-bit builds +#if(NOT DEFINED DEPLOYMENT_TARGET AND XCODE_VERSION_INT VERSION_GREATER 12.0) +# Temporarily fix the arm64 issues in CMake install-combined by excluding arm64 for simulator builds (needed for Apple Silicon...) +# set(CMAKE_XCODE_ATTRIBUTE_EXCLUDED_ARCHS[sdk=iphonesimulator*] "arm64") +#endif() + +# Check if the platform variable is set +if(DEFINED PLATFORM) + # Environment variables are always preserved. + set(ENV{_PLATFORM} "${PLATFORM}") +elseif(DEFINED ENV{_PLATFORM}) + set(PLATFORM "$ENV{_PLATFORM}") +elseif(NOT DEFINED PLATFORM) + message(FATAL_ERROR "PLATFORM argument not set. Bailing configure since I don't know what target you want to build for!") +endif () + +if(PLATFORM MATCHES ".*COMBINED" AND NOT CMAKE_GENERATOR MATCHES "Xcode") + message(FATAL_ERROR "The combined builds support requires Xcode to be used as a generator via '-G Xcode' command-line argument in CMake") +endif() + +# Safeguard that the platform value is set and is one of the supported values +list(FIND _supported_platforms ${PLATFORM} contains_PLATFORM) +if("${contains_PLATFORM}" EQUAL "-1") + string(REPLACE ";" "\n * " _supported_platforms_formatted "${_supported_platforms}") + message(FATAL_ERROR " Invalid PLATFORM specified! Current value: ${PLATFORM}.\n" + " Supported PLATFORM values: \n * ${_supported_platforms_formatted}") +endif() + +# Check if Apple Silicon is supported +if(PLATFORM MATCHES "^(MAC_ARM64)$|^(MAC_CATALYST_ARM64)$|^(MAC_UNIVERSAL)$|^(MAC_CATALYST_UNIVERSAL)$" AND ${CMAKE_VERSION} VERSION_LESS "3.19.5") + message(FATAL_ERROR "Apple Silicon builds requires a minimum of CMake 3.19.5") +endif() + +# Touch the toolchain variable to suppress the "unused variable" warning. +# This happens if CMake is invoked with the same command line the second time. +if(CMAKE_TOOLCHAIN_FILE) +endif() + +# Fix for PThread library not in path +set(CMAKE_THREAD_LIBS_INIT "-lpthread") +set(CMAKE_HAVE_THREADS_LIBRARY 1) +set(CMAKE_USE_WIN32_THREADS_INIT 0) +set(CMAKE_USE_PTHREADS_INIT 1) + +# Specify named language support defaults. +if(NOT DEFINED NAMED_LANGUAGE_SUPPORT AND ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16") + set(NAMED_LANGUAGE_SUPPORT ON) + message(STATUS "[DEFAULTS] Using explicit named language support! E.g., enable_language(CXX) is needed in the project files.") +elseif(NOT DEFINED NAMED_LANGUAGE_SUPPORT AND ${CMAKE_VERSION} VERSION_LESS "3.16") + set(NAMED_LANGUAGE_SUPPORT OFF) + message(STATUS "[DEFAULTS] Disabling explicit named language support. Falling back to legacy behavior.") +elseif(DEFINED NAMED_LANGUAGE_SUPPORT AND ${CMAKE_VERSION} VERSION_LESS "3.16") + message(FATAL_ERROR "CMake named language support for OBJC and OBJCXX was added in CMake 3.16.") +endif() +set(NAMED_LANGUAGE_SUPPORT_INT ${NAMED_LANGUAGE_SUPPORT} CACHE BOOL + "Whether or not to enable explicit named language support" FORCE) + +# Specify the minimum version of the deployment target. +if(NOT DEFINED DEPLOYMENT_TARGET) + if (PLATFORM MATCHES "WATCHOS") + # Unless specified, SDK version 6.0 is used by default as minimum target version (watchOS). + set(DEPLOYMENT_TARGET "6.0") + elseif(PLATFORM STREQUAL "MAC") + # Unless specified, SDK version 11.0 (Big Sur) is used by default as the minimum target version (macOS on x86). + set(DEPLOYMENT_TARGET "11.0") + elseif(PLATFORM STREQUAL "VISIONOS" OR PLATFORM STREQUAL "SIMULATOR_VISIONOS" OR PLATFORM STREQUAL "VISIONOSCOMBINED") + # Unless specified, SDK version 1.0 is used by default as minimum target version (visionOS). + set(DEPLOYMENT_TARGET "1.0") + elseif(PLATFORM STREQUAL "MAC_ARM64") + # Unless specified, SDK version 11.0 (Big Sur) is used by default as the minimum target version (macOS on arm). + set(DEPLOYMENT_TARGET "11.0") + elseif(PLATFORM STREQUAL "MAC_UNIVERSAL") + # Unless specified, SDK version 11.0 (Big Sur) is used by default as minimum target version for universal builds. + set(DEPLOYMENT_TARGET "11.0") + elseif(PLATFORM STREQUAL "MAC_CATALYST" OR PLATFORM STREQUAL "MAC_CATALYST_ARM64" OR PLATFORM STREQUAL "MAC_CATALYST_UNIVERSAL") + # Unless specified, SDK version 13.1 is used by default as the minimum target version (mac catalyst minimum requirement). + set(DEPLOYMENT_TARGET "13.1") + else() + # Unless specified, SDK version 13.0 is used by default as the minimum target version (iOS, tvOS). + set(DEPLOYMENT_TARGET "13.0") + endif() + message(STATUS "[DEFAULTS] Using the default min-version since DEPLOYMENT_TARGET not provided!") +elseif(DEFINED DEPLOYMENT_TARGET AND PLATFORM MATCHES "^MAC_CATALYST" AND ${DEPLOYMENT_TARGET} VERSION_LESS "13.1") + message(FATAL_ERROR "Mac Catalyst builds requires a minimum deployment target of 13.1!") +endif() + +# Store the DEPLOYMENT_TARGET in the cache +set(DEPLOYMENT_TARGET "${DEPLOYMENT_TARGET}" CACHE INTERNAL "") + +# Handle the case where we are targeting iOS and a version above 10.3.4 (32-bit support dropped officially) +if(PLATFORM STREQUAL "OS" AND DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.3.4) + set(PLATFORM "OS64") + message(STATUS "Targeting minimum SDK version ${DEPLOYMENT_TARGET}. Dropping 32-bit support.") +elseif(PLATFORM STREQUAL "SIMULATOR" AND DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.3.4) + set(PLATFORM "SIMULATOR64") + message(STATUS "Targeting minimum SDK version ${DEPLOYMENT_TARGET}. Dropping 32-bit support.") +endif() + +set(PLATFORM_INT "${PLATFORM}") + +if(DEFINED ARCHS) + string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}") +endif() + +# Determine the platform name and architectures for use in xcodebuild commands +# from the specified PLATFORM_INT name. +if(PLATFORM_INT STREQUAL "OS") + set(SDK_NAME iphoneos) + if(NOT ARCHS) + set(ARCHS armv7 armv7s arm64) + set(APPLE_TARGET_TRIPLE_INT arm-apple-ios${DEPLOYMENT_TARGET}) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}) + endif() +elseif(PLATFORM_INT STREQUAL "OS64") + set(SDK_NAME iphoneos) + if(NOT ARCHS) + if (XCODE_VERSION_INT VERSION_GREATER 10.0) + set(ARCHS arm64) # FIXME: Add arm64e when Apple has fixed the integration issues with it, libarclite_iphoneos.a is currently missing bitcode markers for example + else() + set(ARCHS arm64) + endif() + set(APPLE_TARGET_TRIPLE_INT arm64-apple-ios${DEPLOYMENT_TARGET}) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}) + endif() +elseif(PLATFORM_INT STREQUAL "OS64COMBINED") + set(SDK_NAME iphoneos) + if(MODERN_CMAKE) + if(NOT ARCHS) + if (XCODE_VERSION_INT VERSION_GREATER 12.0) + set(ARCHS arm64 x86_64) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "arm64") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64 arm64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "arm64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "x86_64 arm64") + else() + set(ARCHS arm64 x86_64) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "arm64") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "arm64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "x86_64") + endif() + set(APPLE_TARGET_TRIPLE_INT arm64-x86_64-apple-ios${DEPLOYMENT_TARGET}) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}) + endif() + else() + message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the OS64COMBINED setting work") + endif() +elseif(PLATFORM_INT STREQUAL "SIMULATOR64COMBINED") + set(SDK_NAME iphonesimulator) + if(MODERN_CMAKE) + if(NOT ARCHS) + if (XCODE_VERSION_INT VERSION_GREATER 12.0) + set(ARCHS arm64 x86_64) # FIXME: Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missing bitcode markers for example + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64 arm64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "x86_64 arm64") + else() + set(ARCHS arm64 x86_64) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "x86_64") + endif() + set(APPLE_TARGET_TRIPLE_INT aarch64-x86_64-apple-ios${DEPLOYMENT_TARGET}-simulator) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-simulator) + endif() + else() + message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the SIMULATOR64COMBINED setting work") + endif() +elseif(PLATFORM_INT STREQUAL "SIMULATOR") + set(SDK_NAME iphonesimulator) + if(NOT ARCHS) + set(ARCHS i386) + set(APPLE_TARGET_TRIPLE_INT i386-apple-ios${DEPLOYMENT_TARGET}-simulator) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-simulator) + endif() + message(DEPRECATION "SIMULATOR IS DEPRECATED. Consider using SIMULATOR64 instead.") +elseif(PLATFORM_INT STREQUAL "SIMULATOR64") + set(SDK_NAME iphonesimulator) + if(NOT ARCHS) + set(ARCHS x86_64) + set(APPLE_TARGET_TRIPLE_INT x86_64-apple-ios${DEPLOYMENT_TARGET}-simulator) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-simulator) + endif() +elseif(PLATFORM_INT STREQUAL "SIMULATORARM64") + set(SDK_NAME iphonesimulator) + if(NOT ARCHS) + set(ARCHS arm64) + set(APPLE_TARGET_TRIPLE_INT arm64-apple-ios${DEPLOYMENT_TARGET}-simulator) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-simulator) + endif() +elseif(PLATFORM_INT STREQUAL "TVOS") + set(SDK_NAME appletvos) + if(NOT ARCHS) + set(ARCHS arm64) + set(APPLE_TARGET_TRIPLE_INT arm64-apple-tvos${DEPLOYMENT_TARGET}) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-tvos${DEPLOYMENT_TARGET}) + endif() +elseif (PLATFORM_INT STREQUAL "TVOSCOMBINED") + set(SDK_NAME appletvos) + if(MODERN_CMAKE) + if(NOT ARCHS) + set(ARCHS arm64 x86_64) + set(APPLE_TARGET_TRIPLE_INT arm64-x86_64-apple-tvos${DEPLOYMENT_TARGET}) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=appletvos*] "arm64") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=appletvsimulator*] "x86_64 arm64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=appletvos*] "arm64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=appletvsimulator*] "x86_64 arm64") + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-tvos${DEPLOYMENT_TARGET}) + endif() + else() + message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the TVOSCOMBINED setting work") + endif() +elseif(PLATFORM_INT STREQUAL "SIMULATOR_TVOS") + set(SDK_NAME appletvsimulator) + if(NOT ARCHS) + set(ARCHS x86_64) + set(APPLE_TARGET_TRIPLE_INT x86_64-apple-tvos${DEPLOYMENT_TARGET}-simulator) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-tvos${DEPLOYMENT_TARGET}-simulator) + endif() +elseif(PLATFORM_INT STREQUAL "SIMULATORARM64_TVOS") + set(SDK_NAME appletvsimulator) + if(NOT ARCHS) + set(ARCHS arm64) + set(APPLE_TARGET_TRIPLE_INT arm64-apple-tvos${DEPLOYMENT_TARGET}-simulator) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-tvos${DEPLOYMENT_TARGET}-simulator) + endif() +elseif(PLATFORM_INT STREQUAL "WATCHOS") + set(SDK_NAME watchos) + if(NOT ARCHS) + if (XCODE_VERSION_INT VERSION_GREATER 10.0) + set(ARCHS armv7k arm64_32) + set(APPLE_TARGET_TRIPLE_INT arm64_32-apple-watchos${DEPLOYMENT_TARGET}) + else() + set(ARCHS armv7k) + set(APPLE_TARGET_TRIPLE_INT arm-apple-watchos${DEPLOYMENT_TARGET}) + endif() + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}) + endif() +elseif(PLATFORM_INT STREQUAL "WATCHOSCOMBINED") + set(SDK_NAME watchos) + if(MODERN_CMAKE) + if(NOT ARCHS) + if (XCODE_VERSION_INT VERSION_GREATER 10.0) + set(ARCHS armv7k arm64_32 x86_64) + set(APPLE_TARGET_TRIPLE_INT arm64_32-x86_64-apple-watchos${DEPLOYMENT_TARGET}) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchos*] "armv7k arm64_32") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchsimulator*] "x86_64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchos*] "armv7k arm64_32") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchsimulator*] "x86_64") + else() + set(ARCHS armv7k i386) + set(APPLE_TARGET_TRIPLE_INT arm-i386-apple-watchos${DEPLOYMENT_TARGET}) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchos*] "armv7k") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchsimulator*] "i386") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchos*] "armv7k") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchsimulator*] "i386") + endif() + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}) + endif() + else() + message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the WATCHOSCOMBINED setting work") + endif() +elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS") + set(SDK_NAME watchsimulator) + if(NOT ARCHS) + if (XCODE_VERSION_INT VERSION_GREATER 10.0) + set(ARCHS x86_64) + set(APPLE_TARGET_TRIPLE_INT x86_64-apple-watchos${DEPLOYMENT_TARGET}-simulator) + else() + set(ARCHS i386) + set(APPLE_TARGET_TRIPLE_INT i386-apple-watchos${DEPLOYMENT_TARGET}-simulator) + endif() + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}-simulator) + endif() +elseif(PLATFORM_INT STREQUAL "SIMULATORARM64_WATCHOS") + set(SDK_NAME watchsimulator) + if(NOT ARCHS) + set(ARCHS arm64) + set(APPLE_TARGET_TRIPLE_INT arm64-apple-watchos${DEPLOYMENT_TARGET}-simulator) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}-simulator) + endif() +elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOSCOMBINED") + set(SDK_NAME watchsimulator) + if(MODERN_CMAKE) + if(NOT ARCHS) + if (XCODE_VERSION_INT VERSION_GREATER 12.0) + set(ARCHS arm64 x86_64) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchos*] "") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchsimulator*] "arm64 x86_64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchos*] "") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchsimulator*] "arm64 x86_64") + set(APPLE_TARGET_TRIPLE_INT arm64_x86_64-apple-watchos${DEPLOYMENT_TARGET}-simulator) + else() + set(ARCHS arm64 i386) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchos*] "") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchsimulator*] "i386") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchos*] "") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchsimulator*] "i386") + set(APPLE_TARGET_TRIPLE_INT arm64_i386-apple-watchos${DEPLOYMENT_TARGET}-simulator) + endif() + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}-simulator) + endif() + else() + message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the SIMULATOR_WATCHOSCOMBINED setting work") + endif() +elseif(PLATFORM_INT STREQUAL "SIMULATOR_VISIONOS") + set(SDK_NAME xrsimulator) + if(NOT ARCHS) + set(ARCHS arm64) + set(APPLE_TARGET_TRIPLE_INT arm64-apple-xros${DEPLOYMENT_TARGET}-simulator) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-xros${DEPLOYMENT_TARGET}-simulator) + endif() +elseif(PLATFORM_INT STREQUAL "VISIONOS") + set(SDK_NAME xros) + if(NOT ARCHS) + set(ARCHS arm64) + set(APPLE_TARGET_TRIPLE_INT arm64-apple-xros${DEPLOYMENT_TARGET}) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-xros${DEPLOYMENT_TARGET}) + endif() +elseif(PLATFORM_INT STREQUAL "VISIONOSCOMBINED") + set(SDK_NAME xros) + if(MODERN_CMAKE) + if(NOT ARCHS) + set(ARCHS arm64) + set(APPLE_TARGET_TRIPLE_INT arm64-apple-xros${DEPLOYMENT_TARGET}) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=xros*] "arm64") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=xrsimulator*] "arm64") + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-xros${DEPLOYMENT_TARGET}) + endif() + else() + message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the VISIONOSCOMBINED setting work") + endif() +elseif(PLATFORM_INT STREQUAL "MAC" OR PLATFORM_INT STREQUAL "MAC_CATALYST") + set(SDK_NAME macosx) + if(NOT ARCHS) + set(ARCHS x86_64) + endif() + string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}") + if(PLATFORM_INT STREQUAL "MAC") + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET}) + elseif(PLATFORM_INT STREQUAL "MAC_CATALYST") + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-macabi) + endif() +elseif(PLATFORM_INT MATCHES "^(MAC_ARM64)$|^(MAC_CATALYST_ARM64)$") + set(SDK_NAME macosx) + if(NOT ARCHS) + set(ARCHS arm64) + endif() + string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}") + if(PLATFORM_INT STREQUAL "MAC_ARM64") + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET}) + elseif(PLATFORM_INT STREQUAL "MAC_CATALYST_ARM64") + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-macabi) + endif() +elseif(PLATFORM_INT STREQUAL "MAC_UNIVERSAL") + set(SDK_NAME macosx) + if(NOT ARCHS) + set(ARCHS "x86_64;arm64") + endif() + # For universal builds, don't set target triple - let CMake handle it + # string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}") + # set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET}) +elseif(PLATFORM_INT STREQUAL "MAC_CATALYST_UNIVERSAL") + set(SDK_NAME macosx) + if(NOT ARCHS) + set(ARCHS "x86_64;arm64") + endif() + string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}") + set(APPLE_TARGET_TRIPLE_INT apple-ios${DEPLOYMENT_TARGET}-macabi) +else() + message(FATAL_ERROR "Invalid PLATFORM: ${PLATFORM_INT}") +endif() + +string(REPLACE ";" " " ARCHS_SPACED "${ARCHS}") + +if(MODERN_CMAKE AND PLATFORM_INT MATCHES ".*COMBINED" AND NOT CMAKE_GENERATOR MATCHES "Xcode") + message(FATAL_ERROR "The COMBINED options only work with Xcode generator, -G Xcode") +endif() + +if(CMAKE_GENERATOR MATCHES "Xcode" AND PLATFORM_INT MATCHES "^MAC_CATALYST") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") + set(CMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS "macosx") + set(CMAKE_XCODE_ATTRIBUTE_SUPPORTS_MACCATALYST "YES") + if(NOT DEFINED MACOSX_DEPLOYMENT_TARGET) + set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "10.15") + else() + set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "${MACOSX_DEPLOYMENT_TARGET}") + endif() +elseif(CMAKE_GENERATOR MATCHES "Xcode") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") + set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${DEPLOYMENT_TARGET}") + if(NOT PLATFORM_INT MATCHES ".*COMBINED") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=${SDK_NAME}*] "${ARCHS_SPACED}") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=${SDK_NAME}*] "${ARCHS_SPACED}") + endif() +endif() + +# If the user did not specify the SDK root to use, then query xcodebuild for it. +if(DEFINED CMAKE_OSX_SYSROOT_INT) + # Environment variables are always preserved. + set(ENV{_CMAKE_OSX_SYSROOT_INT} "${CMAKE_OSX_SYSROOT_INT}") +elseif(DEFINED ENV{_CMAKE_OSX_SYSROOT_INT}) + set(CMAKE_OSX_SYSROOT_INT "$ENV{_CMAKE_OSX_SYSROOT_INT}") +elseif(NOT DEFINED CMAKE_OSX_SYSROOT_INT) + execute_process(COMMAND ${XCODEBUILD_EXECUTABLE} -version -sdk ${SDK_NAME} Path + OUTPUT_VARIABLE CMAKE_OSX_SYSROOT_INT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +if (NOT DEFINED CMAKE_OSX_SYSROOT_INT AND NOT DEFINED CMAKE_OSX_SYSROOT) + message(SEND_ERROR "Please make sure that Xcode is installed and that the toolchain" + "is pointing to the correct path. Please run:" + "sudo xcode-select -s /Applications/Xcode.app/Contents/Developer" + "and see if that fixes the problem for you.") + message(FATAL_ERROR "Invalid CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT} " + "does not exist.") +elseif(DEFINED CMAKE_OSX_SYSROOT_INT) + set(CMAKE_OSX_SYSROOT_INT "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "") + # Specify the location or name of the platform SDK to be used in CMAKE_OSX_SYSROOT. + set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "") +endif() + +# Use bitcode or not +if(NOT DEFINED ENABLE_BITCODE) + message(STATUS "[DEFAULTS] Disabling bitcode support by default. ENABLE_BITCODE not provided for override!") + set(ENABLE_BITCODE OFF) +endif() +set(ENABLE_BITCODE_INT ${ENABLE_BITCODE} CACHE BOOL + "Whether or not to enable bitcode" FORCE) +# Use ARC or not +if(NOT DEFINED ENABLE_ARC) + # Unless specified, enable ARC support by default + set(ENABLE_ARC ON) + message(STATUS "[DEFAULTS] Enabling ARC support by default. ENABLE_ARC not provided!") +endif() +set(ENABLE_ARC_INT ${ENABLE_ARC} CACHE BOOL "Whether or not to enable ARC" FORCE) +# Use hidden visibility or not +if(NOT DEFINED ENABLE_VISIBILITY) + # Unless specified, disable symbols visibility by default + set(ENABLE_VISIBILITY OFF) + message(STATUS "[DEFAULTS] Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!") +endif() +set(ENABLE_VISIBILITY_INT ${ENABLE_VISIBILITY} CACHE BOOL "Whether or not to hide symbols from the dynamic linker (-fvisibility=hidden)" FORCE) +# Set strict compiler checks or not +if(NOT DEFINED ENABLE_STRICT_TRY_COMPILE) + # Unless specified, disable strict try_compile() + set(ENABLE_STRICT_TRY_COMPILE OFF) + message(STATUS "[DEFAULTS] Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!") +endif() +set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL + "Whether or not to use strict compiler checks" FORCE) + +# Get the SDK version information. +if(DEFINED SDK_VERSION) + # Environment variables are always preserved. + set(ENV{_SDK_VERSION} "${SDK_VERSION}") +elseif(DEFINED ENV{_SDK_VERSION}) + set(SDK_VERSION "$ENV{_SDK_VERSION}") +elseif(NOT DEFINED SDK_VERSION) + execute_process(COMMAND ${XCODEBUILD_EXECUTABLE} -sdk ${CMAKE_OSX_SYSROOT_INT} -version SDKVersion + OUTPUT_VARIABLE SDK_VERSION + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +# Find the Developer root for the specific iOS platform being compiled for +# from CMAKE_OSX_SYSROOT. Should be ../../ from SDK specified in +# CMAKE_OSX_SYSROOT. There does not appear to be a direct way to obtain +# this information from xcrun or xcodebuild. +if (NOT DEFINED CMAKE_DEVELOPER_ROOT AND NOT CMAKE_GENERATOR MATCHES "Xcode") + get_filename_component(PLATFORM_SDK_DIR ${CMAKE_OSX_SYSROOT_INT} PATH) + get_filename_component(CMAKE_DEVELOPER_ROOT ${PLATFORM_SDK_DIR} PATH) + if (NOT EXISTS "${CMAKE_DEVELOPER_ROOT}") + message(FATAL_ERROR "Invalid CMAKE_DEVELOPER_ROOT: ${CMAKE_DEVELOPER_ROOT} does not exist.") + endif() +endif() + +# Find the C & C++ compilers for the specified SDK. +if(DEFINED CMAKE_C_COMPILER) + # Environment variables are always preserved. + set(ENV{_CMAKE_C_COMPILER} "${CMAKE_C_COMPILER}") +elseif(DEFINED ENV{_CMAKE_C_COMPILER}) + set(CMAKE_C_COMPILER "$ENV{_CMAKE_C_COMPILER}") + set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) +elseif(NOT DEFINED CMAKE_C_COMPILER) + execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find clang + OUTPUT_VARIABLE CMAKE_C_COMPILER + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) +endif() +if(DEFINED CMAKE_CXX_COMPILER) + # Environment variables are always preserved. + set(ENV{_CMAKE_CXX_COMPILER} "${CMAKE_CXX_COMPILER}") +elseif(DEFINED ENV{_CMAKE_CXX_COMPILER}) + set(CMAKE_CXX_COMPILER "$ENV{_CMAKE_CXX_COMPILER}") +elseif(NOT DEFINED CMAKE_CXX_COMPILER) + execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find clang++ + OUTPUT_VARIABLE CMAKE_CXX_COMPILER + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() +# Find (Apple's) libtool. +if(DEFINED BUILD_LIBTOOL) + # Environment variables are always preserved. + set(ENV{_BUILD_LIBTOOL} "${BUILD_LIBTOOL}") +elseif(DEFINED ENV{_BUILD_LIBTOOL}) + set(BUILD_LIBTOOL "$ENV{_BUILD_LIBTOOL}") +elseif(NOT DEFINED BUILD_LIBTOOL) + execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find libtool + OUTPUT_VARIABLE BUILD_LIBTOOL + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() +# Find the toolchain's provided install_name_tool if none is found on the host +if(DEFINED CMAKE_INSTALL_NAME_TOOL) + # Environment variables are always preserved. + set(ENV{_CMAKE_INSTALL_NAME_TOOL} "${CMAKE_INSTALL_NAME_TOOL}") +elseif(DEFINED ENV{_CMAKE_INSTALL_NAME_TOOL}) + set(CMAKE_INSTALL_NAME_TOOL "$ENV{_CMAKE_INSTALL_NAME_TOOL}") +elseif(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) + execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find install_name_tool + OUTPUT_VARIABLE CMAKE_INSTALL_NAME_TOOL_INT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + set(CMAKE_INSTALL_NAME_TOOL ${CMAKE_INSTALL_NAME_TOOL_INT} CACHE INTERNAL "") +endif() + +# Configure libtool to be used instead of ar + ranlib to build static libraries. +# This is required on Xcode 7+, but should also work on previous versions of +# Xcode. +get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(lang ${languages}) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "${BUILD_LIBTOOL} -static -o " CACHE INTERNAL "") +endforeach() + +# CMake 3.14+ support building for iOS, watchOS, and tvOS out of the box. +if(MODERN_CMAKE) + if(SDK_NAME MATCHES "iphone") + set(CMAKE_SYSTEM_NAME iOS) + elseif(SDK_NAME MATCHES "xros") + set(CMAKE_SYSTEM_NAME visionOS) + elseif(SDK_NAME MATCHES "xrsimulator") + set(CMAKE_SYSTEM_NAME visionOS) + elseif(SDK_NAME MATCHES "macosx") + set(CMAKE_SYSTEM_NAME Darwin) + elseif(SDK_NAME MATCHES "appletv") + set(CMAKE_SYSTEM_NAME tvOS) + elseif(SDK_NAME MATCHES "watch") + set(CMAKE_SYSTEM_NAME watchOS) + endif() + # Provide flags for a combined FAT library build on newer CMake versions + if(PLATFORM_INT MATCHES ".*COMBINED") + set(CMAKE_IOS_INSTALL_COMBINED YES) + if(CMAKE_GENERATOR MATCHES "Xcode") + # Set the SDKROOT Xcode properties to a Xcode-friendly value (the SDK_NAME, E.g, iphoneos) + # This way, Xcode will automatically switch between the simulator and device SDK when building. + set(CMAKE_XCODE_ATTRIBUTE_SDKROOT "${SDK_NAME}") + # Force to not build just one ARCH, but all! + set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH "NO") + endif() + endif() +elseif(NOT DEFINED CMAKE_SYSTEM_NAME AND ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.10") + # Legacy code path prior to CMake 3.14 or fallback if no CMAKE_SYSTEM_NAME specified + set(CMAKE_SYSTEM_NAME iOS) +elseif(NOT DEFINED CMAKE_SYSTEM_NAME) + # Legacy code path before CMake 3.14 or fallback if no CMAKE_SYSTEM_NAME specified + set(CMAKE_SYSTEM_NAME Darwin) +endif() +# Standard settings. +set(CMAKE_SYSTEM_VERSION ${SDK_VERSION} CACHE INTERNAL "") +set(UNIX ON CACHE BOOL "") +set(APPLE ON CACHE BOOL "") +if(PLATFORM STREQUAL "MAC" OR PLATFORM STREQUAL "MAC_ARM64" OR PLATFORM STREQUAL "MAC_UNIVERSAL") + set(IOS OFF CACHE BOOL "") + set(MACOS ON CACHE BOOL "") +elseif(PLATFORM STREQUAL "MAC_CATALYST" OR PLATFORM STREQUAL "MAC_CATALYST_ARM64" OR PLATFORM STREQUAL "MAC_CATALYST_UNIVERSAL") + set(IOS ON CACHE BOOL "") + set(MACOS ON CACHE BOOL "") +elseif(PLATFORM STREQUAL "VISIONOS" OR PLATFORM STREQUAL "SIMULATOR_VISIONOS" OR PLATFORM STREQUAL "VISIONOSCOMBINED") + set(IOS OFF CACHE BOOL "") + set(VISIONOS ON CACHE BOOL "") +else() + set(IOS ON CACHE BOOL "") +endif() +# Set the architectures for which to build. +set(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE INTERNAL "") +# Change the type of target generated for try_compile() so it'll work when cross-compiling, weak compiler checks +if(NOT ENABLE_STRICT_TRY_COMPILE_INT) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +endif() +# All iOS/Darwin specific settings - some may be redundant. +if (NOT DEFINED CMAKE_MACOSX_BUNDLE) + set(CMAKE_MACOSX_BUNDLE YES) +endif() +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".tbd" ".so") +set(CMAKE_SHARED_MODULE_PREFIX "lib") +set(CMAKE_SHARED_MODULE_SUFFIX ".so") +set(CMAKE_C_COMPILER_ABI ELF) +set(CMAKE_CXX_COMPILER_ABI ELF) +set(CMAKE_C_HAS_ISYSROOT 1) +set(CMAKE_CXX_HAS_ISYSROOT 1) +set(CMAKE_MODULE_EXISTS 1) +set(CMAKE_DL_LIBS "") +set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") +set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") +set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") +set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") + +if(ARCHS MATCHES "((^|;|, )(arm64|arm64e|x86_64))+") + set(CMAKE_C_SIZEOF_DATA_PTR 8) + set(CMAKE_CXX_SIZEOF_DATA_PTR 8) + if(ARCHS MATCHES "((^|;|, )(arm64|arm64e))+") + set(CMAKE_SYSTEM_PROCESSOR "aarch64") + else() + set(CMAKE_SYSTEM_PROCESSOR "x86_64") + endif() +else() + set(CMAKE_C_SIZEOF_DATA_PTR 4) + set(CMAKE_CXX_SIZEOF_DATA_PTR 4) + set(CMAKE_SYSTEM_PROCESSOR "arm") +endif() + +# Note that only Xcode 7+ supports the newer more specific: +# -m${SDK_NAME}-version-min flags, older versions of Xcode use: +# -m(ios/ios-simulator)-version-min instead. +if(${CMAKE_VERSION} VERSION_LESS "3.11") + if(PLATFORM_INT STREQUAL "OS" OR PLATFORM_INT STREQUAL "OS64") + if(XCODE_VERSION_INT VERSION_LESS 7.0) + set(SDK_NAME_VERSION_FLAGS + "-mios-version-min=${DEPLOYMENT_TARGET}") + else() + # Xcode 7.0+ uses flags we can build directly from SDK_NAME. + set(SDK_NAME_VERSION_FLAGS + "-m${SDK_NAME}-version-min=${DEPLOYMENT_TARGET}") + endif() + elseif(PLATFORM_INT STREQUAL "TVOS") + set(SDK_NAME_VERSION_FLAGS + "-mtvos-version-min=${DEPLOYMENT_TARGET}") + elseif(PLATFORM_INT STREQUAL "SIMULATOR_TVOS") + set(SDK_NAME_VERSION_FLAGS + "-mtvos-simulator-version-min=${DEPLOYMENT_TARGET}") +elseif(PLATFORM_INT STREQUAL "SIMULATORARM64_TVOS") + set(SDK_NAME_VERSION_FLAGS + "-mtvos-simulator-version-min=${DEPLOYMENT_TARGET}") + elseif(PLATFORM_INT STREQUAL "WATCHOS") + set(SDK_NAME_VERSION_FLAGS + "-mwatchos-version-min=${DEPLOYMENT_TARGET}") + elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS") + set(SDK_NAME_VERSION_FLAGS + "-mwatchos-simulator-version-min=${DEPLOYMENT_TARGET}") + elseif(PLATFORM_INT STREQUAL "SIMULATORARM64_WATCHOS") + set(SDK_NAME_VERSION_FLAGS + "-mwatchos-simulator-version-min=${DEPLOYMENT_TARGET}") + elseif(PLATFORM_INT STREQUAL "MAC") + set(SDK_NAME_VERSION_FLAGS + "-mmacosx-version-min=${DEPLOYMENT_TARGET}") + else() + # SIMULATOR or SIMULATOR64 both use -mios-simulator-version-min. + set(SDK_NAME_VERSION_FLAGS + "-mios-simulator-version-min=${DEPLOYMENT_TARGET}") + endif() +elseif(NOT PLATFORM_INT MATCHES "^MAC_CATALYST") + # Newer versions of CMake sets the version min flags correctly, skip this for Mac Catalyst targets + set(CMAKE_OSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET} CACHE INTERNAL "Minimum OS X deployment version") +endif() + +if(DEFINED APPLE_TARGET_TRIPLE_INT) + set(APPLE_TARGET_TRIPLE ${APPLE_TARGET_TRIPLE_INT} CACHE INTERNAL "") + set(CMAKE_C_COMPILER_TARGET ${APPLE_TARGET_TRIPLE}) + set(CMAKE_CXX_COMPILER_TARGET ${APPLE_TARGET_TRIPLE}) + set(CMAKE_ASM_COMPILER_TARGET ${APPLE_TARGET_TRIPLE}) +endif() + +if(PLATFORM_INT MATCHES "^MAC_CATALYST") + set(C_TARGET_FLAGS "-isystem ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/usr/include -iframework ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/System/Library/Frameworks") +endif() + +if(ENABLE_BITCODE_INT) + set(BITCODE "-fembed-bitcode") + set(CMAKE_XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE "bitcode") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +else() + set(BITCODE "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(ENABLE_ARC_INT) + set(FOBJC_ARC "-fobjc-arc") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC "YES") +else() + set(FOBJC_ARC "-fno-objc-arc") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC "NO") +endif() + +if(NAMED_LANGUAGE_SUPPORT_INT) + set(OBJC_VARS "-fobjc-abi-version=2 -DOBJC_OLD_DISPATCH_PROTOTYPES=0") + set(OBJC_LEGACY_VARS "") +else() + set(OBJC_VARS "") + set(OBJC_LEGACY_VARS "-fobjc-abi-version=2 -DOBJC_OLD_DISPATCH_PROTOTYPES=0") +endif() + +if(NOT ENABLE_VISIBILITY_INT) + foreach(lang ${languages}) + set(CMAKE_${lang}_VISIBILITY_PRESET "hidden" CACHE INTERNAL "") + endforeach() + set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN "YES") + set(VISIBILITY "-fvisibility=hidden -fvisibility-inlines-hidden") +else() + foreach(lang ${languages}) + set(CMAKE_${lang}_VISIBILITY_PRESET "default" CACHE INTERNAL "") + endforeach() + set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN "NO") + set(VISIBILITY "-fvisibility=default") +endif() + +if(DEFINED APPLE_TARGET_TRIPLE) + set(APPLE_TARGET_TRIPLE_FLAG "-target ${APPLE_TARGET_TRIPLE}") +endif() + +#Check if Xcode generator is used since that will handle these flags automagically +if(CMAKE_GENERATOR MATCHES "Xcode") + message(STATUS "Not setting any manual command-line buildflags, since Xcode is selected as the generator. Modifying the Xcode build-settings directly instead.") +else() + set(CMAKE_C_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${BITCODE} ${VISIBILITY} ${CMAKE_C_FLAGS}" CACHE INTERNAL + "Flags used by the compiler during all C build types.") + set(CMAKE_C_FLAGS_DEBUG "-O0 -g ${CMAKE_C_FLAGS_DEBUG}") + set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_C_FLAGS_MINSIZEREL}") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_C_FLAGS_RELWITHDEBINFO}") + set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_C_FLAGS_RELEASE}") + set(CMAKE_CXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${BITCODE} ${VISIBILITY} ${CMAKE_CXX_FLAGS}" CACHE INTERNAL + "Flags used by the compiler during all CXX build types.") + set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g ${CMAKE_CXX_FLAGS_DEBUG}") + set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_CXX_FLAGS_MINSIZEREL}") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_CXX_FLAGS_RELEASE}") + if(NAMED_LANGUAGE_SUPPORT_INT) + set(CMAKE_OBJC_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJC_FLAGS}" CACHE INTERNAL + "Flags used by the compiler during all OBJC build types.") + set(CMAKE_OBJC_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJC_FLAGS_DEBUG}") + set(CMAKE_OBJC_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJC_FLAGS_MINSIZEREL}") + set(CMAKE_OBJC_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJC_FLAGS_RELWITHDEBINFO}") + set(CMAKE_OBJC_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJC_FLAGS_RELEASE}") + set(CMAKE_OBJCXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJCXX_FLAGS}" CACHE INTERNAL + "Flags used by the compiler during all OBJCXX build types.") + set(CMAKE_OBJCXX_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJCXX_FLAGS_DEBUG}") + set(CMAKE_OBJCXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJCXX_FLAGS_MINSIZEREL}") + set(CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO}") + set(CMAKE_OBJCXX_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJCXX_FLAGS_RELEASE}") + endif() + set(CMAKE_C_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}" CACHE INTERNAL + "Flags used by the compiler for all C link types.") + set(CMAKE_CXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}" CACHE INTERNAL + "Flags used by the compiler for all CXX link types.") + if(NAMED_LANGUAGE_SUPPORT_INT) + set(CMAKE_OBJC_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJC_LINK_FLAGS}" CACHE INTERNAL + "Flags used by the compiler for all OBJC link types.") + set(CMAKE_OBJCXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJCXX_LINK_FLAGS}" CACHE INTERNAL + "Flags used by the compiler for all OBJCXX link types.") + endif() + set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp" CACHE INTERNAL + "Flags used by the compiler for all ASM build types.") +endif() + +## Print status messages to inform of the current state +message(STATUS "Configuring ${SDK_NAME} build for platform: ${PLATFORM_INT}, architecture(s): ${ARCHS}") +message(STATUS "Using SDK: ${CMAKE_OSX_SYSROOT_INT}") +message(STATUS "Using C compiler: ${CMAKE_C_COMPILER}") +message(STATUS "Using CXX compiler: ${CMAKE_CXX_COMPILER}") +message(STATUS "Using libtool: ${BUILD_LIBTOOL}") +message(STATUS "Using install name tool: ${CMAKE_INSTALL_NAME_TOOL}") +if(DEFINED APPLE_TARGET_TRIPLE) + message(STATUS "Autoconf target triple: ${APPLE_TARGET_TRIPLE}") +endif() +message(STATUS "Using minimum deployment version: ${DEPLOYMENT_TARGET}" + " (SDK version: ${SDK_VERSION})") +if(MODERN_CMAKE) + message(STATUS "Merging integrated CMake 3.14+ iOS,tvOS,watchOS,macOS toolchain(s) with this toolchain!") + if(PLATFORM_INT MATCHES ".*COMBINED") + message(STATUS "Will combine built (static) artifacts into FAT lib...") + endif() +endif() +if(CMAKE_GENERATOR MATCHES "Xcode") + message(STATUS "Using Xcode version: ${XCODE_VERSION_INT}") +endif() +message(STATUS "CMake version: ${CMAKE_VERSION}") +if(DEFINED SDK_NAME_VERSION_FLAGS) + message(STATUS "Using version flags: ${SDK_NAME_VERSION_FLAGS}") +endif() +message(STATUS "Using a data_ptr size of: ${CMAKE_CXX_SIZEOF_DATA_PTR}") +if(ENABLE_BITCODE_INT) + message(STATUS "Bitcode: Enabled") +else() + message(STATUS "Bitcode: Disabled") +endif() + +if(ENABLE_ARC_INT) + message(STATUS "ARC: Enabled") +else() + message(STATUS "ARC: Disabled") +endif() + +if(ENABLE_VISIBILITY_INT) + message(STATUS "Hiding symbols: Disabled") +else() + message(STATUS "Hiding symbols: Enabled") +endif() + +# Set global properties +set_property(GLOBAL PROPERTY PLATFORM "${PLATFORM}") +set_property(GLOBAL PROPERTY APPLE_TARGET_TRIPLE "${APPLE_TARGET_TRIPLE_INT}") +set_property(GLOBAL PROPERTY SDK_VERSION "${SDK_VERSION}") +set_property(GLOBAL PROPERTY XCODE_VERSION "${XCODE_VERSION_INT}") +set_property(GLOBAL PROPERTY OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") + +# Export configurable variables for the try_compile() command. +set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES + PLATFORM + XCODE_VERSION_INT + SDK_VERSION + NAMED_LANGUAGE_SUPPORT + DEPLOYMENT_TARGET + CMAKE_DEVELOPER_ROOT + CMAKE_OSX_SYSROOT_INT + ENABLE_BITCODE + ENABLE_ARC + CMAKE_ASM_COMPILER + CMAKE_C_COMPILER + CMAKE_C_COMPILER_TARGET + CMAKE_CXX_COMPILER + CMAKE_CXX_COMPILER_TARGET + BUILD_LIBTOOL + CMAKE_INSTALL_NAME_TOOL + CMAKE_C_FLAGS + CMAKE_C_DEBUG + CMAKE_C_MINSIZEREL + CMAKE_C_RELWITHDEBINFO + CMAKE_C_RELEASE + CMAKE_CXX_FLAGS + CMAKE_CXX_FLAGS_DEBUG + CMAKE_CXX_FLAGS_MINSIZEREL + CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_RELEASE + CMAKE_C_LINK_FLAGS + CMAKE_CXX_LINK_FLAGS + CMAKE_ASM_FLAGS +) + +if(NAMED_LANGUAGE_SUPPORT_INT) + list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES + CMAKE_OBJC_FLAGS + CMAKE_OBJC_DEBUG + CMAKE_OBJC_MINSIZEREL + CMAKE_OBJC_RELWITHDEBINFO + CMAKE_OBJC_RELEASE + CMAKE_OBJCXX_FLAGS + CMAKE_OBJCXX_DEBUG + CMAKE_OBJCXX_MINSIZEREL + CMAKE_OBJCXX_RELWITHDEBINFO + CMAKE_OBJCXX_RELEASE + CMAKE_OBJC_LINK_FLAGS + CMAKE_OBJCXX_LINK_FLAGS + ) +endif() + +set(CMAKE_PLATFORM_HAS_INSTALLNAME 1) +set(CMAKE_SHARED_LINKER_FLAGS "-rpath @executable_path/Frameworks -rpath @loader_path/Frameworks") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") +set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") + +# Set the find root to the SDK developer roots. +# Note: CMAKE_FIND_ROOT_PATH is only useful when cross-compiling. Thus, do not set on macOS builds. +if(NOT PLATFORM_INT MATCHES "^MAC.*$") + list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "") + set(CMAKE_IGNORE_PATH "/System/Library/Frameworks;/usr/local/lib;/opt/homebrew" CACHE INTERNAL "") +endif() + +# Default to searching for frameworks first. +IF(NOT DEFINED CMAKE_FIND_FRAMEWORK) + set(CMAKE_FIND_FRAMEWORK FIRST) +ENDIF(NOT DEFINED CMAKE_FIND_FRAMEWORK) + +# Set up the default search directories for frameworks. +if(PLATFORM_INT MATCHES "^MAC_CATALYST") + set(CMAKE_FRAMEWORK_PATH + ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks + ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks + ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/System/Library/Frameworks + ${CMAKE_FRAMEWORK_PATH} CACHE INTERNAL "") +else() + set(CMAKE_FRAMEWORK_PATH + ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks + ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks + ${CMAKE_FRAMEWORK_PATH} CACHE INTERNAL "") +endif() + +# By default, search both the specified iOS SDK and the remainder of the host filesystem. +if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE INTERNAL "") +endif() +if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH CACHE INTERNAL "") +endif() +if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH CACHE INTERNAL "") +endif() +if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH CACHE INTERNAL "") +endif() + +# +# Some helper-macros below to simplify and beautify the CMakeFile +# + +# This little macro lets you set any Xcode specific property. +macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE XCODE_RELVERSION) + set(XCODE_RELVERSION_I "${XCODE_RELVERSION}") + if(XCODE_RELVERSION_I STREQUAL "All") + set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} "${XCODE_VALUE}") + else() + set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY}[variant=${XCODE_RELVERSION_I}] "${XCODE_VALUE}") + endif() +endmacro(set_xcode_property) + +# This macro lets you find executable programs on the host system. +macro(find_host_package) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER) + set(_TOOLCHAIN_IOS ${IOS}) + set(IOS OFF) + find_package(${ARGN}) + set(IOS ${_TOOLCHAIN_IOS}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) +endmacro(find_host_package) diff --git a/libs/JSystem/src/JGadget/linklist.cpp b/libs/JSystem/src/JGadget/linklist.cpp index 366a8db320..b9593c31c6 100644 --- a/libs/JSystem/src/JGadget/linklist.cpp +++ b/libs/JSystem/src/JGadget/linklist.cpp @@ -8,7 +8,7 @@ namespace { template class TPRIsEqual_pointer_ { public: - TPRIsEqual_pointer_(const T* p) { this->p_ = p; } + TPRIsEqual_pointer_(const T* p) { this->p_ = p; } bool operator()(const T& rSrc) const { return &rSrc == this->p_; } diff --git a/libs/revolution/src/homebuttonLib/nw4hbm/math/triangular.h b/libs/revolution/src/homebuttonLib/nw4hbm/math/triangular.h index 27be799ff6..d4c45733c6 100644 --- a/libs/revolution/src/homebuttonLib/nw4hbm/math/triangular.h +++ b/libs/revolution/src/homebuttonLib/nw4hbm/math/triangular.h @@ -19,7 +19,7 @@ namespace nw4hbm { inline f32 TanFIdx(f32 fidx) { // They were just like "Ah fuck it we already got too many tables" haha lol - return std::tanf(fidx * convert::FIdx2Rad); + return tanf(fidx * convert::FIdx2Rad); } inline f32 CosRad(f32 rad) { diff --git a/platforms/freedesktop/1024x1024/apps/dusk.png b/platforms/freedesktop/1024x1024/apps/dusk.png new file mode 100644 index 0000000000000000000000000000000000000000..862cbed0d868c0e200ed0462fcf3ee742a78ec4a GIT binary patch literal 5337 zcmeAS@N?(olHy`uVBq!ia0y~yU;#2&7&w@K)Q9>#R~Q&X7I?ZihE&XXd)<+jK|$ca zhT?YqCkutdKSWICx>3IQIwJ#v(z9wH`Jo3$Gzc&Qbt`^{`0L{;vT1O^s^r>mdKI;Vst03pj6{Qv*} literal 0 HcmV?d00001 diff --git a/platforms/freedesktop/128x128/apps/dusk.png b/platforms/freedesktop/128x128/apps/dusk.png new file mode 100644 index 0000000000000000000000000000000000000000..aaf38689d2a613c4205cfae571fbac7b14c68dc8 GIT binary patch literal 306 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1SEZ8zRdwrKRsO>Ln`LHz39lxpultBz|O<$ zp8`62Y^yw3O?K{lp1Cp7zJr~?!J2{L79+z2K8A)e28J!n3=3o#7~V24WDH#?yNfPI V-d62seFF>x22WQ%mvv4FO#lppPOty~ literal 0 HcmV?d00001 diff --git a/platforms/freedesktop/16x16/apps/dusk.png b/platforms/freedesktop/16x16/apps/dusk.png new file mode 100644 index 0000000000000000000000000000000000000000..21b653c63d722867d59d0dd9d7965f2a080ffb60 GIT binary patch literal 79 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|VxBIJAr*6yJ&NL8g_0z$8mvnE bk;TC9F)LW0gq!gZPz8ghtDnm{r-UW|Z51D-C9Ar*7pUN+=qFyJ|` zVUu+KLFrQmUkG}$O;9gB-@GPLzrmGF;Vi=v$p#bV326+McpPRidKfcgjtY(j$bct? aTkP6=!uK}DTv`B3(hQ!ielF{r5}E+eUfG@i literal 0 HcmV?d00001 diff --git a/platforms/freedesktop/32x32/apps/dusk.png b/platforms/freedesktop/32x32/apps/dusk.png new file mode 100644 index 0000000000000000000000000000000000000000..b879a01602c4147f6179c51640912843d252e47d GIT binary patch literal 99 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={Wv^-rLLn`JZdlbdH1|KoVI=F&$ hu~<(OI)g`)o1yozk577R%2J>%22WQ%mvv4FO#r*E8}mdKI;Vst02xgt@c;k- literal 0 HcmV?d00001 diff --git a/platforms/freedesktop/512x512/apps/dusk.png b/platforms/freedesktop/512x512/apps/dusk.png new file mode 100644 index 0000000000000000000000000000000000000000..6334f80e8137c23e6df85085238746b8ca48e734 GIT binary patch literal 1881 zcmeAS@N?(olHy`uVBq!ia0y~yU;;9k7&t&wwUqN(1_pKoPZ!6KiaBqu8uBt2@Eq8% zNxJ`_^r?d{1ijfN=og=7R>-)<%@C2uz!1pBAdosrjRwJJDj3ZOqh-NpaX2Dsgs+TI X5B*E`H4B*mt4sz@S3j3^P63kcv5P&j)fcD2N<5aQ&Rz zG2^9*e=J%KGTljA|GD%qD{qD)bJT?fF_Q&UWZIN5F8OF^b81mc0nil;p00i_>zopr E07lI>H2?qr literal 0 HcmV?d00001 diff --git a/platforms/freedesktop/dusk.desktop b/platforms/freedesktop/dusk.desktop new file mode 100644 index 0000000000..2e19d7ea26 --- /dev/null +++ b/platforms/freedesktop/dusk.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Dusk +GenericName=Dusk +Comment=The Legend of Zelda: Twilight Princess +Exec=dusk +Icon=dusk +Terminal=false +Type=Application +Categories=Graphics;3DGraphics;Game diff --git a/platforms/ios/Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib b/platforms/ios/Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib new file mode 100644 index 0000000000000000000000000000000000000000..15a4af7811dad90f23cea3ad667fa031a6330c9c GIT binary patch literal 1186 zcmZuw+iuf95M4?Fskw?zK;jhvKR}bTAdBEsHEEyM_B37U*kO0wV#GsSr%l?X>HP|A zDVGNj5`0p>f@fwoL2X4N&8#y!<2iHA*fI-w?oP28xIzdq(C(r=LA#IUpgl(WGeF27 zo)0pFG#ag>)tp;S(oQnBlBC_Fxw<&Nw~!ts$?^Qc*ZK5&lKhx!{Y=weN%A|{shAdX z#+hJ_4-+i#!ddYG;x9U!cU=&8!+a*=Vi-)aYQ(8zVW4u_6|)dVfhXFQ{m_Xeh%H?; z61brUe56*FF{ZUFdt!=7*sYi)8i$d59x)G04+6<18St)Un}N>)@W!bh!RLxO&S17g zc@?mw#57xm9K2B;)`3d~Vq3StSL=dN%6K16xlZ3ifGF~jDiQ1**pV}XuM;f{`t>P_ z=Ot*$vjGdLs_#n090nm-pvU}n0dwB>ksS-FcsB#XtOkKlT;OEL;j6G-f*J73&TDX` zLUeqg`mBd3N})Rq-lnd@Apimd-G&-PRop)Bc_}$_A_)kpK;7vo zS8{7$T}2brhdG@cL+~BT)?vF&T|jyCpJG_6hXFz_Vwv1HrwVfYl8R~6qC_3=SM@w+ zysaB*+fNL&)0@Uk^bO+<`b7I(?H9FgWt#>rKWQ4c`slBr-#4zJPjel!@QnE&kaytw zMpg&cRFDff1_H6+md@o)uH()BztecA7wime=hk~Ur>q})KlH&+p^w?6>~i*)+&dto zJ-B7$Fm^-+Rum4>LEm^fpGzJcl1!Rga(v`aGjkd2rlCIX?%;xP1J8}jUSYJ8G$!3fPwcpVqmpctGpLdlUa3_l?L^`2 ftEDT>eW2t3)5cIZT=Q}yeLxxiEvoLLCn0|U5M6S{yH+73vvWl3!Grl%H6X;*wgNnVy$elA7WQ)K(dgpP5&J&=)TtjI1~eXi{c= z-bGfncmZj2+jI>Ky>xR5bo0Y}DUlUmkiI}@Gn>+KKQ-9w!p>HM?S$6fs;?|selQ{DTX=RdUmsRx1Q zi>8cVH}K{;P16e9fPUbWX$ZUsyah-VOQ>QZISRZA3s*&>44c5K;X8;_`UAQSrc*Hw!7OG4Hdw910UEU6y^URAO>7Ubv6 ze6-guCXt9iE^ahbhL?Y{!j})?cPf8Wv076quY~ z`#6>11{MEtm?=n)t+*;FQ@#?C)}hQ&JLK3Z7eiy_vJ_hk;xo>RAyI6NfgIXQ^NicX z*f%D(5ckM!#4a%g?pPdI+_l)78j{PX49QiC*DSh-6N2tKg}dj?Ein#hwUvOJkSR+} z3@KB!0%=1e_&gJ07NT&`D${=!3M%7eP9sEWyZjv)b$?lNf gqKyVfr$B9iSyP4H*rrQSpWb4 literal 0 HcmV?d00001 diff --git a/platforms/ios/Info.plist.in b/platforms/ios/Info.plist.in new file mode 100644 index 0000000000..54dfc5179a --- /dev/null +++ b/platforms/ios/Info.plist.in @@ -0,0 +1,79 @@ + + + + + CFBundleDevelopmentRegion + en-US + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundleDisplayName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSupportedPlatforms + + iPhoneOS + + CFBundleIcons + + CFBundlePrimaryIcon + + CFBundleIconFiles + + AppIcon60x60 + + CFBundleIconName + AppIcon + + + CFBundleIcons~ipad + + CFBundlePrimaryIcon + + CFBundleIconFiles + + AppIcon60x60 + AppIcon76x76 + + CFBundleIconName + AppIcon + + + MinimumOSVersion + ${DEPLOYMENT_TARGET} + LSRequiresIPhoneOS + + LSApplicationCategoryType + public.app-category.adventure-games + UILaunchStoryboardName + LaunchScreen + UIRequiresFullScreen + + UIStatusBarHidden + + UIStatusBarStyle + UIStatusBarStyleDarkContent + UISupportedInterfaceOrientations + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIDeviceFamily + + 1 + 2 + + + diff --git a/platforms/macos/Info.plist.in b/platforms/macos/Info.plist.in new file mode 100644 index 0000000000..c91435dc2e --- /dev/null +++ b/platforms/macos/Info.plist.in @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en-US + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleIconFile + mainicon.icns + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundleDisplayName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + NSHighResolutionCapable + + + diff --git a/platforms/tvos/Base.lproj/LaunchScreen.storyboardc/BYZ-38-t0r-view-8bC-Xf-vdC.nib b/platforms/tvos/Base.lproj/LaunchScreen.storyboardc/BYZ-38-t0r-view-8bC-Xf-vdC.nib new file mode 100644 index 0000000000000000000000000000000000000000..ff0fd7b09adb5a276caf5e2a3d32633a467d89a7 GIT binary patch literal 2001 zcmZuy%X8aA7~j?wako6n`~CO>pwoYV*hvc-QY90`>5-AGt+Pbd8fleaPL^#&vg0_< zHciu{4J9;`rZXIv;l_b0!vzl9V1@%ToZ!|Qe7kaDJBerZ)B1bu?|baGnwm*F`6)U> zP9cOatao5tfb|}%Em$pB=aUFM0pCZDAylb^eps*0`?Z!|UGQsdzrNTEHfnRX8o_Qg zycg6S`2K!9`ZkQd52GLIb3ZnMpQ_={LG2gc|Fs_d7Dm6U;@ee#|64fL&r&lR)+M2G~7PW~vX;>av)pVWYnQf*ycWBPzWb(o_=@)!SjWL5d z9VnwE<5Q39eB9?6FuU9_sLkC8HcpCch5)d%$C*Q1`Z+m(9RkxTO&Rc&03oywsR_9H zk&e#V)Gkaypevew36ADH$iB;}LNd&Vt1&*|7`AH}oE#nomX{58TD3XrfwkL*H*Hyv ze~lC%$une_7K!bOY%gThVd8RX%j5$nsM!Q7jgT2)jpjZfc`mYWyU$k_tm=-i{4_C_ zp-yF&lj0Dwn4=j*vMN0R92;D8%Q^%FAr2%#XP%QM8}WINN3KKWi~<>wwY>l2AZO1a56b)#UJV-bIJWM@=l`-uBqcfO;eLYASKMvNS>7G?UnWrE&08aVjKfL{f=f!_dH!EXcg zCA}qSQ_@HY@M(|)7={N>7#(OECxF&dEj4qATEvAmAkH>cBy&kHp>4;B3xUDStfqDb zKyt!wdr&g}SQ@;UTJGqyJG{zZ4GY#6_$8osm3d`B`5K+OgI|HaI|vC}DcA=1>5hB} zG**>6_)M&@i_gNQg&zkhl*LfIFHKg^z#badSH3*;SE8O;gK~*WB}(ov%OVbRy)Y1y zGQdwt`c#jxvWJw1G7k-;Y$0V|IdGfULx}@PVhbg@lGGkb?JFXR1C-BzM+jpVKMR`{ zeh#QO^qf3Mgw&66{TRv&=rXb%PWHSpY9!{sv} zejRx0$=k^_IHn@Z-UP-s_${ED(#182xt^+vryx=q6-|%39!0QCJC0FC?Mgf#${mSN z(qX#W1r&lv6dNr9@3O}Yc#&eGMPKxH|J6mCzG$&SrtXzW%z>MFF!9kUxQU;c9%kf= ip6lFiiKgczLN@`zI9zoYyrUksh;Y{#jWPzASM)z>7KZr% literal 0 HcmV?d00001 diff --git a/platforms/tvos/Base.lproj/LaunchScreen.storyboardc/Info.plist b/platforms/tvos/Base.lproj/LaunchScreen.storyboardc/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..9a41f2cb91b33c655127099449c0f7903f304b2b GIT binary patch literal 258 zcmYc)$jK}&F)+By$i&RT&Ji!58tNIAnOg3gpI1_ppOceXM6S{yH+73vvWl3!Grl%H6X;*wgNnVy$elA7WQ)K(dgpP5&J&=)TtjI1~eXi{c= z-bGfncmZj2+jN~GqjZfebW041D3KLl>b literal 0 HcmV?d00001 diff --git a/platforms/tvos/Base.lproj/LaunchScreen.storyboardc/UIViewController-BYZ-38-t0r.nib b/platforms/tvos/Base.lproj/LaunchScreen.storyboardc/UIViewController-BYZ-38-t0r.nib new file mode 100644 index 0000000000000000000000000000000000000000..f2fed880d85e9b815e8f447ef676cd1f07c67511 GIT binary patch literal 896 zcmZ`%+iuf95H**ASuW-F6-Yq{Ui#Xmtz;1;Rb7|M+uEL{3tMlr-X!%~Hg0Zhoum|6 z+6N>=k>E@CEoQgSJ|G_Ecy-QrXJ*e-y@h!hZL$_zaU6$WJi>U6@et!Z#uJQRDBi^H z<7x}VW)Sb^JATV*7~HUzvTU|d48t*-}C&3)<5+y z@O;sf5$pwCnbS0_(k&PSUWJChi@;liRI!9ACX(a8tFmxSG%C;nUJKtrq|%p=9a(;z zr7Yy|iY2jV8+u&zy@ay_;&sZKa29w=+X`et|Ngp0F@IUebq4KBH3W|rnJ4920qywJlOgxlu5&437i6x z6Ko%+GTgB0KMgYl>4_EBBxTB1Lee@^SZarySmknP%v_OTn?Zcec`+o4Z7`4{n`xeL zhZy@NRV~cwh`!geQ6_pXWZt;di7ja6^U8ivOy@h4QA+5C&kW(^a z$*Cb_s#YOwhyX|IH(2~+zST4QZD7E5p;Z6h3*o4ofq~ILn|2sCyJ-m5D?jv@|EMkY4S#o0L zD%{=lqPH%2U}ZCWZj%c4FpVIAf68^L{`pfoLp;t)Ni%2MIkzGEql{4TmBdYQCMek* i^4ql00O=H{Ei&slm6>yj`f3wB+k#qCaZr~l;rs@i(jtif literal 0 HcmV?d00001 diff --git a/platforms/tvos/Info.plist.in b/platforms/tvos/Info.plist.in new file mode 100644 index 0000000000..841d120cc2 --- /dev/null +++ b/platforms/tvos/Info.plist.in @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + en-US + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundleDisplayName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSupportedPlatforms + + AppleTVOS + + CFBundleIcons + + CFBundlePrimaryIcon + App Icon + + MinimumOSVersion + ${DEPLOYMENT_TARGET} + LSRequiresIPhoneOS + + LSApplicationCategoryType + public.app-category.adventure-games + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + NSHighResolutionCapable + + UILaunchStoryboardName + LaunchScreen + UIUserInterfaceStyle + Automatic + + diff --git a/src/d/actor/d_a_b_bq.cpp b/src/d/actor/d_a_b_bq.cpp index f109c11509..70ab84705b 100644 --- a/src/d/actor/d_a_b_bq.cpp +++ b/src/d/actor/d_a_b_bq.cpp @@ -1444,11 +1444,11 @@ static void demo_camera(b_bq_class* i_this) { i_this->mDemoCamEyeTarget.set(240.0f, 274.0f, 2075.0f); i_this->field_0x1288.x = - std::fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); + fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); i_this->field_0x1288.y = - std::fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); + fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); i_this->field_0x1288.z = - std::fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); + fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); } spFC.set(0.0f, 0.0f, 1700.0f); @@ -1478,16 +1478,16 @@ static void demo_camera(b_bq_class* i_this) { i_this->mDemoCamCenterTarget.set(76.0f, 204.0f, 1782.0f); i_this->mDemoCamEyeTarget.set(-41.0f, 261.0f, 2095.0f); - i_this->field_0x127c.x = std::fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); - i_this->field_0x127c.y = std::fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); - i_this->field_0x127c.z = std::fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); + i_this->field_0x127c.x = fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); + i_this->field_0x127c.y = fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); + i_this->field_0x127c.z = fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); i_this->field_0x1288.x = - std::fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); + fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); i_this->field_0x1288.y = - std::fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); + fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); i_this->field_0x1288.z = - std::fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); + fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); i_this->field_0x129c = 0.0f; i_this->mDemoMode = 12; @@ -1584,16 +1584,16 @@ static void demo_camera(b_bq_class* i_this) { i_this->mDemoCamCenterTarget.set(0.0f, 278.0f, 1252.0f); i_this->mDemoCamEyeTarget.set(0.0f, 86.0f, 2167.0f); - i_this->field_0x127c.x = std::fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); - i_this->field_0x127c.y = std::fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); - i_this->field_0x127c.z = std::fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); + i_this->field_0x127c.x = fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); + i_this->field_0x127c.y = fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); + i_this->field_0x127c.z = fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); i_this->field_0x1288.x = - std::fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); + fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); i_this->field_0x1288.y = - std::fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); + fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); i_this->field_0x1288.z = - std::fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); + fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); i_this->field_0x129c = 0.0f; i_this->mDemoMode = 14; @@ -1741,16 +1741,16 @@ static void demo_camera(b_bq_class* i_this) { i_this->mDemoCamCenterTarget.set(-2243.0f, 1340.0f, 977.0f); i_this->mDemoCamEyeTarget.set(-1226.0f, 980.0f, 1350.0f); - i_this->field_0x127c.x = std::fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); - i_this->field_0x127c.y = std::fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); - i_this->field_0x127c.z = std::fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); + i_this->field_0x127c.x = fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); + i_this->field_0x127c.y = fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); + i_this->field_0x127c.z = fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); i_this->field_0x1288.x = - std::fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); + fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); i_this->field_0x1288.y = - std::fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); + fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); i_this->field_0x1288.z = - std::fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); + fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); i_this->field_0x129c = 0.0f; i_this->mDemoMode = 34; @@ -1814,9 +1814,9 @@ static void demo_camera(b_bq_class* i_this) { i_this->mDemoCamEye.set(95.0f, 50.0f, 2800.0f); i_this->mDemoCamEyeTarget.set(72.0f, 52.0f, 2153.0f); - i_this->field_0x127c.x = std::fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); - i_this->field_0x127c.y = std::fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); - i_this->field_0x127c.z = std::fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); + i_this->field_0x127c.x = fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); + i_this->field_0x127c.y = fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); + i_this->field_0x127c.z = fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); i_this->field_0x1288.set(0.0f, 0.0f, 0.0f); i_this->field_0x129c = 0.0f; @@ -1973,18 +1973,18 @@ static void demo_camera(b_bq_class* i_this) { i_this->mDemoCamEyeTarget.set(1214.0f, 350.0f, 2696.0f); i_this->field_0x127c.x = - std::fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); + fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); i_this->field_0x127c.y = - std::fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); + fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); i_this->field_0x127c.z = - std::fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); + fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); i_this->field_0x1288.x = - std::fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); + fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); i_this->field_0x1288.y = - std::fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); + fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); i_this->field_0x1288.z = - std::fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); + fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); i_this->field_0x129c = 0.0f; } else if (i_this->mDemoModeTimer < 140) { @@ -1993,18 +1993,18 @@ static void demo_camera(b_bq_class* i_this) { i_this->mDemoCamEyeTarget.set(23.0f, 108.0f, 2155.0f); i_this->field_0x127c.x = - std::fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); + fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); i_this->field_0x127c.y = - std::fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); + fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); i_this->field_0x127c.z = - std::fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); + fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); i_this->field_0x1288.x = - std::fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); + fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); i_this->field_0x1288.y = - std::fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); + fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); i_this->field_0x1288.z = - std::fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); + fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); } cam_3d_morf(i_this, 0.1f); @@ -2042,18 +2042,18 @@ static void demo_camera(b_bq_class* i_this) { i_this->mDemoCamEyeTarget.set(953.0f, 997.0f, -36.0f); i_this->field_0x127c.x = - std::fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); + fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); i_this->field_0x127c.y = - std::fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); + fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); i_this->field_0x127c.z = - std::fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); + fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); i_this->field_0x1288.x = - std::fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); + fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); i_this->field_0x1288.y = - std::fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); + fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); i_this->field_0x1288.z = - std::fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); + fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); cXyz pos(0.0f, 0.0f, 0.0f); for (int i = 0; i < 5; i++) { diff --git a/src/d/actor/d_a_b_ob.cpp b/src/d/actor/d_a_b_ob.cpp index e697b180ac..5622375fec 100644 --- a/src/d/actor/d_a_b_ob.cpp +++ b/src/d/actor/d_a_b_ob.cpp @@ -2462,12 +2462,12 @@ static void demo_camera(b_ob_class* i_this) { i_this->mDemoCamCenterTarget.set(80.0f, -24093.0f, 160.0f); i_this->mDemoCamEyeTarget.set(-447.0f, -22850.0f, -718.0f); - i_this->field_0x5cb4 = std::fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); - i_this->field_0x5cb8 = std::fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); - i_this->field_0x5cbc = std::fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); - i_this->field_0x5cc0 = std::fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); - i_this->field_0x5cc4 = std::fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); - i_this->field_0x5cc8 = std::fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); + i_this->field_0x5cb4 = fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); + i_this->field_0x5cb8 = fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); + i_this->field_0x5cbc = fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); + i_this->field_0x5cc0 = fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); + i_this->field_0x5cc4 = fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); + i_this->field_0x5cc8 = fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); i_this->field_0x5cd0 = 0.0f; daPy_getPlayerActorClass()->changeDemoMode(0x17, 0, 0, 0); @@ -2590,12 +2590,12 @@ static void demo_camera(b_ob_class* i_this) { i_this->mDemoCamCenterTarget.set(-6378.0f, -21886.0f, 7150.0f); i_this->mDemoCamEyeTarget.set(-6961.0f, -21727.0f, 7278.0f); - i_this->field_0x5cb4 = std::fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); - i_this->field_0x5cb8 = std::fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); - i_this->field_0x5cbc = std::fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); - i_this->field_0x5cc0 = std::fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); - i_this->field_0x5cc4 = std::fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); - i_this->field_0x5cc8 = std::fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); + i_this->field_0x5cb4 = fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); + i_this->field_0x5cb8 = fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); + i_this->field_0x5cbc = fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); + i_this->field_0x5cc0 = fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); + i_this->field_0x5cc4 = fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); + i_this->field_0x5cc8 = fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); i_this->field_0x5cd0 = 0.0f; i_this->mDemoAction = 46; @@ -2656,12 +2656,12 @@ static void demo_camera(b_ob_class* i_this) { i_this->mDemoCamCenterTarget.set(-2933.0f, -22626.0f, 6829.0f); i_this->mDemoCamEyeTarget.set(-3295.0f, -22459.0f, 7307.0f); - i_this->field_0x5cb4 = std::fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); - i_this->field_0x5cb8 = std::fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); - i_this->field_0x5cbc = std::fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); - i_this->field_0x5cc0 = std::fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); - i_this->field_0x5cc4 = std::fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); - i_this->field_0x5cc8 = std::fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); + i_this->field_0x5cb4 = fabsf(i_this->mDemoCamEyeTarget.x - i_this->mDemoCamEye.x); + i_this->field_0x5cb8 = fabsf(i_this->mDemoCamEyeTarget.y - i_this->mDemoCamEye.y); + i_this->field_0x5cbc = fabsf(i_this->mDemoCamEyeTarget.z - i_this->mDemoCamEye.z); + i_this->field_0x5cc0 = fabsf(i_this->mDemoCamCenterTarget.x - i_this->mDemoCamCenter.x); + i_this->field_0x5cc4 = fabsf(i_this->mDemoCamCenterTarget.y - i_this->mDemoCamCenter.y); + i_this->field_0x5cc8 = fabsf(i_this->mDemoCamCenterTarget.z - i_this->mDemoCamCenter.z); i_this->field_0x5cd0 = 0.0f; i_this->mDemoAction = 48; diff --git a/src/d/actor/d_a_e_ymb.cpp b/src/d/actor/d_a_e_ymb.cpp index e107b2a8b9..2604b06480 100644 --- a/src/d/actor/d_a_e_ymb.cpp +++ b/src/d/actor/d_a_e_ymb.cpp @@ -516,7 +516,7 @@ void daE_YMB_c::checkWaterPos() { field_0x6cc = wtr_pos; field_0x69c.y = wtr_pos + 1000.0f + l_HIO.fly_height_adjust; - UNUSED(std::fabsf(field_0x6cc - current.pos.y)); + UNUSED(fabsf(field_0x6cc - current.pos.y)); if (current.pos.y < (200.0f + field_0x6cc)) { if (field_0x715 == 0) { setWaterEffect1(); diff --git a/src/d/actor/d_a_tbox.cpp b/src/d/actor/d_a_tbox.cpp index b936b9b6e7..6cad41b4e3 100644 --- a/src/d/actor/d_a_tbox.cpp +++ b/src/d/actor/d_a_tbox.cpp @@ -650,7 +650,7 @@ void daTbox_c::dropProcInit() { field_0x97c = false; f32 delta_y = pos.y - pnt1.y; - f32 abs_gravity = std::fabsf(fopAcM_GetGravity(this)); + f32 abs_gravity = fabsf(fopAcM_GetGravity(this)); var_f30 = JMAFastSqrt(2.0f * delta_y / abs_gravity); speedF = pos.absXZ(pnt1) / var_f30; diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index de9c9223cf..70e8c105bb 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -2458,8 +2458,8 @@ f32 dCamera_c::radiusActorInSight(fopAc_ac_c* i_actor1, fopAc_ac_c* i_actor2, cX int bVar2 = 0; - var_f29 = std::fabsf(cM_atan2f(pos1.x, -pos1.z)); - var_f28 = std::fabsf(cM_atan2f(pos1.y, -pos1.z)); + var_f29 = fabsf(cM_atan2f(pos1.x, -pos1.z)); + var_f28 = fabsf(cM_atan2f(pos1.y, -pos1.z)); if (var_f29 > sp30) { bVar2 |= 1; } @@ -2467,8 +2467,8 @@ f32 dCamera_c::radiusActorInSight(fopAc_ac_c* i_actor1, fopAc_ac_c* i_actor2, cX bVar2 |= 2; } - var_f29 = std::fabsf(cM_atan2f(pos2.x, -pos2.z)); - var_f28 = std::fabsf(cM_atan2f(pos2.y, -pos2.z)); + var_f29 = fabsf(cM_atan2f(pos2.x, -pos2.z)); + var_f28 = fabsf(cM_atan2f(pos2.y, -pos2.z)); if (var_f29 > sp30) { bVar2 |= 4; } @@ -2493,25 +2493,25 @@ f32 dCamera_c::radiusActorInSight(fopAc_ac_c* i_actor1, fopAc_ac_c* i_actor2, cX f32 var_f31; if (bVar2 & 1) { - var_f31 = pos1.z + std::fabsf(pos1.x) / local_12c; + var_f31 = pos1.z + fabsf(pos1.x) / local_12c; if (var_f31 > ret) { ret = var_f31; } } if (bVar2 & 2) { - var_f31 = pos1.z + std::fabsf(pos1.y) / local_130; + var_f31 = pos1.z + fabsf(pos1.y) / local_130; if (var_f31 > ret) { ret = var_f31; } } if (bVar2 & 4) { - var_f31 = pos2.z + std::fabsf(pos2.x) / local_12c; + var_f31 = pos2.z + fabsf(pos2.x) / local_12c; if (var_f31 > ret) { ret = var_f31; } } if (bVar2 & 8) { - var_f31 = pos2.z + std::fabsf(pos2.y) / local_130; + var_f31 = pos2.z + fabsf(pos2.y) / local_130; if (var_f31 > ret) { ret = var_f31; } @@ -2799,7 +2799,7 @@ bool dCamera_c::bumpCheck(u32 i_flags) { } wind_pow -= 0.3f; cSAngle angle = wind_globe.U() - mViewCache.mDirection.U(); - mFovy += mCamSetup.WindShakeGap4Fvy() * cM_rndFX(wind_pow / 0.7f) * (1.0f - std::fabsf(angle.Norm())); + mFovy += mCamSetup.WindShakeGap4Fvy() * cM_rndFX(wind_pow / 0.7f) * (1.0f - fabsf(angle.Norm())); #if DEBUG dDbVw_Report(300, 180, "wind %f %f", wind_pow, angle.Norm()); @@ -2943,7 +2943,7 @@ bool dCamera_c::bumpCheck(u32 i_flags) { cXyz cross; f32 dot = VECDotProduct(normal1, normal2); VECCrossProduct(normal1, normal2, &cross); - if (chkCornerCos(dot) && std::fabsf(cross.y) > 0.5f + if (chkCornerCos(dot) && fabsf(cross.y) > 0.5f && cBgW_CheckBWall(normal2->y)) { var_r27 = 5; } else { @@ -3056,7 +3056,7 @@ bool dCamera_c::bumpCheck(u32 i_flags) { field_0x96c += (1.0f - field_0x96c) * 0.1f; } if (sp0C || !(mMonitor.field_0xc < 5.0f) - || !(std::fabsf(mPadInfo.mCStick.mLastPosX) < 0.05f)) { + || !(fabsf(mPadInfo.mCStick.mLastPosX) < 0.05f)) { field_0x968 = 0.2f; } else { field_0x968 *= mMonitor.field_0xc / 5.0f; @@ -3999,7 +3999,7 @@ bool dCamera_c::chaseCamera(s32 param_0) { } cSAngle ang; - if ((chkFlag(0x100000) || sp1C || bVar6) && std::fabsf(mPadInfo.mCStick.mLastPosX) < 0.05f) { + if ((chkFlag(0x100000) || sp1C || bVar6) && fabsf(mPadInfo.mCStick.mLastPosX) < 0.05f) { ang.Val(directionOf(mpPlayerActor).Inv()); } else { ang.Val(mViewCache.mDirection.U()); @@ -4014,13 +4014,13 @@ bool dCamera_c::chaseCamera(s32 param_0) { pos3 = pos; pos.y += dist; sp1AC = cXyz(mCenter - pos3).abs() * 8.0f; - sp1BC = std::fabsf(dist1 > sp1AC ? dist1 : sp1AC); + sp1BC = fabsf(dist1 > sp1AC ? dist1 : sp1AC); dist1 = val18 + (val17 - val18) * chase->field_0xa4; - sp1AC = std::fabsf(mFovy - dist1); + sp1AC = fabsf(mFovy - dist1); f32 sin = cSAngle(mFovy > dist1 ? mFovy : dist1).Sin(); sp1AC = 100.0f * (sin * sin) * sp1AC; - sp1BC = std::fabsf(sp1BC > sp1AC ? sp1BC : sp1AC); + sp1BC = fabsf(sp1BC > sp1AC ? sp1BC : sp1AC); sp1BC *= 1.2f; sp1BC *= 0.00625f; chase->field_0x4 = (int)(JMAFastSqrt(sp1BC) * 2.2f) + 1; @@ -4128,7 +4128,7 @@ bool dCamera_c::chaseCamera(s32 param_0) { mViewCache.mCenter += (pos - mViewCache.mCenter) * rate; f32 dist = dCamMath::xyzHorizontalDistance(pos, chase->field_0x58); - if (dist < std::fabsf(vec.x > vec.z ? vec.x : vec.z) + 20.0f) { + if (dist < fabsf(vec.x > vec.z ? vec.x : vec.z) + 20.0f) { cXyz attention_pos = attentionPos(mpPlayerActor); attention_pos.y -= 15.0f; dBgS_CamLinChk lin_chk; @@ -4294,7 +4294,7 @@ bool dCamera_c::chaseCamera(s32 param_0) { cSAngle ang = -mViewCache.mDirection.U(); delta = dCamMath::xyzRotateY(delta, ang); cXyz vec5 = delta; - if (std::fabsf(vec5.y) < 200.0f) { + if (fabsf(vec5.y) < 200.0f) { vec5.y = 0.0f; vec5.x *= 0.5f; f32 sp16C = vec5.abs(); @@ -4415,17 +4415,17 @@ bool dCamera_c::chaseCamera(s32 param_0) { bool sp11 = false; f32 sp140 = 0.05f; f32 last_pos_x = mPadInfo.mCStick.mLastPosX; - f32 sp138 = std::fabsf(last_pos_x); + f32 sp138 = fabsf(last_pos_x); f32 sp134 = mPadInfo.mCStick.mLastPosY; - f32 sp130 = std::fabsf(sp134); + f32 sp130 = fabsf(sp134); f32 sp12C = 8.0f; f32 sp128 = 12.0f; chase->field_0x93 = false; - if (sp11 || (!mCamParam.Flag(param_0, 0x40) && std::fabsf(last_pos_x) > sp140)) { + if (sp11 || (!mCamParam.Flag(param_0, 0x40) && fabsf(last_pos_x) > sp140)) { chase->field_0xac += (dCamMath::rationalBezierRatio(last_pos_x, 0.5f) * sp12C - chase->field_0xac) * chase->field_0x4c; ang3 = globe.U() + cSAngle(chase->field_0xac); - sp148 = std::fabsf(last_pos_x) - 0.05f; + sp148 = fabsf(last_pos_x) - 0.05f; if (mCamSetup.CheckFlag(0x1000) && mFakeAngleSys.field_0x0 == 0) { setUSOAngle(); } @@ -4922,7 +4922,7 @@ bool dCamera_c::lockonCamera(s32 param_0) { sp0C = true; } - f32 fVar43 = 1.0f - std::fabsf(mPadInfo.mCStick.mLastPosY); + f32 fVar43 = 1.0f - fabsf(mPadInfo.mCStick.mLastPosY); f32 fVar44; if (bVar1) { @@ -4981,12 +4981,12 @@ bool dCamera_c::lockonCamera(s32 param_0) { cSAngle u, v; cSAngle ang5 = globe.V() - lockon->field_0x34.V(); if (sp0C) { - r = lockon->field_0x34.R() * 0.75f * std::fabsf(ang5.Cos()); + r = lockon->field_0x34.R() * 0.75f * fabsf(ang5.Cos()); u.Val(lockon->field_0x34.U() + (ang4 - lockon->field_0x34.U()) * lockon->field_0x58); v.Val(lockon->field_0x34.V() + ang5 * 0.05f); } else { r = lockon->field_0x34.R() + (sp184 - lockon->field_0x34.R()) * - lockon->field_0x54 * std::fabsf(ang5.Cos()); + lockon->field_0x54 * fabsf(ang5.Cos()); u.Val(lockon->field_0x34.U() + (ang4 - lockon->field_0x34.U()) * lockon->field_0x58); v.Val(lockon->field_0x34.V() + ang5 * lockon->field_0x58); } @@ -5043,9 +5043,9 @@ bool dCamera_c::lockonCamera(s32 param_0) { } bool bVar3 = false; - if (std::fabsf(sp158) > 0.05f) { + if (fabsf(sp158) > 0.05f) { cSAngle ang = globe2.U() + cSAngle(dCamMath::rationalBezierRatio(sp158, 0.5f) * 7.5f); - sp15C = std::fabsf(sp158) - 0.05f; + sp15C = fabsf(sp158) - 0.05f; lockon->field_0x42 = ang; lockon->field_0x4c = 0.0f; bVar3 = true; @@ -5109,7 +5109,7 @@ bool dCamera_c::lockonCamera(s32 param_0) { } ang6 = ang1.Inv() - mViewCache.mDirection.U(); - if (std::fabsf(ang6.Degree()) < 2.0f && false) { + if (fabsf(ang6.Degree()) < 2.0f && false) { lockon->field_0x2a = true; } u2 += ang6 * sp15C * lockon->field_0x4c; @@ -5137,7 +5137,7 @@ bool dCamera_c::lockonCamera(s32 param_0) { } else { lockon->field_0xc = 0; if (!mBG.field_0xc0.field_0x44 && !bVar1) { - v2 += (globe2.V() - v2) * fVar43 * std::fabsf(mViewCache.mDirection.V().Cos()); + v2 += (globe2.V() - v2) * fVar43 * fabsf(mViewCache.mDirection.V().Cos()); } else { cSAngle ang7 = lockon->field_0x34.V(); ang7 *= cSAngle(lockon->field_0x34.U() - mViewCache.mDirection.U()).Cos(); @@ -5469,7 +5469,7 @@ bool dCamera_c::talktoCamera(s32 param_0) { if (talk->field_0x84 != 0) { talk->field_0x48 = 1; } else { - talk->field_0x48 = (int)(JMAFastSqrt(std::fabsf(mViewCache.mDirection.R() - talk->field_0x28.R())) / 2.0f); + talk->field_0x48 = (int)(JMAFastSqrt(fabsf(mViewCache.mDirection.R() - talk->field_0x28.R())) / 2.0f); if (talk->field_0x48 < 2) { talk->field_0x48 = 2; } @@ -5609,7 +5609,7 @@ bool dCamera_c::talktoCamera(s32 param_0) { for (i = 0; i < 36; i++) { sp26C = talk->field_0x28.U() - talk->field_0x30.U(); - if (std::fabsf(sp26C.Degree()) < 10.0f) { + if (fabsf(sp26C.Degree()) < 10.0f) { talk->field_0x28.U(talk->field_0x28.U() + sp270); } else { if (!sp5B) { @@ -7172,7 +7172,7 @@ bool dCamera_c::subjectCamera(s32 param_0) { f32 zoom_fovy = dCamMath::zoomFovy(val17 * 0.5f, tmp2) * 2.0f; mViewCache.mFovy += (zoom_fovy - mViewCache.mFovy) * val22; setComZoomScale(tmp2); - setComZoomForcus(1.0f - std::fabsf(sp88 - sp84) * -511.0f); + setComZoomForcus(1.0f - fabsf(sp88 - sp84) * -511.0f); if (check_owner_action(mPadID, 0x200000)) { setComStat(8); } @@ -7263,12 +7263,12 @@ bool dCamera_c::magneCamera(s32 param_0) { cSAngle stack_238; if (mCurMode == 1) { stack_238 = sp54.Inv(); - } else if (std::fabsf(cstick_x) > 0.05f) { + } else if (fabsf(cstick_x) > 0.05f) { stack_238 = magne->field_0x1c.U() + cSAngle(dCamMath::rationalBezierRatio(cstick_x, 0.5f) * 10.0f); } else { cSAngle stack_23c = sp54.Inv() - stack_230.U(); f32 sin = stack_23c.Sin(); - f32 tmp = std::fabsf(sin * mPadInfo.mMainStick.mLastValue); + f32 tmp = fabsf(sin * mPadInfo.mMainStick.mLastValue); f32 tmp2 = stack_23c.Cos() > 0.0f ? 8.0f : 4.0f; stack_238 = stack_230.U() + cSAngle(sin * tmp2 * dCamMath::rationalBezierRatio(tmp, 1.0f)); } @@ -7584,7 +7584,7 @@ bool dCamera_c::towerCamera(s32 param_0) { cXyz stack_21c = relationalPos(mpPlayerActor, &stack_210); f32 sp1A8 = cXyz(mEye - stack_21c).abs() - val7; f32 sp1A4 = cXyz(mCenter - stack_21c).abs() - val7; - f32 sp1A0 = std::fabsf(sp1A8 > sp1A4 ? sp1A8 : sp1A4); + f32 sp1A0 = fabsf(sp1A8 > sp1A4 ? sp1A8 : sp1A4); sp1A8 = heightOf(mpPlayerActor); sp1A0 /= (sp1A8 < 10.0f ? 10.0f : sp1A8); tower->field_0x4 = (int)(JMAFastSqrt(sp1A0) * sp220) + 1; @@ -7706,9 +7706,9 @@ bool dCamera_c::towerCamera(s32 param_0) { cSAngle sp108; cSAngle sp104 = stack_454 + (stack_454 - stack_458) * sp188; - if (!mCamParam.Flag(param_0, 0x40) && std::fabsf(sp18C) > sp184) { + if (!mCamParam.Flag(param_0, 0x40) && fabsf(sp18C) > sp184) { cSAngle sp100 = mViewCache.mDirection.U() + cSAngle(dCamMath::rationalBezierRatio(sp18C, 0.5f) * sp180); - f32 sp17C = std::fabsf(sp18C) - sp184; + f32 sp17C = fabsf(sp18C) - sp184; sp108.Val(mViewCache.mDirection.U() + (sp100 - mViewCache.mDirection.U()) * sp17C); tower->field_0x6a = true; tower->field_0x78 += (0.8f - tower->field_0x78) * 0.05f; diff --git a/src/m_Do/m_Do_main.cpp b/src/m_Do/m_Do_main.cpp index 31833cf0e8..e470c8a0d7 100644 --- a/src/m_Do/m_Do_main.cpp +++ b/src/m_Do/m_Do_main.cpp @@ -49,6 +49,8 @@ #include "dusk/imgui/ImGuiEngine.hpp" #include "dusk/logging.h" #include "dusk/main.h" +#include "dusk/imgui/ImGuiConsole.hpp" +#include "version.h" #include "dusk/time.h" #include @@ -341,6 +343,10 @@ int game_main(int argc, char* argv[]) { auroraInfo = aurora_initialize(argc, argv, &config); + VISetWindowTitle( + fmt::format("Dusk {} [{}]", DUSK_WC_DESCRIBE, dusk::backend_name(auroraInfo.backend)) + .c_str()); + const auto& dvd_path = parsed_arg_options["dvd"].as(); DuskLog.info("Loading DVD image: {}", dvd_path); if (!aurora_dvd_open(dvd_path.c_str())) { diff --git a/version.h.in b/version.h.in new file mode 100644 index 0000000000..c85a6dc659 --- /dev/null +++ b/version.h.in @@ -0,0 +1,20 @@ +#ifndef VERSION_H +#define VERSION_H + +#define DUSK_WC_DESCRIBE "@DUSK_WC_DESCRIBE@" +#define DUSK_VERSION_STRING "@DUSK_VERSION_STRING@" + +#define DUSK_WC_BRANCH "@DUSK_WC_BRANCH@" +#define DUSK_WC_REVISION "@DUSK_WC_REVISION@" +#define DUSK_WC_DATE "@DUSK_WC_DATE@" +#define DUSK_BUILD_TYPE "@CMAKE_BUILD_TYPE@" + +#if defined(__x86_64__) || defined(_M_AMD64) +#define DUSK_DLPACKAGE "dusk-@DUSK_WC_DESCRIBE@-@PLATFORM_NAME@-x86_64" +#elif defined(__i386__) || defined(_M_IX86) +#define DUSK_DLPACKAGE "dusk-@DUSK_WC_DESCRIBE@-@PLATFORM_NAME@-x86" +#elif defined(__aarch64__) || defined(_M_ARM64) +#define DUSK_DLPACKAGE "dusk-@DUSK_WC_DESCRIBE@-@PLATFORM_NAME@-arm64" +#endif + +#endif