From 7d7db261a20cccf390a90dde5bf38135887f3f23 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 13 Apr 2021 10:42:01 -0400 Subject: [PATCH 1/9] Use binary atdna, universal macOS fixes, more --- .github/workflows/build.yml | 101 ++++++------ CMakeLists.txt | 154 +++++++++++++++--- Editor/badging/CMakeLists.txt | 2 +- Editor/locale/CMakeLists.txt | 20 +-- Editor/locale/locales-inl.hpp | 134 +++++++++++++++ extern/athena | 2 +- extern/boo | 2 +- extern/libpng/CMakeLists.txt | 95 ++++++----- extern/nod | 2 +- hecl/CMakeLists.txt | 12 +- hecl/bintoc/CMakeLists.txt | 67 +------- ...tocConfig.cmake.in => bintocHelpers.cmake} | 20 +-- hecl/bintoc/hecl-bintocConfigVersion.cmake.in | 12 -- hecl/lib/CMakeLists.txt | 6 - hecl/lib/WideStringConvert.cpp | 2 +- hecl/shaderc/CMakeLists.txt | 110 ++++++++++--- metaforce-gui/CMakeLists.txt | 14 -- specter/lib/TextView.cpp | 2 +- 18 files changed, 479 insertions(+), 278 deletions(-) create mode 100644 Editor/locale/locales-inl.hpp rename hecl/bintoc/{hecl-bintocConfig.cmake.in => bintocHelpers.cmake} (58%) delete mode 100644 hecl/bintoc/hecl-bintocConfigVersion.cmake.in diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35276ad62..ce8ca85b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,10 +34,9 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get -y install build-essential curl git cmake ninja-build llvm-dev libclang-dev clang lld \ + sudo apt-get -y install curl git cmake ninja-build clang lld qt5-default 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 python3 python-is-python3 qt5-default \ - libcurl4-openssl-dev + libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3 # free up disk space # https://github.com/actions/virtual-environments/issues/2840#issuecomment-790492173 echo Before @@ -50,21 +49,23 @@ jobs: echo After df -h . - - name: Create build directory - run: cmake -E make_directory ${{github.workspace}}/build - - name: Configure CMake - working-directory: ${{github.workspace}}/build run: | - cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \ -DCMAKE_C_COMPILER=${{matrix.cc}} -DCMAKE_CXX_COMPILER=${{matrix.cxx}} - name: Build - working-directory: ${{github.workspace}}/build - run: cmake --build . + run: cmake --build build --config RelWithDebInfo --target install + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: metaforce-${{env.METAFORCE_VERSION}}-linux-${{matrix.cc}}-x86_64 + path: install build-macos: - name: Build macOS (AppleClang x86_64) + name: Build macOS (AppleClang universal) runs-on: macos-10.15 steps: - uses: actions/checkout@v2 @@ -75,29 +76,34 @@ jobs: - name: Install dependencies run: | brew update - brew install ninja qt@5 graphicsmagick imagemagick - brew link qt@5 + brew install ninja graphicsmagick imagemagick yarn global add create-dmg - - - name: Create build directory - run: cmake -E make_directory ${{github.workspace}}/build + # universal qt5 from macports + curl -LSfs https://axiodl.com/files/qt5-5.15.2.mkpkg -o /tmp/qt5-5.15.2.mkpkg + sudo installer -pkg /tmp/qt5-5.15.2.mkpkg -target / - name: Configure CMake - working-directory: ${{github.workspace}}/build run: | - export PATH="/usr/local/opt/qt@5/bin:$PATH" # FIXME remove - cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo + cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \ + -DQt5Widgets_DIR=/opt/local/libexec/qt5/lib/cmake/Qt5Widgets \ + -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ + -DPNG_DIR=/opt/local/lib - name: Build - working-directory: ${{github.workspace}}/build - run: cmake --build . + run: cmake --build build --config RelWithDebInfo --target install + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: metaforce-${{env.METAFORCE_VERSION}}-macos-appleclang-x86_64 + path: install build-windows-msvc: name: Build Windows (MSVC x86_64) if: 'false' # disabled due to memory constraints runs-on: windows-2019 env: - LLVM_VERSION: 10.0.1 Qt_VERSION: 5.15.2 IPP_VERSION: 2021.2.0.210 steps: @@ -106,14 +112,6 @@ jobs: fetch-depth: 0 submodules: recursive - - name: Install LLVM - run: | - $TempDir = "$env:RUNNER_WORKSPACE\temp" - $Filename = "LLVM-$env:LLVM_VERSION-win64.exe" - New-Item -Path "$TempDir" -ItemType Directory -ea 0 - (New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename") - Start-Process "$TempDir\$Filename" -ArgumentList "/S /D=$env:RUNNER_WORKSPACE\LLVM" -Wait - - name: Install vcpkg Qt run: | $TempDir = "$env:RUNNER_WORKSPACE\temp" @@ -132,24 +130,27 @@ jobs: run: cmake -E make_directory ${{github.workspace}}/build - name: Configure CMake - working-directory: ${{github.workspace}}/build run: | $workspace = $env:RUNNER_WORKSPACE -replace '\\', '/' - cmake $env:GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo ` + cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo ` + -DCMAKE_INSTALL_PREFIX:PATH="$env:GITHUB_WORKSPACE\install" ` -DCMAKE_TOOLCHAIN_FILE="$workspace/vcpkg-qt-$env:Qt_VERSION/scripts/buildsystems/vcpkg.cmake" ` -DVCPKG_TARGET_TRIPLET=x64-windows-static ` - -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_CXX_FLAGS= -DCMAKE_C_FLAGS= ` - -DLLVM_ROOT_DIR="$workspace/LLVM" + -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded - name: Build - working-directory: ${{github.workspace}}/build - run: cmake --build . + run: cmake --build build --config RelWithDebInfo --target install + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: metaforce-${{env.METAFORCE_VERSION}}-win32-msvc-x86_64 + path: install build-windows-clang: name: Build Windows (Clang x86_64) runs-on: windows-2019 env: - LLVM_VERSION: 10.0.1 Qt_VERSION: 5.15.2 IPP_VERSION: 2021.2.0.210 steps: @@ -158,14 +159,6 @@ jobs: fetch-depth: 0 submodules: recursive - - name: Install LLVM - run: | - $TempDir = "$env:RUNNER_WORKSPACE\temp" - $Filename = "LLVM-$env:LLVM_VERSION-win64.exe" - New-Item -Path "$TempDir" -ItemType Directory -ea 0 - (New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename") - Start-Process "$TempDir\$Filename" -ArgumentList "/S /D=$env:RUNNER_WORKSPACE\LLVM" -Wait - - name: Install vcpkg Qt run: | $TempDir = "$env:RUNNER_WORKSPACE\temp" @@ -180,22 +173,24 @@ jobs: - name: Enable Visual Studio environment uses: ilammy/msvc-dev-cmd@v1 - - name: Create build directory - run: cmake -E make_directory ${{github.workspace}}/build - - name: Configure CMake working-directory: ${{github.workspace}}/build run: | $workspace = $env:RUNNER_WORKSPACE -replace '\\', '/' - cmake $env:GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo ` + cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo ` + -DCMAKE_INSTALL_PREFIX:PATH="$env:GITHUB_WORKSPACE/install" ` -DCMAKE_TOOLCHAIN_FILE="$workspace/vcpkg-qt-$env:Qt_VERSION/scripts/buildsystems/vcpkg.cmake" ` -DVCPKG_TARGET_TRIPLET=x64-windows-static ` -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ` -DCMAKE_C_COMPILER=clang-cl ` -DCMAKE_CXX_COMPILER=clang-cl ` - -DCMAKE_LINKER=lld-link ` - -DLLVM_ROOT_DIR="$workspace/LLVM" + -DCMAKE_LINKER=lld-link - name: Build - working-directory: ${{github.workspace}}/build - run: cmake --build . + run: cmake --build build --config RelWithDebInfo --target install + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: metaforce-${{env.METAFORCE_VERSION}}-win32-clang-x86_64 + path: install diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e0e15ec2..7a83f5610 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,10 +65,16 @@ endif() message(STATUS "Metaforce version set to ${METAFORCE_WC_DESCRIBE}") project(metaforce LANGUAGES C CXX ASM VERSION ${METAFORCE_VERSION_STRING}) -if (APPLE) +string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ATHENA_ARCH) +string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ATHENA_HOST_ARCH) +set(ATHENA_EXTENSION "tar.gz") +if (CMAKE_SYSTEM_NAME STREQUAL Darwin) set(PLATFORM_NAME macos) -elseif (WIN32) + set(ATHENA_ARCH universal) + set(ATHENA_HOST_ARCH universal) +elseif (CMAKE_SYSTEM_NAME STREQUAL Windows) set(PLATFORM_NAME win32) + set(ATHENA_EXTENSION ".7z") elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") set(PLATFORM_NAME linux) endif () @@ -335,11 +341,47 @@ if(NOT GEKKO AND NOT NX) if (NOT CMAKE_INSTALL_LIBDIR) set(CMAKE_INSTALL_LIBDIR ${CMAKE_BINARY_DIR}/fake-prefix) endif() - add_subdirectory(extern/discord-rpc/src) + add_subdirectory(extern/discord-rpc/src EXCLUDE_FROM_ALL) target_include_directories(discord-rpc PRIVATE extern/rapidjson/include PUBLIC extern/discord-rpc/include) + if (APPLE) + # remove their nasty hack + get_target_property(DISCORD_LINK_LIBRARIES discord-rpc INTERFACE_LINK_LIBRARIES) + list(REMOVE_ITEM DISCORD_LINK_LIBRARIES "-framework AppKit, -mmacosx-version-min=10.10") + set_target_properties(discord-rpc PROPERTIES INTERFACE_LINK_LIBRARIES "${DISCORD_LINK_LIBRARIES}") + endif () endif() -add_subdirectory(extern/nod) +if (APPLE) + # use toolchain zlib + find_package(ZLIB REQUIRED) + set(ZLIB_LIBRARIES ZLIB::ZLIB) +endif() + +if (NOT BUILD_ATDNA) + set(ATHENA_BASE_URL "https://github.com/libAthena/athena/releases/download/latest") + include(FetchContent) + FetchContent_Declare(athena-host + URL "${ATHENA_BASE_URL}/athena-${PLATFORM_NAME}-${ATHENA_HOST_ARCH}.tar.gz") + message(STATUS "Fetching atdna host binary") + FetchContent_Populate(athena-host) + include(${athena-host_SOURCE_DIR}/lib/cmake/atdna/atdnaConfig.cmake) +endif () + +if (BUILD_ATHENA OR BUILD_ATDNA) + add_subdirectory(extern/athena EXCLUDE_FROM_ALL) +else() + if (ATHENA_ARCH STREQUAL ATHENA_HOST_ARCH) + set(athena_SOURCE_DIR "${athena-host_SOURCE_DIR}") + else() + FetchContent_Declare(athena + URL "${ATHENA_BASE_URL}/athena-${PLATFORM_NAME}-${ATHENA_ARCH}.tar.gz") + FetchContent_Populate(athena) + endif() + include(${athena_SOURCE_DIR}/lib/cmake/athena/AthenaConfig.cmake) + include(${athena_SOURCE_DIR}/lib/cmake/lzokay/lzokayConfig.cmake) + add_library(lzokay ALIAS lzokay::lzokay) + include(extern/athena/atdna/atdnaHelpers.cmake) +endif() set(DATA_SPEC_LIBS RetroDataSpec AssetNameMap) set(HECL_DATASPEC_DECLS @@ -369,27 +411,52 @@ set(HECL_DATASPEC_PUSHES hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3PC); hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3ORIG);") -add_subdirectory(extern/athena) -add_subdirectory(extern/boo) -add_subdirectory(hecl/shaderc) +add_subdirectory(extern/nod EXCLUDE_FROM_ALL) +add_subdirectory(extern/boo EXCLUDE_FROM_ALL) + +include(ExternalProject) +ExternalProject_Add(shaderc + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/hecl/shaderc" + CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH= + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config Release --target install) + +function(shaderc out) + if(IS_ABSOLUTE ${out}) + set(theOut ${out}) + else() + set(theOut ${CMAKE_CURRENT_BINARY_DIR}/${out}) + endif() + unset(theInsList) + foreach(in ${ARGN}) + if(IS_ABSOLUTE ${in}) + list(APPEND theInsList ${in}) + else() + list(APPEND theInsList ${CMAKE_CURRENT_SOURCE_DIR}/${in}) + endif() + endforeach() + get_filename_component(outDir ${theOut} DIRECTORY) + file(MAKE_DIRECTORY ${outDir}) + file(RELATIVE_PATH outRel ${CMAKE_BINARY_DIR} ${theOut}) + ExternalProject_Get_Property(shaderc INSTALL_DIR) + add_custom_command(OUTPUT ${theOut}.cpp ${theOut}.hpp + COMMAND "${INSTALL_DIR}/bin/shaderc" ARGS -o ${theOut} ${theInsList} + DEPENDS ${theInsList} shaderc + COMMENT "Compiling shader ${outRel}.shader") +endfunction() + include(hecl/ApplicationTools.cmake) add_subdirectory(specter/shaders) add_subdirectory(Shaders) -add_subdirectory(extern/libSquish) -add_subdirectory(extern/libpng) -add_subdirectory(extern/libjpeg-turbo) -add_subdirectory(hecl) -add_subdirectory(extern/zeus) +add_subdirectory(extern/libSquish EXCLUDE_FROM_ALL) +add_subdirectory(extern/libpng EXCLUDE_FROM_ALL) +add_subdirectory(extern/libjpeg-turbo EXCLUDE_FROM_ALL) +add_subdirectory(hecl EXCLUDE_FROM_ALL) +add_subdirectory(extern/zeus EXCLUDE_FROM_ALL) target_include_directories(hecl-full PRIVATE ${CMAKE_SOURCE_DIR}) target_include_directories(hecl-light PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(hecl-full PRIVATE zeus nod) target_link_libraries(hecl-light PRIVATE zeus nod) -if(NOT TARGET bintoc) - # Use native if cross compiling - find_package(hecl-bintoc REQUIRED) -endif() - bintoc(CModelShaders.common.glsl.cpp Shaders/CModelShaders.common.glsl CMODELSHADERS_COMMON_GLSL) bintoc(CModelShaders.vert.glsl.cpp Shaders/CModelShaders.vert.glsl CMODELSHADERS_VERT_GLSL) bintoc(CModelShaders.frag.glsl.cpp Shaders/CModelShaders.frag.glsl CMODELSHADERS_FRAG_GLSL) @@ -414,21 +481,23 @@ if(NOT TARGET atdna) endif() endif() -add_subdirectory(extern/amuse) -add_subdirectory(extern/freetype2) +add_subdirectory(extern/amuse EXCLUDE_FROM_ALL) +add_subdirectory(extern/freetype2 EXCLUDE_FROM_ALL) if (NOT MSVC) target_compile_options(freetype PRIVATE -Wno-implicit-fallthrough) -endif() -add_subdirectory(specter) +endif () +add_subdirectory(specter EXCLUDE_FROM_ALL) target_include_directories(specter PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(specter PRIVATE nod) -add_subdirectory(assetnameparser) +if (NOT CMAKE_CROSSCOMPILING) + add_subdirectory(assetnameparser) +endif () add_compile_definitions(URDE_ZIP_INPUT_STREAM=1) # Enable CZipInputStream now that zlib header is known add_subdirectory(DataSpec) -add_subdirectory(extern/kabufuda) +add_subdirectory(extern/kabufuda EXCLUDE_FROM_ALL) add_subdirectory(Editor) -add_subdirectory(extern/jbus) +add_subdirectory(extern/jbus EXCLUDE_FROM_ALL) set(JBUS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/jbus/include) set(CLIENT_SOURCES @@ -436,10 +505,10 @@ set(CLIENT_SOURCES ${CMAKE_SOURCE_DIR}/Editor/ProjectResourceFactoryBase.cpp ${CMAKE_SOURCE_DIR}/Editor/ProjectResourceFactoryMP1.hpp ${CMAKE_SOURCE_DIR}/Editor/ProjectResourceFactoryMP1.cpp) -add_subdirectory(NESEmulator) +add_subdirectory(NESEmulator EXCLUDE_FROM_ALL) add_subdirectory(Runtime) -add_subdirectory(mpcksum) -add_subdirectory(gbalink) +add_subdirectory(mpcksum EXCLUDE_FROM_ALL) +add_subdirectory(gbalink EXCLUDE_FROM_ALL) add_subdirectory(visigen) add_dependencies(hecl visigen) @@ -467,3 +536,34 @@ if (NOT WINDOWS_STORE AND NOT NX) endif() configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h) + +# Packaging logic +list(APPEND BINARY_TARGETS metaforce hecl visigen) +set(DSYM_ONLY_TARGETS "") +if (TARGET crashpad_handler) + list(APPEND BINARY_TARGETS crashpad_handler) +endif () +set(BIN_PREFIX "${CMAKE_INSTALL_PREFIX}") +if (TARGET metaforce-gui) + if (APPLE) + # app bundle already has all needed binaries + install(TARGETS metaforce-gui DESTINATION ${BIN_PREFIX}) + list(APPEND DSYM_ONLY_TARGETS metaforce-gui) + # we have to rename here, cmake is inflexible about bundle naming + install(CODE "execute_process(COMMAND rm -fr ${BIN_PREFIX}/Metaforce.app)") + install(CODE "execute_process(COMMAND mv ${BIN_PREFIX}/metaforce-gui.app ${BIN_PREFIX}/Metaforce.app)") + set(BIN_PREFIX "${BIN_PREFIX}/Metaforce.app/Contents/MacOS") + else() + list(APPEND BINARY_TARGETS metaforce-gui) + endif () +endif () +install(TARGETS ${BINARY_TARGETS} DESTINATION ${BIN_PREFIX}) +if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) + foreach (target IN LISTS BINARY_TARGETS DSYM_ONLY_TARGETS) + if (WIN32) + install(FILES $ DESTINATION ${BIN_PREFIX} OPTIONAL) + elseif (APPLE) + install(CODE "execute_process(COMMAND dsymutil ${BIN_PREFIX}/${target})") + endif () + endforeach () +endif () diff --git a/Editor/badging/CMakeLists.txt b/Editor/badging/CMakeLists.txt index 6657f5760..e86c340c4 100644 --- a/Editor/badging/CMakeLists.txt +++ b/Editor/badging/CMakeLists.txt @@ -5,7 +5,7 @@ find_library(M_LIB m) if(NOT M_LIB) unset(M_LIB CACHE) endif() -target_link_libraries(packbadge ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${M_LIB}) +target_link_libraries(packbadge PRIVATE ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${M_LIB}) target_include_directories(packbadge PRIVATE ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) ################## diff --git a/Editor/locale/CMakeLists.txt b/Editor/locale/CMakeLists.txt index 313d05c15..15b48d8ff 100644 --- a/Editor/locale/CMakeLists.txt +++ b/Editor/locale/CMakeLists.txt @@ -1,14 +1,14 @@ -add_executable(genlocales genlocales.cpp) -target_link_libraries(genlocales fmt athena-core) +#add_executable(genlocales genlocales.cpp) +#target_link_libraries(genlocales fmt athena-core) +# +#set(LOCALES_IN en_US.yaml en_GB.yaml ja_JP.yaml) +#set(LOCALES_OUT ${CMAKE_CURRENT_BINARY_DIR}/locales-inl.hpp) +#add_custom_command(OUTPUT ${LOCALES_OUT} COMMAND $ +# ARGS ${LOCALES_OUT} ${LOCALES_IN} +# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +# DEPENDS genlocales ${LOCALES_IN}) -set(LOCALES_IN en_US.yaml en_GB.yaml ja_JP.yaml) -set(LOCALES_OUT ${CMAKE_CURRENT_BINARY_DIR}/locales-inl.hpp) -add_custom_command(OUTPUT ${LOCALES_OUT} COMMAND $ - ARGS ${LOCALES_OUT} ${LOCALES_IN} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS genlocales ${LOCALES_IN}) - -add_library(UrdeLocales ${LOCALES_OUT} locale.hpp locale.cpp) +add_library(UrdeLocales locales-inl.hpp locale.hpp locale.cpp) target_link_libraries(UrdeLocales fmt) target_include_directories(UrdeLocales PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/Editor/locale/locales-inl.hpp b/Editor/locale/locales-inl.hpp new file mode 100644 index 000000000..d67ea09bf --- /dev/null +++ b/Editor/locale/locales-inl.hpp @@ -0,0 +1,134 @@ +/* Locales */ +enum class ELocale { + Invalid = -1, + en_US, + en_GB, + ja_JP, + MAXLocale +}; +struct en_US { static constexpr auto Name = "en_US"sv; static constexpr auto FullName = "US English"sv; }; +struct en_GB { static constexpr auto Name = "en_GB"sv; static constexpr auto FullName = "British English"sv; }; +struct ja_JP { static constexpr auto Name = "ja_JP"sv; static constexpr auto FullName = "日本語"sv; }; + +using DefaultLocale = en_US; +template struct Lookup { + static_assert(!std::is_same_v, "The default locale must translate all keys"); + static constexpr auto Value() { return Lookup::Value(); } +}; + +/* Keys */ +struct color {}; +struct branch {}; +struct commit {}; +struct release {}; +struct date {}; +struct new_project {}; +struct open_project {}; +struct extract_game {}; +struct name {}; +struct type {}; +struct size {}; +struct directory {}; +struct file {}; +struct file_name {}; +struct cancel {}; +struct system_locations {}; +struct recent_projects {}; +struct recent_files {}; +struct scroll_left {}; +struct scroll_right {}; +struct ok {}; +struct boundary_action {}; +struct split {}; +struct join {}; +struct hecl_project {}; +struct no_access_as_dir {}; +struct file_field_empty {}; +struct overwrite_confirm {}; +struct directory_field_empty {}; +struct no_overwrite_file {}; +struct no_overwrite_project {}; +struct no_access_as_file {}; +struct space_types {}; +struct resource_browser {}; +struct effect_editor {}; +struct model_viewer {}; +struct information_center {}; +struct game_mode {}; +struct version {}; + +/* en_US */ +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Color"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Branch"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Commit"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Release"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Date"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("New Project"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Open Project"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Extract Game"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Name"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Type"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Size"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Directory"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("File"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("File Name"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Cancel"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("System Locations"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Recent Projects"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Recent Files"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Scroll Left"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Scroll Right"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("OK"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Boundary Action"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Split"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Join"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("HECL Project"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Unable to access '{}' as directory"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Unable to save empty file"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Overwrite '{}'?"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Unable to make empty-named directory"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Unable to make directory over file"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Unable to make project within existing project"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Unable to access '{}' as file"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Space Types"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Resource Browser"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Effect Editor"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Model Viewer"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Information Center"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Game Mode"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Version"); } }; + +/* en_GB */ +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("Colour"); } }; + +/* ja_JP */ +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("色"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("分派"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("預ける"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("年月日"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("新しいプロジェクト"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("プロジェクトを開きます"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("ビデオゲームを抽出"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("名"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("タイプ"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("サイズ"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("ディレクトリ"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("ファイル"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("ファイル名"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("キャンセル"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("システムの場所"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("最近使ったプロジェクト"); } }; +template<> struct Lookup { static constexpr auto Value() { return FMT_STRING("最近使用したファイル"); } }; + +template +constexpr auto Do(ELocale l, Action act, Args&&... args) { + switch (l) { + default: + case ELocale::en_US: + return act.template Do(std::forward(args)...); + case ELocale::en_GB: + return act.template Do(std::forward(args)...); + case ELocale::ja_JP: + return act.template Do(std::forward(args)...); + } +} diff --git a/extern/athena b/extern/athena index a87e8bb39..8558ca1b5 160000 --- a/extern/athena +++ b/extern/athena @@ -1 +1 @@ -Subproject commit a87e8bb39f8548f1418a5f68353c9fca890ba5df +Subproject commit 8558ca1b5111ebe83ee44b1200b0b0d1d94f2fa2 diff --git a/extern/boo b/extern/boo index 6335cb09f..09b788d20 160000 --- a/extern/boo +++ b/extern/boo @@ -1 +1 @@ -Subproject commit 6335cb09fe5046984e8baa9b5a65de837037e70c +Subproject commit 09b788d20b91aba8b3c9084bcf5e8a61f03935e8 diff --git a/extern/libpng/CMakeLists.txt b/extern/libpng/CMakeLists.txt index d3ba5e867..128f3dffd 100644 --- a/extern/libpng/CMakeLists.txt +++ b/extern/libpng/CMakeLists.txt @@ -1,53 +1,58 @@ -if(NOT WIN32 AND NOT APPLE AND NOT NX) # remove WIN32 when specter/freetype is gone -find_library(PNG_LIB NAMES png libpng) -endif() -if(NOT PNG_LIB) -message(STATUS "Using HECL's built-in libpng") -if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm(64)?") -set(INTRINSICS +if (APPLE) + # only consider static libs + find_library(PNG_LIB NAMES libpng.a PATHS ${PNG_DIR} NO_DEFAULT_PATHS NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_SYSTEM_PATH) +elseif (NOT WIN32 AND NOT NX) # remove WIN32 when specter/freetype is gone + find_library(PNG_LIB NAMES png libpng PATHS ${PNG_DIR}) +endif () +if (NOT PNG_LIB) + message(STATUS "Using HECL's built-in libpng") + if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm(64)?" OR (APPLE AND "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES)) + list(APPEND INTRINSICS arm/arm_init.c arm/filter_neon.S arm/filter_neon_intrinsics.c arm/palette_neon_intrinsics.c) -elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL x86_64) -set(INTRINSICS + endif () + if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR (APPLE AND "x86_64" IN_LIST CMAKE_OSX_ARCHITECTURES)) + list(APPEND INTRINSICS intel/filter_sse2_intrinsics.c intel/intel_init.c) -endif() -add_library(png - png.h - pngconf.h - pngdebug.h - pnginfo.h - pngpriv.h - pngstruct.h - pnglibconf.h + endif () + add_library(png + png.h + pngconf.h + pngdebug.h + pnginfo.h + pngpriv.h + pngstruct.h + pnglibconf.h - png.c - pngerror.c - pngget.c - pngmem.c - pngpread.c - pngread.c - pngrio.c - pngrtran.c - pngrutil.c - pngset.c - pngtrans.c - pngwio.c - pngwrite.c - pngwtran.c - pngwutil.c - ${INTRINSICS}) -if(APPLE) + png.c + pngerror.c + pngget.c + pngmem.c + pngpread.c + pngread.c + pngrio.c + pngrtran.c + pngrutil.c + pngset.c + pngtrans.c + pngwio.c + pngwrite.c + pngwtran.c + pngwutil.c + ${INTRINSICS}) + if (APPLE) target_compile_options(png PRIVATE -Wno-implicit-fallthrough) -endif() -target_link_libraries(png PUBLIC ${ZLIB_LIBRARIES}) -target_include_directories(png PUBLIC ${ZLIB_INCLUDE_DIR}) -set(PNG_LIBRARIES png CACHE PATH "PNG libraries" FORCE) -set(PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "PNG include path" FORCE) -else() -set(PNG_LIBRARIES ${PNG_LIB} CACHE PATH "PNG libraries" FORCE) -find_path(PNG_INCLUDE_DIR png.h) -set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE PATH "PNG include path" FORCE) -endif() + endif () + target_link_libraries(png PUBLIC ${ZLIB_LIBRARIES}) + target_include_directories(png PUBLIC ${ZLIB_INCLUDE_DIR}) + set(PNG_LIBRARIES png CACHE PATH "PNG libraries" FORCE) + set(PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "PNG include path" FORCE) +else () + set(PNG_LIBRARIES ${PNG_LIB} ${ZLIB_LIBRARIES} CACHE PATH "PNG libraries" FORCE) + find_path(PNG_INCLUDE_DIR png.h PATHS "${PNG_LIB}/../../include" NO_DEFAULT_PATHS NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_SYSTEM_PATH) + set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE PATH "PNG include path" FORCE) + message(STATUS "Using libpng at ${PNG_LIB}, include: ${PNG_INCLUDE_DIR}") +endif () diff --git a/extern/nod b/extern/nod index 311d20532..d14b798b5 160000 --- a/extern/nod +++ b/extern/nod @@ -1 +1 @@ -Subproject commit 311d20532e5c94d605f6725f1ba2b9a4b196aef1 +Subproject commit d14b798b5f79c566ba6e6ca0434ce155f2b81d1b diff --git a/hecl/CMakeLists.txt b/hecl/CMakeLists.txt index 38e38c768..d9688f7e9 100644 --- a/hecl/CMakeLists.txt +++ b/hecl/CMakeLists.txt @@ -52,12 +52,12 @@ endforeach() configure_file(include/hecl/ApplicationReps.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/ApplicationReps.hpp @ONLY) -add_subdirectory(bintoc) - -if(NOT TARGET bintoc) - # Use native if cross compiling - find_package(hecl-bintoc REQUIRED) -endif() +include(ExternalProject) +ExternalProject_Add(bintoc + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bintoc" + CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH= + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config Release --target install) +include(bintoc/bintocHelpers.cmake) if(NOT TARGET atdna) # Import native atdna if cross-compiling diff --git a/hecl/bintoc/CMakeLists.txt b/hecl/bintoc/CMakeLists.txt index 419884d11..7fc94c258 100644 --- a/hecl/bintoc/CMakeLists.txt +++ b/hecl/bintoc/CMakeLists.txt @@ -1,62 +1,9 @@ -if(NOT CMAKE_CROSSCOMPILING) +cmake_minimum_required(VERSION 3.15 FATAL_ERROR) +cmake_policy(VERSION 3.15...3.20) +project(bintoc LANGUAGES C) + add_executable(bintoc bintoc.c) -target_include_directories(bintoc PRIVATE ${ZLIB_INCLUDE_DIR}) -target_link_libraries(bintoc ${ZLIB_LIBRARIES}) -function(bintoc out in sym) - if(IS_ABSOLUTE ${out}) - set(theOut ${out}) - else() - set(theOut ${CMAKE_CURRENT_BINARY_DIR}/${out}) - endif() - if(IS_ABSOLUTE ${in}) - set(theIn ${in}) - else() - set(theIn ${CMAKE_CURRENT_SOURCE_DIR}/${in}) - endif() - get_filename_component(outDir ${theOut} DIRECTORY) - file(MAKE_DIRECTORY ${outDir}) - add_custom_command(OUTPUT ${theOut} - COMMAND $ ARGS ${theIn} ${theOut} ${sym} - DEPENDS ${theIn} bintoc) -endfunction() -function(bintoc_compress out in sym) - if(IS_ABSOLUTE ${out}) - set(theOut ${out}) - else() - set(theOut ${CMAKE_CURRENT_BINARY_DIR}/${out}) - endif() - if(IS_ABSOLUTE ${in}) - set(theIn ${in}) - else() - set(theIn ${CMAKE_CURRENT_SOURCE_DIR}/${in}) - endif() - get_filename_component(outDir ${theOut} DIRECTORY) - file(MAKE_DIRECTORY ${outDir}) - add_custom_command(OUTPUT ${theOut} - COMMAND $ ARGS --compress ${theIn} ${theOut} ${sym} - DEPENDS ${theIn} bintoc) -endfunction() +find_package(ZLIB REQUIRED) +target_link_libraries(bintoc PRIVATE ZLIB::ZLIB) -################## -# Package Export # -################## - -# Add all targets to the build-tree export set -export(TARGETS bintoc FILE "${CMAKE_CURRENT_BINARY_DIR}/hecl-bintocTargets.cmake") - -# Export the package for use from the build-tree -# (this registers the build-tree with a global CMake-registry) -export(PACKAGE hecl-bintoc) - -# Create the atdnaConfig.cmake -# ... for the build tree -configure_file(hecl-bintocConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/hecl-bintocConfig.cmake" @ONLY) -# ... for the install tree -configure_file(hecl-bintocConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hecl-bintocConfig.cmake" @ONLY) -# ... for both -configure_file(hecl-bintocConfigVersion.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/hecl-bintocConfigVersion.cmake" @ONLY) - -else() -# Use native if cross compiling -find_package(hecl-bintoc REQUIRED) -endif() +install(TARGETS bintoc DESTINATION bin) \ No newline at end of file diff --git a/hecl/bintoc/hecl-bintocConfig.cmake.in b/hecl/bintoc/bintocHelpers.cmake similarity index 58% rename from hecl/bintoc/hecl-bintocConfig.cmake.in rename to hecl/bintoc/bintocHelpers.cmake index 73b02b078..cb32651d7 100644 --- a/hecl/bintoc/hecl-bintocConfig.cmake.in +++ b/hecl/bintoc/bintocHelpers.cmake @@ -1,13 +1,3 @@ -# - Config file for the bintoc package - -# Compute paths -get_filename_component(BINTOC_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - -# Our library dependencies (contains definitions for IMPORTED targets) -if(NOT TARGET bintoc AND NOT bintoc_BINARY_DIR) - include("${BINTOC_CMAKE_DIR}/hecl-bintocTargets.cmake") -endif() - function(bintoc out in sym) if(IS_ABSOLUTE ${out}) set(theOut ${out}) @@ -21,9 +11,10 @@ function(bintoc out in sym) endif() get_filename_component(outDir ${theOut} DIRECTORY) file(MAKE_DIRECTORY ${outDir}) + ExternalProject_Get_Property(bintoc INSTALL_DIR) add_custom_command(OUTPUT ${theOut} - COMMAND $ ARGS ${theIn} ${theOut} ${sym} - DEPENDS ${theIn}) + COMMAND "${INSTALL_DIR}/bin/bintoc" ARGS ${theIn} ${theOut} ${sym} + DEPENDS ${theIn} bintoc) endfunction() function(bintoc_compress out in sym) @@ -39,7 +30,8 @@ function(bintoc_compress out in sym) endif() get_filename_component(outDir ${theOut} DIRECTORY) file(MAKE_DIRECTORY ${outDir}) + ExternalProject_Get_Property(bintoc INSTALL_DIR) add_custom_command(OUTPUT ${theOut} - COMMAND $ ARGS --compress ${theIn} ${theOut} ${sym} - DEPENDS ${theIn}) + COMMAND "${INSTALL_DIR}/bin/bintoc" ARGS --compress ${theIn} ${theOut} ${sym} + DEPENDS ${theIn} bintoc) endfunction() diff --git a/hecl/bintoc/hecl-bintocConfigVersion.cmake.in b/hecl/bintoc/hecl-bintocConfigVersion.cmake.in deleted file mode 100644 index da3ea156d..000000000 --- a/hecl/bintoc/hecl-bintocConfigVersion.cmake.in +++ /dev/null @@ -1,12 +0,0 @@ -set(PACKAGE_VERSION "@BINTOC_VERSION@") - -# Check whether the requested PACKAGE_FIND_VERSION is compatible -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") - set(PACKAGE_VERSION_COMPATIBLE FALSE) -else() - set(PACKAGE_VERSION_COMPATIBLE TRUE) - if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") - set(PACKAGE_VERSION_EXACT TRUE) - endif() -endif() - diff --git a/hecl/lib/CMakeLists.txt b/hecl/lib/CMakeLists.txt index 566702531..0adc33d83 100644 --- a/hecl/lib/CMakeLists.txt +++ b/hecl/lib/CMakeLists.txt @@ -87,12 +87,6 @@ target_link_libraries(hecl-light PUBLIC ${HECL_APPLICATION_REPS_TARGETS_LIST} bo target_atdna(hecl-light atdna_HMDLMeta_light.cpp ../include/hecl/HMDLMeta.hpp) target_atdna(hecl-light atdna_CVar_light.cpp ../include/hecl/CVar.hpp) -add_library(hecl-compilers Compilers.cpp WideStringConvert.cpp) -get_target_property(BOO_INCLUDES boo INTERFACE_INCLUDE_DIRECTORIES) -target_include_directories(hecl-compilers PUBLIC ../include ${BOO_INCLUDES}) -target_link_libraries(hecl-compilers PUBLIC athena-core logvisor xxhash - glslang OSDependent OGLCompiler SPIRV glslang-default-resource-limits) - if(COMMAND add_sanitizers) add_sanitizers(hecl-full) add_sanitizers(hecl-light) diff --git a/hecl/lib/WideStringConvert.cpp b/hecl/lib/WideStringConvert.cpp index ee932b583..036e3d385 100644 --- a/hecl/lib/WideStringConvert.cpp +++ b/hecl/lib/WideStringConvert.cpp @@ -1,5 +1,5 @@ #include -#include +#include namespace hecl { static logvisor::Module Log("hecl-wsconv"); diff --git a/hecl/shaderc/CMakeLists.txt b/hecl/shaderc/CMakeLists.txt index 1d3662f5e..02b6990e4 100644 --- a/hecl/shaderc/CMakeLists.txt +++ b/hecl/shaderc/CMakeLists.txt @@ -1,7 +1,91 @@ +cmake_minimum_required(VERSION 3.15 FATAL_ERROR) +cmake_policy(VERSION 3.15...3.20) +project(shaderc LANGUAGES C CXX) + +if (MSVC) + # Shaddup MSVC + add_compile_definitions(UNICODE=1 _UNICODE=1 __SSE__=1 + _CRT_SECURE_NO_WARNINGS=1 D_SCL_SECURE_NO_WARNINGS=1 + _SCL_SECURE_NO_DEPRECATE=1 _CRT_NONSTDC_NO_WARNINGS=1 + _ENABLE_EXTENDED_ALIGNED_STORAGE=1 NOMINMAX=1) + add_compile_options(/IGNORE:4221 + $<$,$>:/wd4018> + $<$,$>:/wd4800> + $<$,$>:/wd4005> + $<$,$>:/wd4311> + $<$,$>:/wd4068> + $<$,$>:/wd4267> + $<$,$>:/wd4244> + $<$,$>:/wd4200> + $<$,$>:/wd4305> + $<$,$>:/wd4067> + $<$,$>:/wd4146> + $<$,$>:/wd4309> + $<$,$>:/wd4805> + ${VS_OPTIONS}) + + string(REPLACE "/GR " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE " /EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + add_compile_options( + # Disable exceptions + $<$:/EHsc-> + + # Disable RTTI + $<$:/GR-> + + # Enforce various standards compliant behavior. + $<$:/permissive-> + + # Enable standard volatile semantics. + $<$:/volatile:iso> + + # Reports the proper value for the __cplusplus preprocessor macro. + $<$:/Zc:__cplusplus> + + # Use latest C++ standard. + $<$:/std:c++latest> + ) + + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # Flags for MSVC (not clang-cl) + add_compile_options( + # Allow constexpr variables to have explicit external linkage. + $<$:/Zc:externConstexpr> + + # Assume that new throws exceptions, allowing better code generation. + $<$:/Zc:throwingNew> + + # Link-time Code Generation for Release builds + $<$:/GL> + ) + + # Link-time Code Generation for Release builds + set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO") + set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup") + endif() +else() + set(CMAKE_CXX_STANDARD 20) + set(CMAKE_CXX_STANDARD_REQUIRED ON) +endif () + +# two step: --target shaderc, --target install +set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true) + +add_subdirectory(../../extern/athena athena) +add_subdirectory(../../extern/boo boo) + +add_library(hecl-compilers ../lib/Compilers.cpp ../lib/WideStringConvert.cpp) +get_target_property(BOO_INCLUDES boo INTERFACE_INCLUDE_DIRECTORIES) +target_include_directories(hecl-compilers PUBLIC ../include ${BOO_INCLUDES}) +target_link_libraries(hecl-compilers PUBLIC athena-core logvisor xxhash + glslang OSDependent OGLCompiler SPIRV glslang-default-resource-limits) + add_library(shaderc_lib shaderc.cpp shaderc.hpp) target_link_libraries(shaderc_lib PUBLIC hecl-compilers athena-core logvisor) add_executable(shaderc main.cpp) target_link_libraries(shaderc shaderc_lib) + if (NOT WIN32) target_link_libraries(shaderc pthread) if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") @@ -10,29 +94,5 @@ if (NOT WIN32) target_link_libraries(shaderc dl) endif() endif() -if(COMMAND add_sanitizers) - add_sanitizers(shaderc_lib) - add_sanitizers(shaderc) -endif() -function(shaderc out) - if(IS_ABSOLUTE ${out}) - set(theOut ${out}) - else() - set(theOut ${CMAKE_CURRENT_BINARY_DIR}/${out}) - endif() - unset(theInsList) - foreach(in ${ARGN}) - if(IS_ABSOLUTE ${in}) - list(APPEND theInsList ${in}) - else() - list(APPEND theInsList ${CMAKE_CURRENT_SOURCE_DIR}/${in}) - endif() - endforeach() - get_filename_component(outDir ${theOut} DIRECTORY) - file(MAKE_DIRECTORY ${outDir}) - file(RELATIVE_PATH outRel ${CMAKE_BINARY_DIR} ${theOut}) - add_custom_command(OUTPUT ${theOut}.cpp ${theOut}.hpp - COMMAND $ ARGS -o ${theOut} ${theInsList} - DEPENDS ${theInsList} shaderc COMMENT "Compiling shader ${outRel}.shader") -endfunction() +install(TARGETS shaderc DESTINATION bin) \ No newline at end of file diff --git a/metaforce-gui/CMakeLists.txt b/metaforce-gui/CMakeLists.txt index 5433bf099..e117cb68b 100644 --- a/metaforce-gui/CMakeLists.txt +++ b/metaforce-gui/CMakeLists.txt @@ -144,20 +144,6 @@ elseif (APPLE) set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources ) - add_custom_command( - TARGET metaforce-gui POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ $ - COMMAND ${CMAKE_COMMAND} -E copy $ $ - COMMAND ${CMAKE_COMMAND} -E copy $ $ - DEPENDS metaforce hecl visigen - ) - if (NOT "${SENTRY_DSN}" STREQUAL "") - add_custom_command( - TARGET metaforce-gui POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ $ - DEPENDS crashpad_handler - ) - endif() endif () add_subdirectory(platforms/freedesktop) diff --git a/specter/lib/TextView.cpp b/specter/lib/TextView.cpp index 140cdbce7..49ed1e334 100644 --- a/specter/lib/TextView.cpp +++ b/specter/lib/TextView.cpp @@ -1,7 +1,7 @@ #include "specter/RootView.hpp" #include "specter/TextView.hpp" #include "specter/ViewResources.hpp" -#include "utf8proc.h" +#include "athena/utf8proc.h" #include "hecl/Pipeline.hpp" #include From 673ce0063bc4d65399f3652de6ea83b6b970df51 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 18 Apr 2021 11:19:09 -0400 Subject: [PATCH 2/9] Fixes for new build --- .github/workflows/build.yml | 198 +++++++++++++++++++++-------------- extern/libpng/CMakeLists.txt | 15 +-- 2 files changed, 128 insertions(+), 85 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce8ca85b7..623e1c9ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,14 +2,15 @@ name: Build on: push: - branches-ignore: - - master paths-ignore: - '*.json' - '*.md' - '*LICENSE' pull_request: +env: + BUILD_TYPE: RelWithDebInfo + jobs: build-linux: name: Build Linux (${{matrix.name}} x86_64) @@ -33,10 +34,18 @@ jobs: - name: Install dependencies run: | - sudo apt-get update + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" sudo apt-get -y install curl git cmake ninja-build clang lld qt5-default 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 python3 python-is-python3 + libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3 \ + intel-oneapi-ipp-devel ccache + + yarn global add @sentry/cli + echo "$(yarn global bin)" >> $GITHUB_PATH + # free up disk space # https://github.com/actions/virtual-environments/issues/2840#issuecomment-790492173 echo Before @@ -49,14 +58,23 @@ jobs: echo After df -h . + - name: Configure ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: ubuntu-20.04-${{matrix.cc}} + max-size: 1G + - name: Configure CMake run: | - cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \ - -DCMAKE_C_COMPILER=${{matrix.cc}} -DCMAKE_CXX_COMPILER=${{matrix.cxx}} + cmake -B build . -GNinja -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \ + -DCMAKE_INSTALL_PREFIX:PATH="$GITHUB_WORKSPACE/install" \ + -DCMAKE_C_COMPILER:STRING=${{matrix.cc}} \ + -DCMAKE_CXX_COMPILER:STRING=${{matrix.cxx}} \ + -DCMAKE_C_COMPILER_LAUNCHER:STRING=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache - name: Build - run: cmake --build build --config RelWithDebInfo --target install + run: cmake --build build --config $BUILD_TYPE --target install - name: Upload artifacts uses: actions/upload-artifact@v2 @@ -67,6 +85,9 @@ jobs: build-macos: name: Build macOS (AppleClang universal) runs-on: macos-10.15 + env: + Qt_VERSION: 5.15.2 + IPP_VERSION: 2021.2.0.192 steps: - uses: actions/checkout@v2 with: @@ -76,36 +97,70 @@ jobs: - name: Install dependencies run: | brew update - brew install ninja graphicsmagick imagemagick + brew install ninja graphicsmagick imagemagick ccache yarn global add create-dmg # universal qt5 from macports - curl -LSfs https://axiodl.com/files/qt5-5.15.2.mkpkg -o /tmp/qt5-5.15.2.mkpkg - sudo installer -pkg /tmp/qt5-5.15.2.mkpkg -target / + curl -LSfs https://axiodl.com/files/qt5-$Qt_VERSION.mkpkg -o /tmp/qt5-$Qt_VERSION.mkpkg + sudo installer -pkg /tmp/qt5-$Qt_VERSION.mkpkg -target / + + - name: Install Intel IPP + run: | + NAME="m_ipp_oneapi_p_${IPP_VERSION}_offline" + curl -LSfs https://registrationcenter-download.intel.com/akdlm/irc_nas/17606/$NAME.dmg -o /tmp/$NAME.dmg + sudo hdiutil attach /tmp/$NAME.dmg -quiet + sudo /Volumes/$NAME/bootstrapper.app/Contents/MacOS/install.sh -c --action install --eula accept + sudo hdiutil detach /Volumes/$NAME -quiet + rm /tmp/$NAME.dmg + + - name: Configure ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: macos-10.15-appleclang + max-size: 1G - name: Configure CMake run: | - cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \ - -DQt5Widgets_DIR=/opt/local/libexec/qt5/lib/cmake/Qt5Widgets \ - -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ - -DPNG_DIR=/opt/local/lib + cmake -B build . -GNinja -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \ + -DCMAKE_C_COMPILER_LAUNCHER:STRING=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \ + -DCMAKE_INSTALL_PREFIX:PATH="$GITHUB_WORKSPACE/install" \ + -DQt5Widgets_DIR:PATH=/opt/local/libexec/qt5/lib/cmake/Qt5Widgets \ + -DCMAKE_OSX_ARCHITECTURES:STRING="arm64;x86_64" \ + -DPNG_DIR:PATH=/opt/local/lib - name: Build - run: cmake --build build --config RelWithDebInfo --target install + run: cmake --build build --config $BUILD_TYPE --target install - name: Upload artifacts uses: actions/upload-artifact@v2 with: - name: metaforce-${{env.METAFORCE_VERSION}}-macos-appleclang-x86_64 + name: metaforce-${{env.METAFORCE_VERSION}}-macos-appleclang-universal path: install - build-windows-msvc: - name: Build Windows (MSVC x86_64) - if: 'false' # disabled due to memory constraints + build-windows: + name: Build Windows (${{matrix.name}} x86_64) runs-on: windows-2019 env: Qt_VERSION: 5.15.2 IPP_VERSION: 2021.2.0.210 + BUILDCACHE_VERSION: v0.26.1 + # C: has ~90GB available space at the moment + BUILDCACHE_DIR: C:\buildcache + BUILD_DIR: C:\build + INSTALL_DIR: C:\install + strategy: + fail-fast: false + matrix: + include: + # disabled due to memory constraints +# - name: MSVC +# oname: msvc +# cc: cl +# ld: link + - name: Clang + oname: clang + cc: clang-cl + ld: lld-link steps: - uses: actions/checkout@v2 with: @@ -120,77 +175,64 @@ jobs: (New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename") 7z x "-o$env:RUNNER_WORKSPACE" -aos "$TempDir\$Filename" - - name: Install dependencies - run: choco install ninja vulkan-sdk - - - name: Enable Visual Studio environment - uses: ilammy/msvc-dev-cmd@v1 - - - name: Create build directory - run: cmake -E make_directory ${{github.workspace}}/build - - - name: Configure CMake - run: | - $workspace = $env:RUNNER_WORKSPACE -replace '\\', '/' - cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo ` - -DCMAKE_INSTALL_PREFIX:PATH="$env:GITHUB_WORKSPACE\install" ` - -DCMAKE_TOOLCHAIN_FILE="$workspace/vcpkg-qt-$env:Qt_VERSION/scripts/buildsystems/vcpkg.cmake" ` - -DVCPKG_TARGET_TRIPLET=x64-windows-static ` - -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded - - - name: Build - run: cmake --build build --config RelWithDebInfo --target install - - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: metaforce-${{env.METAFORCE_VERSION}}-win32-msvc-x86_64 - path: install - - build-windows-clang: - name: Build Windows (Clang x86_64) - runs-on: windows-2019 - env: - Qt_VERSION: 5.15.2 - IPP_VERSION: 2021.2.0.210 - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: recursive - - - name: Install vcpkg Qt + - name: Install Intel IPP run: | $TempDir = "$env:RUNNER_WORKSPACE\temp" - $Filename = "vcpkg-qt-$env:Qt_VERSION.7z" + $Filename = "w_ipp_oneapi_p_${env:IPP_VERSION}_offline.exe" New-Item -Path "$TempDir" -ItemType Directory -ea 0 - (New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename") - 7z x "-o$env:RUNNER_WORKSPACE" -aos "$TempDir\$Filename" + (New-Object Net.WebClient).DownloadFile("https://registrationcenter-download.intel.com/akdlm/irc_nas/17739/$Filename", "$TempDir\$Filename") + Start-Process "$TempDir\$Filename" -ArgumentList "--x --s --f $TempDir\ipp" -Wait + Start-Process "$TempDir\ipp\bootstrapper.exe" -ArgumentList "--eula accept -c --action install" -Wait - name: Install dependencies - run: choco install ninja vulkan-sdk + run: | + choco install ninja vulkan-sdk + + # set up buildcache + $TempDir = "$env:RUNNER_WORKSPACE\temp" + New-Item -Path "$TempDir" -ItemType Directory -ea 0 + (New-Object Net.WebClient).DownloadFile("https://github.com/mbitsnbites/buildcache/releases/download/$env:BUILDCACHE_VERSION/buildcache-windows.zip", "$TempDir\buildcache.zip") + Expand-Archive -LiteralPath "$TempDir\buildcache.zip" -DestinationPath "$TempDir" + echo "$TempDir\buildcache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "BUILDCACHE_ACCURACY=STRICT" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "BUILDCACHE_MAX_CACHE_SIZE=1073741824" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + # check available disk space + Get-PSDrive + + - name: Restore buildcache + uses: actions/cache@v2 + with: + path: ${{env.BUILDCACHE_DIR}} + key: buildcache-windows-2019-${{matrix.oname}} - name: Enable Visual Studio environment uses: ilammy/msvc-dev-cmd@v1 - name: Configure CMake - working-directory: ${{github.workspace}}/build run: | - $workspace = $env:RUNNER_WORKSPACE -replace '\\', '/' - cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo ` - -DCMAKE_INSTALL_PREFIX:PATH="$env:GITHUB_WORKSPACE/install" ` - -DCMAKE_TOOLCHAIN_FILE="$workspace/vcpkg-qt-$env:Qt_VERSION/scripts/buildsystems/vcpkg.cmake" ` - -DVCPKG_TARGET_TRIPLET=x64-windows-static ` - -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ` - -DCMAKE_C_COMPILER=clang-cl ` - -DCMAKE_CXX_COMPILER=clang-cl ` - -DCMAKE_LINKER=lld-link + buildcache -z + cmake -B "$env:BUILD_DIR" . -GNinja -DCMAKE_BUILD_TYPE:STRING=$env:BUILD_TYPE ` + -DCMAKE_INSTALL_PREFIX:PATH="$env:INSTALL_DIR" ` + -DCMAKE_TOOLCHAIN_FILE:PATH="$env:RUNNER_WORKSPACE\vcpkg-qt-$env:Qt_VERSION\scripts\buildsystems\vcpkg.cmake" ` + -DVCPKG_TARGET_TRIPLET:STRING=x64-windows-static ` + -DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded ` + -DCMAKE_C_COMPILER:STRING=${{matrix.cc}} ` + -DCMAKE_CXX_COMPILER:STRING=${{matrix.cc}} ` + -DCMAKE_LINKER:STRING=${{matrix.ld}} ` + -DCMAKE_C_COMPILER_LAUNCHER:STRING=buildcache ` + -DCMAKE_CXX_COMPILER_LAUNCHER:STRING=buildcache ` + -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="/MD /Z7 /O2 /Ob1 /DNDEBUG" ` + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="/MD /Z7 /O2 /Ob1 /DNDEBUG" - name: Build - run: cmake --build build --config RelWithDebInfo --target install + run: cmake --build "$env:BUILD_DIR" --config $env:BUILD_TYPE --target install + + - name: Print buildcache stats + run: buildcache -s - name: Upload artifacts uses: actions/upload-artifact@v2 with: - name: metaforce-${{env.METAFORCE_VERSION}}-win32-clang-x86_64 - path: install + name: metaforce-${{env.METAFORCE_VERSION}}-win32-${{matrix.oname}}-x86_64 + path: ${{env.INSTALL_DIR}} diff --git a/extern/libpng/CMakeLists.txt b/extern/libpng/CMakeLists.txt index 128f3dffd..476b99a50 100644 --- a/extern/libpng/CMakeLists.txt +++ b/extern/libpng/CMakeLists.txt @@ -1,10 +1,16 @@ if (APPLE) # only consider static libs find_library(PNG_LIB NAMES libpng.a PATHS ${PNG_DIR} NO_DEFAULT_PATHS NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_SYSTEM_PATH) + if (PNG_LIB) + set(PNG_LIBRARIES ${PNG_LIB} ${ZLIB_LIBRARIES} CACHE PATH "PNG libraries" FORCE) + find_path(PNG_INCLUDE_DIR png.h PATHS "${PNG_LIB}/../../include" NO_DEFAULT_PATHS NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_SYSTEM_PATH) + set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE PATH "PNG include path" FORCE) + message(STATUS "Using libpng at ${PNG_LIB}, include: ${PNG_INCLUDE_DIR}") + endif() elseif (NOT WIN32 AND NOT NX) # remove WIN32 when specter/freetype is gone - find_library(PNG_LIB NAMES png libpng PATHS ${PNG_DIR}) + find_package(PNG REQUIRED) endif () -if (NOT PNG_LIB) +if (NOT PNG_LIBRARIES) message(STATUS "Using HECL's built-in libpng") if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm(64)?" OR (APPLE AND "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES)) list(APPEND INTRINSICS @@ -50,9 +56,4 @@ if (NOT PNG_LIB) target_include_directories(png PUBLIC ${ZLIB_INCLUDE_DIR}) set(PNG_LIBRARIES png CACHE PATH "PNG libraries" FORCE) set(PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "PNG include path" FORCE) -else () - set(PNG_LIBRARIES ${PNG_LIB} ${ZLIB_LIBRARIES} CACHE PATH "PNG libraries" FORCE) - find_path(PNG_INCLUDE_DIR png.h PATHS "${PNG_LIB}/../../include" NO_DEFAULT_PATHS NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_SYSTEM_PATH) - set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE PATH "PNG include path" FORCE) - message(STATUS "Using libpng at ${PNG_LIB}, include: ${PNG_INCLUDE_DIR}") endif () From c995643f9ca2cbdea12311e4326512a75c4274ac Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 18 Apr 2021 11:30:33 -0400 Subject: [PATCH 3/9] Add dummy atdna target for shaderc --- .github/workflows/build.yml | 4 ++-- hecl/shaderc/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 623e1c9ac..86ecacfbf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -100,8 +100,8 @@ jobs: brew install ninja graphicsmagick imagemagick ccache yarn global add create-dmg # universal qt5 from macports - curl -LSfs https://axiodl.com/files/qt5-$Qt_VERSION.mkpkg -o /tmp/qt5-$Qt_VERSION.mkpkg - sudo installer -pkg /tmp/qt5-$Qt_VERSION.mkpkg -target / + curl -LSfs https://axiodl.com/files/qt-$Qt_VERSION.mpkg -o /tmp/qt-$Qt_VERSION.mpkg + sudo installer -pkg /tmp/qt-$Qt_VERSION.mpkg -target / - name: Install Intel IPP run: | diff --git a/hecl/shaderc/CMakeLists.txt b/hecl/shaderc/CMakeLists.txt index 02b6990e4..fb69140c4 100644 --- a/hecl/shaderc/CMakeLists.txt +++ b/hecl/shaderc/CMakeLists.txt @@ -72,6 +72,7 @@ endif () # two step: --target shaderc, --target install set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true) +add_custom_target(atdna) # avoid building add_subdirectory(../../extern/athena athena) add_subdirectory(../../extern/boo boo) From 49d3feab3962389f17ab1afff2a7c3c22159fbbe Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 18 Apr 2021 12:00:26 -0400 Subject: [PATCH 4/9] Fix athena download on win32; update boo --- CMakeLists.txt | 9 +++++++-- extern/boo | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a83f5610..04c672730 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -359,9 +359,14 @@ endif() if (NOT BUILD_ATDNA) set(ATHENA_BASE_URL "https://github.com/libAthena/athena/releases/download/latest") + if (WIN32) + set(ATHENA_EXT 7z) + else() + set(ATHENA_EXT tar.gz) + endif() include(FetchContent) FetchContent_Declare(athena-host - URL "${ATHENA_BASE_URL}/athena-${PLATFORM_NAME}-${ATHENA_HOST_ARCH}.tar.gz") + URL "${ATHENA_BASE_URL}/athena-${PLATFORM_NAME}-${ATHENA_HOST_ARCH}.${ATHENA_EXT}") message(STATUS "Fetching atdna host binary") FetchContent_Populate(athena-host) include(${athena-host_SOURCE_DIR}/lib/cmake/atdna/atdnaConfig.cmake) @@ -490,7 +495,7 @@ add_subdirectory(specter EXCLUDE_FROM_ALL) target_include_directories(specter PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(specter PRIVATE nod) if (NOT CMAKE_CROSSCOMPILING) - add_subdirectory(assetnameparser) + add_subdirectory(assetnameparser EXCLUDE_FROM_ALL) endif () add_compile_definitions(URDE_ZIP_INPUT_STREAM=1) # Enable CZipInputStream now that zlib header is known add_subdirectory(DataSpec) diff --git a/extern/boo b/extern/boo index 09b788d20..e23eedb33 160000 --- a/extern/boo +++ b/extern/boo @@ -1 +1 @@ -Subproject commit 09b788d20b91aba8b3c9084bcf5e8a61f03935e8 +Subproject commit e23eedb338f55cc3fcd47915ac30dd3d625ae9b0 From f6f0faf68e42eb5985dbabf1dda22aa54a6b007e Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 18 Apr 2021 12:01:59 -0400 Subject: [PATCH 5/9] Set PNG_LIBRARIES after find_package --- extern/libpng/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/extern/libpng/CMakeLists.txt b/extern/libpng/CMakeLists.txt index 476b99a50..970c07948 100644 --- a/extern/libpng/CMakeLists.txt +++ b/extern/libpng/CMakeLists.txt @@ -9,6 +9,7 @@ if (APPLE) endif() elseif (NOT WIN32 AND NOT NX) # remove WIN32 when specter/freetype is gone find_package(PNG REQUIRED) + set(PNG_LIBRARIES PNG::PNG) endif () if (NOT PNG_LIBRARIES) message(STATUS "Using HECL's built-in libpng") From 7b072bc65081ee70937ac4429bcfecbe2751341a Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 18 Apr 2021 12:19:27 -0400 Subject: [PATCH 6/9] Set PNG_LIBRARIES with CACHE FORCE --- extern/libpng/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/libpng/CMakeLists.txt b/extern/libpng/CMakeLists.txt index 970c07948..619565c35 100644 --- a/extern/libpng/CMakeLists.txt +++ b/extern/libpng/CMakeLists.txt @@ -9,7 +9,7 @@ if (APPLE) endif() elseif (NOT WIN32 AND NOT NX) # remove WIN32 when specter/freetype is gone find_package(PNG REQUIRED) - set(PNG_LIBRARIES PNG::PNG) + set(PNG_LIBRARIES PNG::PNG CACHE STRING "PNG libraries" FORCE) endif () if (NOT PNG_LIBRARIES) message(STATUS "Using HECL's built-in libpng") From abe1eb71c04766717ca8897d65e9966e135c02d0 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 18 Apr 2021 21:39:09 -0400 Subject: [PATCH 7/9] Disable IPP for macOS universal build Remove LLVM dependency from README.md Attempt to fix png include on Linux --- .github/workflows/build.yml | 1 + README.md | 7 ++----- extern/libpng/CMakeLists.txt | 3 ++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86ecacfbf..008becfb6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -104,6 +104,7 @@ jobs: sudo installer -pkg /tmp/qt-$Qt_VERSION.mpkg -target / - name: Install Intel IPP + if: 'false' # not supported for universal build run: | NAME="m_ipp_oneapi_p_${IPP_VERSION}_offline" curl -LSfs https://registrationcenter-download.intel.com/akdlm/irc_nas/17606/$NAME.dmg -o /tmp/$NAME.dmg diff --git a/README.md b/README.md index 3d27e3835..54cb04694 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,6 @@ NFS files dumped from Metroid Prime Trilogy on Wii U VC can be used directly wit * Windows: [Microsoft Store](https://go.microsoft.com/fwlink?linkID=2082640) * Verify it's added to `%PATH%` by typing `python` in `cmd`. * macOS: `brew install python@3` -* LLVM development package *(headers and libs)* - * [Specialized Windows Package](https://axiodl.com/files/LLVM-10.0.1-win64.exe) - * macOS: `brew install --force-bottle llvm` * **[Windows]** [Visual Studio 2019 Community](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx) * Select `C++ Development` and verify the following packages are included: * `Windows 10 SDK` @@ -62,8 +59,8 @@ NFS files dumped from Metroid Prime Trilogy on Wii U VC can be used directly wit * **[Linux]** recent development packages of `udev`, `x11`, `xcb`, `xinput`, `glx`, `asound` * Ubuntu 20.04+ packages ``` - build-essential curl git ninja-build llvm-dev libclang-dev clang lld zlib1g-dev libcurl4-openssl-dev - libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev libpulse-dev + build-essential curl git ninja-build clang lld zlib1g-dev libcurl4-openssl-dev \ + libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev libpulse-dev \ libudev-dev libpng-dev libncurses5-dev cmake libx11-xcb-dev python3 python-is-python3 qt5-default ``` diff --git a/extern/libpng/CMakeLists.txt b/extern/libpng/CMakeLists.txt index 619565c35..90bb8a551 100644 --- a/extern/libpng/CMakeLists.txt +++ b/extern/libpng/CMakeLists.txt @@ -9,7 +9,8 @@ if (APPLE) endif() elseif (NOT WIN32 AND NOT NX) # remove WIN32 when specter/freetype is gone find_package(PNG REQUIRED) - set(PNG_LIBRARIES PNG::PNG CACHE STRING "PNG libraries" FORCE) + set(PNG_LIBRARIES ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} CACHE STRING "PNG libraries" FORCE) + set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE PATH "PNG include path" FORCE) endif () if (NOT PNG_LIBRARIES) message(STATUS "Using HECL's built-in libpng") From 09adc3f2adfc7659943432e561c4b47e2d0c71f3 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 18 Apr 2021 23:15:10 -0400 Subject: [PATCH 8/9] Update athena --- CMakeLists.txt | 5 ++--- extern/athena | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04c672730..124d0c47c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,10 +351,9 @@ if(NOT GEKKO AND NOT NX) endif () endif() -if (APPLE) - # use toolchain zlib +if (NOT WIN32) find_package(ZLIB REQUIRED) - set(ZLIB_LIBRARIES ZLIB::ZLIB) + set(ZLIB_LIBRARIES ZLIB::ZLIB CACHE STRING "zlib libraries" FORCE) endif() if (NOT BUILD_ATDNA) diff --git a/extern/athena b/extern/athena index 8558ca1b5..991ffede7 160000 --- a/extern/athena +++ b/extern/athena @@ -1 +1 @@ -Subproject commit 8558ca1b5111ebe83ee44b1200b0b0d1d94f2fa2 +Subproject commit 991ffede795a60b3bf8765601afda1ef02424ee8 From 05ff095ed4121df84748e78d923524797c31c59e Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 18 Apr 2021 23:36:22 -0400 Subject: [PATCH 9/9] Set BUILD_ATHENA default ON --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 124d0c47c..91ae8f3ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,6 +356,9 @@ if (NOT WIN32) set(ZLIB_LIBRARIES ZLIB::ZLIB CACHE STRING "zlib libraries" FORCE) endif() +option(BUILD_ATHENA "Build Athena libraries from source" ON) +option(BUILD_ATDNA "Build atdna utility from source (requires LLVM)" OFF) + if (NOT BUILD_ATDNA) set(ATHENA_BASE_URL "https://github.com/libAthena/athena/releases/download/latest") if (WIN32)