From 3f69282908470a585ad8312ca7258c9ddef89b86 Mon Sep 17 00:00:00 2001 From: Lukas Cone Date: Wed, 13 Sep 2023 20:10:42 +0200 Subject: [PATCH] embed toolset --- .github/workflows/build.yaml | 8 +++--- 3rd_party/spike | 2 +- CMakeLists.txt | 11 ++++---- source/CMakeLists.txt | 38 +++++++++++++++++++-------- toolset/CMakeLists.txt | 4 ++- toolset/arh/CMakeLists.txt | 2 +- toolset/asm/CMakeLists.txt | 2 +- toolset/bdat/CMakeLists.txt | 2 +- toolset/dev/CMakeLists.txt | 4 +-- toolset/font/CMakeLists.txt | 2 +- toolset/map/CMakeLists.txt | 48 +++++++++++++++++------------------ toolset/mdo/CMakeLists.txt | 5 ++-- toolset/sar/CMakeLists.txt | 4 +-- toolset/shader/CMakeLists.txt | 2 +- toolset/smt/CMakeLists.txt | 2 +- toolset/tex/CMakeLists.txt | 2 +- 16 files changed, 79 insertions(+), 59 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3140385..2435f13 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -34,7 +34,7 @@ jobs: shell: bash steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: recursive fetch-depth: 0 @@ -63,7 +63,7 @@ jobs: - name: Upload Artifacts if: ${{matrix.artifacts == true}} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: XenobladeToolset-linux-amd64 path: ${{github.workspace}}/XenobladeToolset-v${{env.SK_VERSION}}-linux-amd64.tar.xz @@ -72,7 +72,7 @@ jobs: build-widle: runs-on: windows-2022 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: recursive fetch-depth: 0 @@ -98,7 +98,7 @@ jobs: copy toolset/README.md bin/README.md - name: Upload Artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: XenobladeToolset-v${{env.SK_VERSION}}-win64 path: ${{github.workspace}}/bin diff --git a/3rd_party/spike b/3rd_party/spike index addee2f..e748840 160000 --- a/3rd_party/spike +++ b/3rd_party/spike @@ -1 +1 @@ -Subproject commit addee2f214b54b2862dd6613bceab1875b43f7f0 +Subproject commit e748840dc575f3ed57e3421b4e0f1fcb731f08c9 diff --git a/CMakeLists.txt b/CMakeLists.txt index e54e6ae..66e9a76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,17 +19,18 @@ option(ODR_TEST "Enable ODR testing." OFF) option(OBJECTS_PID "Imply PID for all objects." OFF) option(XN_STATIC_LIB "Builds xeno-static target." OFF) -option(NO_OBJECTS "" OFF) option(CLI "" ${TOOLSET}) option(GLTF "" ${TOOLSET}) -option(BUILD_SHARED_LIBS "" ${TOOLSET}) +if(TOOLSET) + set(EXPOSE_SYMBOLS spike;gltf;xeno) +endif() + +set(TPD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/3rd_party) +add_subdirectory(${TPD_PATH}/spike) set(CMAKE_CXX_STANDARD 20) add_compile_options(-Wall -Wextra) -set(TPD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/3rd_party) -add_subdirectory(${TPD_PATH}/spike) -include(targetex) add_subdirectory(source) if(TOOLSET) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 0cf020e..c379bf1 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -12,6 +12,12 @@ set(CORE_SOURCE_FILES ${TPD_PATH}/zstd/lib/decompress/huf_decompress_amd64.S ) +add_library(xeno-interface INTERFACE) +target_include_directories(xeno-interface INTERFACE ../include) +target_link_libraries(xeno-interface INTERFACE spike-interface) + +include(targetex) + if((NOT NO_OBJECTS) OR XN_STATIC_LIB) build_target( NAME @@ -20,19 +26,28 @@ if((NOT NO_OBJECTS) OR XN_STATIC_LIB) OBJECT SOURCES ${CORE_SOURCE_FILES} + INCLUDES + . + ${TPD_PATH}/zlib + ${TPD_PATH}/zstd/lib/common + ${TPD_PATH}/zstd/lib LINKS - spike-objects + spike-interface + xeno-interface NO_VERINFO NO_PROJECT_H) set_target_properties(xeno-objects PROPERTIES POSITION_INDEPENDENT_CODE ${OBJECTS_PID}) target_compile_options(xeno-objects PRIVATE -fvisibility=hidden) + target_compile_definitions( + xeno-objects PRIVATE + ZSTDLIB_VISIBLE=__attribute__\(\(visibility\(\"hidden\"\)\)\) + ZSTDLIB_HIDDEN=__attribute__\(\(visibility\(\"hidden\"\)\)\) + ZSTDERRORLIB_VISIBILITY=__attribute__\(\(visibility\(\"hidden\"\)\)\) + ) - target_include_directories( - xeno-objects - PUBLIC ../include - PRIVATE . ${TPD_PATH}/zlib ${TPD_PATH}/zstd/lib/common ${TPD_PATH}/zstd/lib) + target_expose_defs(xeno XN_EXPORT XN_IMPORT) endif() if(XN_STATIC_LIB) @@ -58,22 +73,23 @@ if(BUILD_SHARED_LIBS) SHARED SOURCES ${CORE_SOURCE_FILES} + INCLUDES + . + ${TPD_PATH}/zlib + ${TPD_PATH}/zstd/lib/common + ${TPD_PATH}/zstd/lib LINKS spike + xeno-interface START_YEAR 2017 AUTHOR "Lukas Cone" NO_PROJECT_H) - target_include_directories( - xeno - PUBLIC ../include - PRIVATE . ${TPD_PATH}/zlib ${TPD_PATH}/zstd/lib/common ${TPD_PATH}/zstd/lib) - target_compile_definitions( xeno - PRIVATE XN_EXPORT REF_EXPORT + PRIVATE XN_EXPORT INTERFACE XN_IMPORT) if(WIN32 OR MINGW) diff --git a/toolset/CMakeLists.txt b/toolset/CMakeLists.txt index 318fcff..5b29e6d 100644 --- a/toolset/CMakeLists.txt +++ b/toolset/CMakeLists.txt @@ -1,5 +1,7 @@ +cmake_minimum_required(VERSION 3.13) project(XenobladeToolset) set_target_properties(spike_cli PROPERTIES OUTPUT_NAME xenoblade_toolset) +target_link_libraries(spike_cli xeno-objects) include(version) toolset_version() @@ -15,6 +17,6 @@ add_spike_subdir(asm) add_spike_subdir(map) add_spike_subdir(font) -if(NOT RELEASEVER) +if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_spike_subdir(dev) endif() diff --git a/toolset/arh/CMakeLists.txt b/toolset/arh/CMakeLists.txt index 556aa40..e511dbd 100644 --- a/toolset/arh/CMakeLists.txt +++ b/toolset/arh/CMakeLists.txt @@ -10,7 +10,7 @@ build_target( SOURCES extract_arh.cpp LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR diff --git a/toolset/asm/CMakeLists.txt b/toolset/asm/CMakeLists.txt index 0515da7..dc26bfc 100644 --- a/toolset/asm/CMakeLists.txt +++ b/toolset/asm/CMakeLists.txt @@ -12,7 +12,7 @@ build_target( INCLUDES ${TPD_PATH}/spike/3rd_party/json LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR diff --git a/toolset/bdat/CMakeLists.txt b/toolset/bdat/CMakeLists.txt index b4ffab8..f81231b 100644 --- a/toolset/bdat/CMakeLists.txt +++ b/toolset/bdat/CMakeLists.txt @@ -12,7 +12,7 @@ build_target( INCLUDES ${TPD_PATH}/spike/3rd_party/json LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR diff --git a/toolset/dev/CMakeLists.txt b/toolset/dev/CMakeLists.txt index 999c0cb..858afb5 100644 --- a/toolset/dev/CMakeLists.txt +++ b/toolset/dev/CMakeLists.txt @@ -10,7 +10,7 @@ build_target( SOURCES decrypt_bdat.cpp LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR @@ -30,7 +30,7 @@ build_target( SOURCES decrypt_arh.cpp LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR diff --git a/toolset/font/CMakeLists.txt b/toolset/font/CMakeLists.txt index f4c842a..84e50f5 100644 --- a/toolset/font/CMakeLists.txt +++ b/toolset/font/CMakeLists.txt @@ -13,7 +13,7 @@ build_target( ../common ${TPD_PATH}/spike/3rd_party/json LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR diff --git a/toolset/map/CMakeLists.txt b/toolset/map/CMakeLists.txt index 2308315..65b0b8b 100644 --- a/toolset/map/CMakeLists.txt +++ b/toolset/map/CMakeLists.txt @@ -12,7 +12,7 @@ build_target( INCLUDES ../common LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR @@ -34,8 +34,8 @@ build_target( INCLUDES ../common LINKS - xeno - gltf + xeno-interface + gltf-interface AUTHOR "Lukas Cone" DESCR @@ -43,25 +43,25 @@ build_target( START_YEAR 2022) - project(TM2GLTF) +project(TM2GLTF) - build_target( - NAME - tm_to_gltf - TYPE - ESMODULE - VERSION - 1 - SOURCES - tm_to_gltf.cpp - INCLUDES - ../common - LINKS - xeno - gltf - AUTHOR - "Lukas Cone" - DESCR - "Xenoblade Terrain Model to GLTF" - START_YEAR - 2022) +build_target( + NAME + tm_to_gltf + TYPE + ESMODULE + VERSION + 1 + SOURCES + tm_to_gltf.cpp + INCLUDES + ../common + LINKS + xeno-interface + gltf-interface + AUTHOR + "Lukas Cone" + DESCR + "Xenoblade Terrain Model to GLTF" + START_YEAR + 2022) diff --git a/toolset/mdo/CMakeLists.txt b/toolset/mdo/CMakeLists.txt index 9e84d31..4684f19 100644 --- a/toolset/mdo/CMakeLists.txt +++ b/toolset/mdo/CMakeLists.txt @@ -11,9 +11,10 @@ build_target( mdo_to_gltf.cpp INCLUDES ../common + ${TPD_PATH}/3rd_party/json LINKS - xeno - gltf + xeno-interface + gltf-interface AUTHOR "Lukas Cone" DESCR diff --git a/toolset/sar/CMakeLists.txt b/toolset/sar/CMakeLists.txt index 9b266dc..8d8f068 100644 --- a/toolset/sar/CMakeLists.txt +++ b/toolset/sar/CMakeLists.txt @@ -10,7 +10,7 @@ build_target( SOURCES sar_extract.cpp LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR @@ -30,7 +30,7 @@ build_target( SOURCES make_sar.cpp LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR diff --git a/toolset/shader/CMakeLists.txt b/toolset/shader/CMakeLists.txt index 590dd3f..b0f3d40 100644 --- a/toolset/shader/CMakeLists.txt +++ b/toolset/shader/CMakeLists.txt @@ -12,7 +12,7 @@ build_target( SOURCES extract_shaders.cpp LINKS - xeno + xeno-interface decaf AUTHOR "Lukas Cone" diff --git a/toolset/smt/CMakeLists.txt b/toolset/smt/CMakeLists.txt index a00a0dc..395cd92 100644 --- a/toolset/smt/CMakeLists.txt +++ b/toolset/smt/CMakeLists.txt @@ -12,7 +12,7 @@ build_target( INCLUDES ../common LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR diff --git a/toolset/tex/CMakeLists.txt b/toolset/tex/CMakeLists.txt index 999ed63..aa5e732 100644 --- a/toolset/tex/CMakeLists.txt +++ b/toolset/tex/CMakeLists.txt @@ -12,7 +12,7 @@ build_target( INCLUDES ../common LINKS - xeno + xeno-interface AUTHOR "Lukas Cone" DESCR