导出数据转spine

This commit is contained in:
tianmo
2026-09-07 21:29:15 +08:00
parent d258d4f435
commit 3a7c0b4092
65 changed files with 6000 additions and 0 deletions
+130
View File
@@ -0,0 +1,130 @@
cmake_minimum_required(VERSION 3.25)
project(DateToSpine VERSION 0.1.0 LANGUAGES CXX)
option(DTS_BUILD_TESTS "Build DateToSpine tests" ON)
option(DTS_BUILD_GUI "Build the DateToSpine desktop application" ON)
option(DTS_BUILD_RUNTIME_PLUGINS "Build bundled Spine runtime adapters" ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_library(dts_core
src/domain/SpineVersion.cpp
src/atlas/AtlasParser.cpp
src/preview/RuntimePlugin.cpp
src/scan/SpineDataVersionDetector.cpp
src/editor/SpineEditorLocator.cpp
src/editor/SpineOutputParser.cpp
src/editor/SpineProbe.cpp
src/editor/SpineVersionAvailability.cpp
)
if(APPLE OR UNIX)
target_sources(dts_core PRIVATE src/platform/ProcessRunner_posix.cpp)
elseif(WIN32)
target_sources(dts_core PRIVATE src/platform/ProcessRunner_windows.cpp)
else()
message(FATAL_ERROR "Unsupported platform")
endif()
target_include_directories(dts_core PUBLIC src runtime-api)
target_link_libraries(dts_core PRIVATE ${CMAKE_DL_LIBS})
if(MSVC)
target_compile_options(dts_core PRIVATE /W4 /permissive- /utf-8)
else()
target_compile_options(dts_core PRIVATE -Wall -Wextra -Wpedantic)
endif()
if(DTS_BUILD_RUNTIME_PLUGINS)
include(cmake/SpineRuntime.cmake)
dts_add_runtime_adapter(38 "3.8" spine38 "spine-cpp/spine-cpp")
dts_add_runtime_adapter(40 "4.0" spine40 "spine-cpp/spine-cpp")
dts_add_runtime_adapter(41 "4.1" spine41 "spine-cpp/spine-cpp")
dts_add_runtime_adapter(42 "4.2" spine42 "spine-cpp/spine-cpp")
dts_add_runtime_adapter(43 "4.3" spine43 "spine-cpp")
endif()
add_executable(datetospine-cli src/app/cli_main.cpp)
target_link_libraries(datetospine-cli PRIVATE dts_core)
if(DTS_BUILD_GUI)
find_package(Qt6 REQUIRED COMPONENTS Concurrent OpenGLWidgets Widgets)
add_executable(DateToSpine MACOSX_BUNDLE WIN32
src/app/gui_main.cpp
src/conversion/ConversionJob.cpp
src/conversion/ConversionJob.hpp
src/ui/MainWindow.cpp
src/ui/MainWindow.hpp
src/ui/SpinePreviewWidget.cpp
src/ui/SpinePreviewWidget.hpp
)
set_target_properties(DateToSpine PROPERTIES
AUTOMOC ON
MACOSX_BUNDLE_GUI_IDENTIFIER io.datetospine.desktop
MACOSX_BUNDLE_BUNDLE_NAME DateToSpine)
target_link_libraries(DateToSpine PRIVATE
dts_core
Qt6::Concurrent
Qt6::OpenGLWidgets
Qt6::Widgets
)
if(DTS_BUILD_RUNTIME_PLUGINS)
add_dependencies(DateToSpine
dts_runtime_38 dts_runtime_40 dts_runtime_41 dts_runtime_42 dts_runtime_43)
foreach(runtime_line IN ITEMS 38 40 41 42 43)
add_custom_command(TARGET dts_runtime_${runtime_line} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"$<TARGET_BUNDLE_DIR:DateToSpine>/Contents/PlugIns/runtimes"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:dts_runtime_${runtime_line}>"
"$<TARGET_BUNDLE_DIR:DateToSpine>/Contents/PlugIns/runtimes/")
add_custom_command(TARGET DateToSpine POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"$<TARGET_BUNDLE_DIR:DateToSpine>/Contents/PlugIns/runtimes"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:dts_runtime_${runtime_line}>"
"$<TARGET_BUNDLE_DIR:DateToSpine>/Contents/PlugIns/runtimes/")
endforeach()
endif()
endif()
if(DTS_BUILD_TESTS)
enable_testing()
add_executable(dts_core_tests
tests/unit/CoreTests.cpp
)
target_link_libraries(dts_core_tests PRIVATE dts_core)
if(DTS_BUILD_RUNTIME_PLUGINS)
add_dependencies(dts_core_tests
dts_runtime_38 dts_runtime_40 dts_runtime_41 dts_runtime_42 dts_runtime_43)
target_compile_definitions(dts_core_tests PRIVATE
DTS_RUNTIME_38_PATH="$<TARGET_FILE:dts_runtime_38>"
DTS_RUNTIME_40_PATH="$<TARGET_FILE:dts_runtime_40>"
DTS_RUNTIME_41_PATH="$<TARGET_FILE:dts_runtime_41>"
DTS_RUNTIME_42_PATH="$<TARGET_FILE:dts_runtime_42>"
DTS_RUNTIME_43_PATH="$<TARGET_FILE:dts_runtime_43>"
DTS_TEST_38_JSON="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/3.8/examples/spineboy/export/spineboy-pro.json"
DTS_TEST_38_SKEL="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/3.8/examples/spineboy/export/spineboy-pro.skel"
DTS_TEST_38_ATLAS="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/3.8/examples/spineboy/export/spineboy.atlas"
DTS_TEST_40_JSON="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.0/examples/spineboy/export/spineboy-pro.json"
DTS_TEST_40_SKEL="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.0/examples/spineboy/export/spineboy-pro.skel"
DTS_TEST_40_ATLAS="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.0/examples/spineboy/export/spineboy.atlas"
DTS_TEST_41_JSON="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.1/examples/spineboy/export/spineboy-pro.json"
DTS_TEST_41_SKEL="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.1/examples/spineboy/export/spineboy-pro.skel"
DTS_TEST_41_ATLAS="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.1/examples/spineboy/export/spineboy.atlas"
DTS_TEST_42_JSON="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.2/examples/spineboy/export/spineboy-pro.json"
DTS_TEST_42_SKEL="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.2/examples/spineboy/export/spineboy-pro.skel"
DTS_TEST_42_ATLAS="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.2/examples/spineboy/export/spineboy.atlas"
DTS_TEST_SPINEBOY_JSON="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.3/examples/spineboy/export/spineboy-pro.json"
DTS_TEST_SPINEBOY_SKEL="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.3/examples/spineboy/export/spineboy-pro.skel"
DTS_TEST_SPINEBOY_ATLAS="${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes/4.3/examples/spineboy/export/spineboy.atlas")
endif()
add_test(NAME dts_core_tests COMMAND dts_core_tests)
endif()
install(FILES third_party/spine-runtimes/4.3/spine-cpp/LICENSE
DESTINATION licenses
RENAME Spine-Runtimes-License.txt)