mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 01:06:00 +08:00
54 lines
1.8 KiB
CMake
54 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.17)
|
|
project(spine)
|
|
|
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "Install location" FORCE)
|
|
endif()
|
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
option(SPINE_SFML "Build spine SFML API" OFF)
|
|
option(SPINE_SANITIZE "Build with sanitization" OFF)
|
|
option(BUILD_TESTING "Build with testing" ON)
|
|
|
|
if(MSVC)
|
|
message("MSCV detected")
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
|
set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
else()
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wunused-value -Wno-variadic-macros -Wextra -pedantic -Wshadow -std=c99")
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunused-value -Wno-variadic-macros -Wextra -Wnon-virtual-dtor -pedantic -Wshadow -std=c++11 -fno-exceptions -fno-rtti")
|
|
|
|
if (${SPINE_SANITIZE})
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=undefined")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined")
|
|
endif()
|
|
endif()
|
|
|
|
if((${SPINE_SFML}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-sfml"))
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
set(CMAKE_OSX_ARCHITECTURES x86_64)
|
|
set(ONLY_ACTIVE_ARCH NO)
|
|
endif()
|
|
add_subdirectory(spine-c)
|
|
add_subdirectory(spine-cpp)
|
|
add_subdirectory(spine-sfml/c)
|
|
add_subdirectory(spine-sfml/cpp)
|
|
elseif((${SPINE_SDL}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-sdl"))
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
set(CMAKE_OSX_ARCHITECTURES x86_64;arm64)
|
|
set(ONLY_ACTIVE_ARCH NO)
|
|
endif()
|
|
add_subdirectory(spine-c)
|
|
add_subdirectory(spine-cpp)
|
|
add_subdirectory(spine-sdl)
|
|
else()
|
|
add_subdirectory(spine-c)
|
|
add_subdirectory(spine-cpp)
|
|
if (${BUILD_TESTING})
|
|
add_subdirectory(spine-cpp/spine-cpp-unit-tests)
|
|
endif()
|
|
endif()
|
|
|
|
# Create config file that include the exported targets
|
|
configure_file(SpineConfig.cmake.in
|
|
"${CMAKE_CURRENT_BINARY_DIR}/SpineConfig.cmake"
|
|
@ONLY) |