mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[cpp] Remove no-cpprt.cpp and corresponding build targets
This commit is contained in:
parent
6f1a3198bb
commit
b37ee6fb6f
@ -7,11 +7,7 @@ option(SPINE_NO_FILE_IO "Disable file I/O operations" OFF)
|
||||
|
||||
include_directories(include)
|
||||
file(GLOB INCLUDES "include/**/*.h")
|
||||
file(GLOB ALL_SOURCES "src/**/*.cpp")
|
||||
|
||||
# Exclude no-cpprt.cpp from regular build
|
||||
list(FILTER ALL_SOURCES EXCLUDE REGEX "src/no-cpprt\\.cpp$")
|
||||
set(SOURCES ${ALL_SOURCES})
|
||||
file(GLOB SOURCES "src/**/*.cpp")
|
||||
|
||||
add_library(spine-cpp STATIC ${SOURCES} ${INCLUDES})
|
||||
target_include_directories(spine-cpp PUBLIC include)
|
||||
@ -20,12 +16,6 @@ if(SPINE_NO_FILE_IO)
|
||||
target_compile_definitions(spine-cpp PRIVATE SPINE_NO_FILE_IO)
|
||||
endif()
|
||||
|
||||
# no-cpprt variant (no C++ runtime)
|
||||
set(NO_CPPRT_SOURCES ${SOURCES} "src/no-cpprt.cpp")
|
||||
add_library(spine-cpp-no-cpprt STATIC ${NO_CPPRT_SOURCES} ${INCLUDES})
|
||||
target_include_directories(spine-cpp-no-cpprt PUBLIC include)
|
||||
target_compile_definitions(spine-cpp-no-cpprt PRIVATE SPINE_NO_CPP_RT)
|
||||
|
||||
# Install target
|
||||
install(TARGETS spine-cpp EXPORT spine-cpp_TARGETS DESTINATION dist/lib)
|
||||
install(FILES ${INCLUDES} DESTINATION dist/include)
|
||||
@ -45,39 +35,14 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
target_compile_definitions(headless-test PRIVATE SPINE_NO_FILE_IO)
|
||||
endif()
|
||||
|
||||
# Configure no-cpprt linking for different platforms
|
||||
# No-cpprt variant (not compatible with sanitizers)
|
||||
if(NOT SPINE_SANITIZE)
|
||||
add_executable(headless-test-no-cpprt ${CMAKE_CURRENT_SOURCE_DIR}/tests/HeadlessTest.cpp)
|
||||
target_link_libraries(headless-test-no-cpprt spine-cpp-no-cpprt)
|
||||
target_compile_definitions(headless-test-no-cpprt PRIVATE SPINE_NO_CPP_RT)
|
||||
|
||||
if(MSVC)
|
||||
target_link_options(headless-test-no-cpprt PRIVATE /NODEFAULTLIB)
|
||||
target_link_libraries(headless-test-no-cpprt msvcrt kernel32)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
target_link_options(headless-test-no-cpprt PRIVATE -nostdlib++ -lc)
|
||||
else()
|
||||
target_link_options(headless-test-no-cpprt PRIVATE -nodefaultlibs)
|
||||
target_link_libraries(headless-test-no-cpprt -lm -lc -lgcc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Static variants (Linux only, but not with sanitizers)
|
||||
if(UNIX AND NOT APPLE AND NOT SPINE_SANITIZE)
|
||||
add_executable(headless-test-static ${CMAKE_CURRENT_SOURCE_DIR}/tests/HeadlessTest.cpp)
|
||||
target_link_libraries(headless-test-static spine-cpp)
|
||||
target_link_options(headless-test-static PRIVATE -static)
|
||||
|
||||
add_executable(headless-test-no-cpprt-static ${CMAKE_CURRENT_SOURCE_DIR}/tests/HeadlessTest.cpp)
|
||||
target_link_libraries(headless-test-no-cpprt-static spine-cpp-no-cpprt)
|
||||
target_compile_definitions(headless-test-no-cpprt-static PRIVATE SPINE_NO_CPP_RT)
|
||||
target_link_options(headless-test-no-cpprt-static PRIVATE -static -static-libgcc -Wl,--exclude-libs,libstdc++.a)
|
||||
target_link_libraries(headless-test-no-cpprt-static -lm -lc)
|
||||
|
||||
if(SPINE_NO_FILE_IO)
|
||||
target_compile_definitions(headless-test-static PRIVATE SPINE_NO_FILE_IO)
|
||||
target_compile_definitions(headless-test-no-cpprt-static PRIVATE SPINE_NO_FILE_IO)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -1,70 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
// Avoid including any standard headers for maximum portability
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Stubs for C++ stdlib functions spine-cpp depends on. Used for nostdcpp builds.
|
||||
// These are weak symbols to allow overriding in custom builds, e.g. headless-test-nostdcpp
|
||||
// where the main app still requires C++.
|
||||
|
||||
extern "C" {
|
||||
void* malloc(size_t size);
|
||||
void free(void* ptr);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void* operator new(size_t size) {
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void operator delete(void* ptr) {
|
||||
if (ptr) free(ptr);
|
||||
}
|
||||
|
||||
extern "C" __attribute__((weak)) int __cxa_guard_acquire(char* guard) {
|
||||
return *guard == 0 ? (*guard = 1, 1) : 0;
|
||||
}
|
||||
|
||||
extern "C" __attribute__((weak)) void __cxa_guard_release(char* guard) {
|
||||
// No-op for single-threaded
|
||||
(void)guard;
|
||||
}
|
||||
|
||||
extern "C" __attribute__((weak)) void __cxa_pure_virtual() {
|
||||
}
|
||||
|
||||
extern "C" __attribute__((weak)) char __stack_chk_guard = 0;
|
||||
extern "C" __attribute__((weak)) void __stack_chk_fail() {
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user