Skip to content

Commit

Permalink
[sfml] Refactor CMake build
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Jun 30, 2024
1 parent 63d8296 commit 70af9d8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
8 changes: 7 additions & 1 deletion spine-c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
cmake_minimum_required(VERSION 3.10)
project(spine-c)

include(${CMAKE_CURRENT_LIST_DIR}/../flags.cmake)

include_directories(include)
file(GLOB INCLUDES "spine-c/include/**/*.h")
file(GLOB SOURCES "spine-c/src/**/*.c" "spine-c/src/**/*.cpp")
file(GLOB SOURCES "spine-c/src/**/*.c")

add_library(spine-c STATIC ${SOURCES} ${INCLUDES})
target_include_directories(spine-c PUBLIC spine-c/include)

install(TARGETS spine-c DESTINATION dist/lib)
install(FILES ${INCLUDES} DESTINATION dist/include)
2 changes: 1 addition & 1 deletion spine-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.10)
project(spine-cpp)

include(${CMAKE_SOURCE_DIR}/../flags.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../flags.cmake)

include_directories(include)
file(GLOB INCLUDES "spine-cpp/include/**/*.h")
Expand Down
2 changes: 1 addition & 1 deletion spine-sdl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(spine-glfw)
project(spine-sdl)

# Default flags
include(${CMAKE_SOURCE_DIR}/../flags.cmake)
Expand Down
8 changes: 8 additions & 0 deletions spine-sfml/c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
cmake_minimum_required(VERSION 3.10)
project(spine-sfml)

# Default flags
include(${CMAKE_CURRENT_LIST_DIR}/../../flags.cmake)
#
# First download and extract SFML 2.5.1 for the respective OS we are on
#
Expand Down Expand Up @@ -44,6 +49,9 @@ else()
endif()
endif()

# Add spine-c
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../../spine-c ${CMAKE_BINARY_DIR}/spine-c-build)

# Define spine-sfml library
include_directories(src ${SFML_DIR}/include)
file(GLOB INCLUDES "src/**/*.h")
Expand Down
16 changes: 8 additions & 8 deletions spine-sfml/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
cmake_minimum_required(VERSION 3.10)
project(spine-sfml)

# Default flags
include(${CMAKE_CURRENT_LIST_DIR}/../../flags.cmake)

#
# First download and extract SFML 2.6.1 for the respective OS we are on
#
Expand Down Expand Up @@ -44,14 +50,8 @@ else()
endif()
endif()

if(MSVC)
message("MSCV detected")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
else()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -pedantic -std=c++11 -fno-exceptions -fno-rtti")
endif()
# Add spine-cpp
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../../spine-cpp ${CMAKE_BINARY_DIR}/spine-cpp-build)

# Define spine-sfml-cpp library
include_directories(src ${SFML_DIR}/include)
Expand Down

0 comments on commit 70af9d8

Please sign in to comment.