Skip to content

Commit

Permalink
embed toolset
Browse files Browse the repository at this point in the history
  • Loading branch information
PredatorCZ committed Sep 14, 2023
1 parent f681d34 commit 3f69282
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 59 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
38 changes: 27 additions & 11 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion toolset/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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()
2 changes: 1 addition & 1 deletion toolset/arh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build_target(
SOURCES
extract_arh.cpp
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand Down
2 changes: 1 addition & 1 deletion toolset/asm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build_target(
INCLUDES
${TPD_PATH}/spike/3rd_party/json
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand Down
2 changes: 1 addition & 1 deletion toolset/bdat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build_target(
INCLUDES
${TPD_PATH}/spike/3rd_party/json
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand Down
4 changes: 2 additions & 2 deletions toolset/dev/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build_target(
SOURCES
decrypt_bdat.cpp
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand All @@ -30,7 +30,7 @@ build_target(
SOURCES
decrypt_arh.cpp
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand Down
2 changes: 1 addition & 1 deletion toolset/font/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build_target(
../common
${TPD_PATH}/spike/3rd_party/json
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand Down
48 changes: 24 additions & 24 deletions toolset/map/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build_target(
INCLUDES
../common
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand All @@ -34,34 +34,34 @@ build_target(
INCLUDES
../common
LINKS
xeno
gltf
xeno-interface
gltf-interface
AUTHOR
"Lukas Cone"
DESCR
"Xenoblade Instanced Model to GLTF"
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)
5 changes: 3 additions & 2 deletions toolset/mdo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions toolset/sar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build_target(
SOURCES
sar_extract.cpp
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand All @@ -30,7 +30,7 @@ build_target(
SOURCES
make_sar.cpp
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand Down
2 changes: 1 addition & 1 deletion toolset/shader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build_target(
SOURCES
extract_shaders.cpp
LINKS
xeno
xeno-interface
decaf
AUTHOR
"Lukas Cone"
Expand Down
2 changes: 1 addition & 1 deletion toolset/smt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build_target(
INCLUDES
../common
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand Down
2 changes: 1 addition & 1 deletion toolset/tex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build_target(
INCLUDES
../common
LINKS
xeno
xeno-interface
AUTHOR
"Lukas Cone"
DESCR
Expand Down

0 comments on commit 3f69282

Please sign in to comment.