mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 01:06:00 +08:00
[sfml] Refactor CMake build
This commit is contained in:
parent
3a83495e5b
commit
e81ad9072d
@ -11,6 +11,18 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/../spine-c ${CMAKE_BINARY_DIR}/spine-c)
|
||||
# SDL
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(SDL GIT_REPOSITORY https://github.com/libsdl-org/SDL GIT_TAG release-2.30.2)
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
set(SDL_SHARED OFF)
|
||||
set(SDL_STATIC ON)
|
||||
set(SDL_TEST OFF)
|
||||
set(SDL_EXAMPLES OFF)
|
||||
set(SDL_INSTALL OFF)
|
||||
set(SDL_TESTS OFF)
|
||||
set(SDL_TESTS_BUILD OFF)
|
||||
set(SDL_TESTS_BUILD_C OFF)
|
||||
set(SDL_TESTS_BUILD_CPP OFF)
|
||||
set(SDL_TESTS_BUILD_JOYSTICK OFF)
|
||||
set(SDL_TESTS_BUILD_RENDERER OFF)
|
||||
FetchContent_MakeAvailable(SDL)
|
||||
|
||||
include_directories(src)
|
||||
|
||||
@ -3,94 +3,40 @@ 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
|
||||
#
|
||||
set(DEPS_DIR "${CMAKE_CURRENT_LIST_DIR}/dependencies/")
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(CMAKE_OSX_ARCHITECTURES x86_64)
|
||||
set(ONLY_ACTIVE_ARCH NO)
|
||||
set(SFML_URL "https://www.sfml-dev.org/files/SFML-2.6.1-macOS-clang-64-bit.tar.gz")
|
||||
set(SFML_DIR ${DEPS_DIR}/SFML-2.6.1-macOS-clang-64-bit)
|
||||
if (NOT EXISTS "${SFML_DIR}")
|
||||
message("Downloading SFML for Mac OS X")
|
||||
file(DOWNLOAD "${SFML_URL}" "${DEPS_DIR}/sfml.tar.gz")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DIR}/sfml.tar.gz
|
||||
WORKING_DIRECTORY ${DEPS_DIR}
|
||||
)
|
||||
# copy freetype over to Frameworks/ so rpath resoultion works
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${SFML_DIR}/extlibs/freetype.framework ${SFML_DIR}/Frameworks/freetype.framework
|
||||
WORKING_DIRECTORY ${SFML_DIR}
|
||||
)
|
||||
endif()
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(SFML_URL "https://www.sfml-dev.org/files/SFML-2.5.1-linux-gcc-64-bit.tar.gz")
|
||||
set(SFML_DIR ${DEPS_DIR}/SFML-2.5.1)
|
||||
if (NOT EXISTS ${SFML_DIR})
|
||||
message("Downloading SFML for Linux 64-bit")
|
||||
file(DOWNLOAD "${SFML_URL}" "${DEPS_DIR}/sfml.tar.gz")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DIR}/sfml.tar.gz
|
||||
WORKING_DIRECTORY ${DEPS_DIR}
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set(SFML_URL "https://www.sfml-dev.org/files/SFML-2.6.1-windows-vc17-64-bit.zip")
|
||||
set(SFML_DIR ${DEPS_DIR}/SFML-2.6.1)
|
||||
if (NOT EXISTS ${SFML_DIR})
|
||||
message("Downloading SFML for Windows 64-bit")
|
||||
file(DOWNLOAD "${SFML_URL}" "${DEPS_DIR}/sfml.zip")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar x ${DEPS_DIR}/sfml.zip
|
||||
WORKING_DIRECTORY ${DEPS_DIR}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# SFML
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(SFML GIT_REPOSITORY https://github.com/SFML/SFML GIT_TAG 2.6.1)
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
FetchContent_MakeAvailable(SFML)
|
||||
|
||||
# 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")
|
||||
file(GLOB SOURCES "src/**/*.cpp")
|
||||
add_library(spine-sfml STATIC ${SOURCES} ${INCLUDES})
|
||||
target_link_libraries(spine-sfml LINK_PUBLIC spine-c)
|
||||
install(TARGETS spine-sfml DESTINATION dist/lib)
|
||||
install(FILES ${INCLUDES} DESTINATION dist/include)
|
||||
# Define spine-sfml-c library
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/src ${SFML_SOURCE_DIR}/include)
|
||||
file(GLOB INCLUDES "${CMAKE_CURRENT_LIST_DIR}/src/**/*.h")
|
||||
file(GLOB SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/**/*.cpp")
|
||||
add_library(spine-sfml-c STATIC ${SOURCES} ${INCLUDES})
|
||||
target_link_libraries(spine-sfml-c LINK_PUBLIC spine-c sfml-graphics sfml-window sfml-system)
|
||||
|
||||
# Define spine-sfml example executable
|
||||
add_executable(spine-sfml-example example/main.cpp)
|
||||
# Define spine-sfml-c example executable
|
||||
add_executable(spine-sfml-c-example example/main.cpp)
|
||||
target_link_libraries(spine-sfml-c-example spine-c spine-sfml-c)
|
||||
|
||||
# Link in SFML libraries and OS dependencies like OpenGL
|
||||
# Link in OS dependencies like OpenGL
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
find_library(SFML SFML PATHS ${SFML_DIR}/Frameworks)
|
||||
find_library(SFML_SYSTEM "sfml-system" PATHS ${SFML_DIR}/Frameworks)
|
||||
find_library(SFML_WINDOW sfml-window PATHS ${SFML_DIR}/Frameworks)
|
||||
find_library(SFML_GRAPHICS sfml-graphics PATHS ${SFML_DIR}/Frameworks)
|
||||
target_link_libraries(spine-sfml-example ${SFML} ${SFML_SYSTEM} ${SFML_WINDOW} ${SFML_GRAPHICS})
|
||||
find_library(COCOA_FRAMEWORK Cocoa)
|
||||
find_library(OPENGL_FRAMEWORK OpenGL)
|
||||
target_link_libraries(spine-sfml-c-example ${COCOA_FRAMEWORK} ${OPENGL_FRAMEWORK})
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
target_link_libraries(spine-sfml-example sfml-graphics sfml-window sfml-system)
|
||||
target_link_libraries(spine-sfml-c-example GL)
|
||||
else()
|
||||
set(SFML_LIBS ${SFML_DIR}/lib)
|
||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/sfml-main-d.lib)
|
||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/sfml-graphics-s-d.lib)
|
||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/sfml-window-s-d.lib)
|
||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/sfml-system-s-d.lib)
|
||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/freetype.lib)
|
||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/jpeg.lib)
|
||||
target_link_libraries(spine-sfml-example opengl32)
|
||||
target_link_libraries(spine-sfml-example gdi32)
|
||||
target_link_libraries(spine-sfml-example winmm)
|
||||
target_link_libraries(spine-sfml-c-example opengl32 gdi32 winmm)
|
||||
add_definitions(-DSFML_STATIC)
|
||||
endif()
|
||||
|
||||
# copy data to build directory
|
||||
add_custom_command(TARGET spine-sfml-example PRE_BUILD
|
||||
add_custom_command(TARGET spine-sfml-c-example PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_CURRENT_LIST_DIR}/data $<TARGET_FILE_DIR:spine-sfml-example>/data)
|
||||
|
||||
target_link_libraries(spine-sfml-example spine-c)
|
||||
target_link_libraries(spine-sfml-example spine-sfml)
|
||||
${CMAKE_CURRENT_LIST_DIR}/data $<TARGET_FILE_DIR:spine-sfml-c-example>/data)
|
||||
|
||||
@ -22,7 +22,7 @@ spine-sfml supports all Spine features except two color tinting.
|
||||
|
||||
1. Create a new SFML project. See the [SFML documentation](http://www.sfml-dev.org/tutorials/2.1/) or have a look at the example in this repository.
|
||||
2. Download the Spine Runtimes source using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
||||
3. Add the sources from `spine-c/spine-c/src/spine` and `spine-sfml/src/spine` to your project
|
||||
3. Add the sources from `spine-c/spine-c/src/spine` and `spine-sfml/src/c/spine` to your project
|
||||
4. Add the folder `spine-c/spine-c/include` to your header search path. Note that includes are specified as `#inclue <spine/file.h>`, so the `spine` directory cannot be omitted when copying the source files.
|
||||
|
||||
See the [Spine Runtimes documentation](http://esotericsoftware.com/spine-documentation#runtimesTitle) on how to use the APIs or check out the Spine SFML example.
|
||||
@ -33,18 +33,8 @@ The Spine SFML example works on Windows, Linux and Mac OS X.
|
||||
|
||||
### Windows
|
||||
|
||||
1. Install [Visual Studio 2022 Community](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx). Make sure you install support for C++ as well as th Windows SDK for XP/7/8.
|
||||
2. Install CMake via the [Windows installer package](https://cmake.org/download/).
|
||||
3. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
||||
4. Run CMake GUI from the start menu
|
||||
5. Click `Browse Source` and select the directory `spine-runtimes`
|
||||
6. Click `Browse Build` and select the `spine-runtimes/spine-sfml/build` directory. You can create the `build` folder directly in the file dialog via `New Folder`.
|
||||
7. Click `Configure`. Check `SPINE_SFML`. Then click `Generate`. This will create a Visual Studio 2015 solution file called `spine.sln` in `spine-runtimes/spine-sfml/build` and also download the SFML dependencies.
|
||||
8. Open the `spine.sln` file in Visual Studio 2022
|
||||
9. Right click the `spine-sfml-example` project in the solution explorer and select `Set as Startup Project` from the context menu
|
||||
10. Right click the `spine-sfml-example` project in the solution explorer and select `Properties` from the context menu
|
||||
11. Select `Debugging` in the left-hand list, then set `Working Directory` to `$(OutputPath)`
|
||||
12. Click `Local Windows Debugger` to run the example
|
||||
1. Install [Visual Studio 2022 Community](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx). Make sure you install support for C++, CMake, as well as th Windows SDK for XP/7/8.
|
||||
2. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
||||
|
||||
The entire example code is contained in [main.cpp](example/main.cpp#L61)
|
||||
|
||||
@ -53,10 +43,10 @@ The entire example code is contained in [main.cpp](example/main.cpp#L61)
|
||||
1. Install the SFML dependencies, e.g. on Ubuntu/Debian via `sudo apt install libsfml-dev`
|
||||
2. Install CMake, e.g. on Ubuntu/Debian via `sudo apt-get install -y cmake`
|
||||
3. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
||||
4. Open a terminal, and `cd` into the `spine-runtimes/spine-sfml` folder
|
||||
5. Type `mkdir build && cd build && cmake ../..` to generate Make files
|
||||
6. Type `make` to compile the example
|
||||
7. Run the example by `cd spine-sfml && ./spine-sfml-example`
|
||||
4. Open a terminal, and `cd` into the `spine-runtimes/spine-sfml/c` folder
|
||||
5. Type `mkdir build && cd build && cmake ..` to generate Make files
|
||||
6. Type `make -j8` to compile the example
|
||||
7. Run the example by `./spine-sfml-c-example`
|
||||
|
||||
### Mac OS X
|
||||
|
||||
@ -64,11 +54,11 @@ The entire example code is contained in [main.cpp](example/main.cpp#L61)
|
||||
2. Install [Homebrew](http://brew.sh/)
|
||||
3. Open a terminal and install CMake via `brew install cmake`
|
||||
4. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
||||
5. Open a terminal, and `cd` into the `spine-runtimes/spine-sfml` folder
|
||||
6. Type `mkdir build && cd build && cmake -G Xcode ../..` to generate an Xcode project called `spine.xcodeproj`
|
||||
7. Open the Xcode project in `spine-runtimes/spine-sfml/build/`
|
||||
8. In Xcode, set the active scheme from `ALL_BUILD` to `spine-sfml-example`
|
||||
9. Click the `Run` button or type `CMD+R` to run the example
|
||||
5. Open a terminal, and `cd` into the `spine-runtimes/spine-sfml/c` folder
|
||||
6. Type `mkdir build && cd build && cmake -G Xcode ..` to generate an Xcode project called `spine-sfml.xcodeproj`
|
||||
7. Type `open spine-sfml.xcodeproj` to open the Xcode project
|
||||
8. In Xcode, set the active scheme to `spine-sfml-c-example`
|
||||
9. Click the `Run` button or press `CMD+R` to run the example
|
||||
|
||||
## Notes
|
||||
|
||||
|
||||
@ -4,109 +4,50 @@ 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
|
||||
#
|
||||
set(DEPS_DIR "${CMAKE_CURRENT_LIST_DIR}/dependencies/")
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(CMAKE_OSX_ARCHITECTURES x86_64)
|
||||
set(ONLY_ACTIVE_ARCH NO)
|
||||
set(SFML_URL "https://www.sfml-dev.org/files/SFML-2.6.1-macOS-clang-64-bit.tar.gz")
|
||||
set(SFML_DIR ${DEPS_DIR}/SFML-2.6.1-macOS-clang-64-bit)
|
||||
if (NOT EXISTS "${SFML_DIR}")
|
||||
message("Downloading SFML for Mac OS X")
|
||||
file(DOWNLOAD "${SFML_URL}" "${DEPS_DIR}/sfml.tar.gz")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DIR}/sfml.tar.gz
|
||||
WORKING_DIRECTORY ${DEPS_DIR}
|
||||
)
|
||||
# copy freetype over to Frameworks/ so rpath resolution works
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${SFML_DIR}/extlibs/freetype.framework ${SFML_DIR}/Frameworks/freetype.framework
|
||||
WORKING_DIRECTORY ${SFML_DIR}
|
||||
)
|
||||
endif()
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(SFML_URL "https://www.sfml-dev.org/files/SFML-2.5.1-linux-gcc-64-bit.tar.gz")
|
||||
set(SFML_DIR ${DEPS_DIR}/SFML-2.5.1)
|
||||
if (NOT EXISTS ${SFML_DIR})
|
||||
message("Downloading SFML for Linux 64-bit")
|
||||
file(DOWNLOAD "${SFML_URL}" "${DEPS_DIR}/sfml.tar.gz")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DIR}/sfml.tar.gz
|
||||
WORKING_DIRECTORY ${DEPS_DIR}
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set(SFML_URL "https://www.sfml-dev.org/files/SFML-2.6.1-windows-vc17-64-bit.zip")
|
||||
set(SFML_DIR ${DEPS_DIR}/SFML-2.6.1)
|
||||
if (NOT EXISTS ${SFML_DIR})
|
||||
message("Downloading SFML for Windows 64-bit")
|
||||
file(DOWNLOAD "${SFML_URL}" "${DEPS_DIR}/sfml.zip")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar x ${DEPS_DIR}/sfml.zip
|
||||
WORKING_DIRECTORY ${DEPS_DIR}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
# SFML
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(SFML GIT_REPOSITORY https://github.com/SFML/SFML GIT_TAG 2.6.1)
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
FetchContent_MakeAvailable(SFML)
|
||||
|
||||
# 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)
|
||||
file(GLOB INCLUDES "src/**/*.h")
|
||||
file(GLOB SOURCES "src/**/*.cpp")
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/src ${SFML_SOURCE_DIR}/include)
|
||||
file(GLOB INCLUDES "${CMAKE_CURRENT_LIST_DIR}/src/**/*.h")
|
||||
file(GLOB SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/**/*.cpp")
|
||||
add_library(spine-sfml-cpp STATIC ${SOURCES} ${INCLUDES})
|
||||
target_link_libraries(spine-sfml-cpp LINK_PUBLIC spine-cpp)
|
||||
install(TARGETS spine-sfml-cpp DESTINATION dist/lib)
|
||||
install(FILES ${INCLUDES} DESTINATION dist/include)
|
||||
target_link_libraries(spine-sfml-cpp LINK_PUBLIC spine-cpp sfml-graphics sfml-window sfml-system)
|
||||
|
||||
# Define spine-sfml example executable
|
||||
add_executable(spine-sfml-cpp-example example/main.cpp)
|
||||
target_link_libraries(spine-sfml-cpp-example spine-cpp spine-sfml-cpp)
|
||||
add_executable(spine-sfml-cpp-example ${CMAKE_CURRENT_LIST_DIR}/example/main.cpp)
|
||||
target_link_libraries(spine-sfml-cpp-example spine-cpp spine-sfml-cpp sfml-graphics sfml-window sfml-system)
|
||||
|
||||
# Define spine-sfml testbed executable
|
||||
add_executable(spine-sfml-cpp-testbed example/testbed.cpp)
|
||||
target_link_libraries(spine-sfml-cpp-testbed spine-cpp spine-sfml-cpp)
|
||||
add_executable(spine-sfml-cpp-testbed ${CMAKE_CURRENT_LIST_DIR}/example/testbed.cpp)
|
||||
target_link_libraries(spine-sfml-cpp-testbed spine-cpp spine-sfml-cpp sfml-graphics sfml-window sfml-system)
|
||||
|
||||
# Link in SFML libraries and OS dependencies like OpenGL
|
||||
# Link in OS dependencies like OpenGL
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
find_library(SFML SFML PATHS ${SFML_DIR}/Frameworks)
|
||||
find_library(SFML_SYSTEM "sfml-system" PATHS ${SFML_DIR}/Frameworks)
|
||||
find_library(SFML_WINDOW sfml-window PATHS ${SFML_DIR}/Frameworks)
|
||||
find_library(SFML_GRAPHICS sfml-graphics PATHS ${SFML_DIR}/Frameworks)
|
||||
target_link_libraries(spine-sfml-cpp-example ${SFML} ${SFML_SYSTEM} ${SFML_WINDOW} ${SFML_GRAPHICS})
|
||||
target_link_libraries(spine-sfml-cpp-testbed ${SFML} ${SFML_SYSTEM} ${SFML_WINDOW} ${SFML_GRAPHICS})
|
||||
find_library(COCOA_FRAMEWORK Cocoa)
|
||||
find_library(OPENGL_FRAMEWORK OpenGL)
|
||||
target_link_libraries(spine-sfml-cpp-example ${COCOA_FRAMEWORK} ${OPENGL_FRAMEWORK})
|
||||
target_link_libraries(spine-sfml-cpp-testbed ${COCOA_FRAMEWORK} ${OPENGL_FRAMEWORK})
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
target_link_libraries(spine-sfml-cpp-example sfml-graphics sfml-window sfml-system)
|
||||
target_link_libraries(spine-sfml-cpp-testbed sfml-graphics sfml-window sfml-system)
|
||||
target_link_libraries(spine-sfml-cpp-example GL)
|
||||
target_link_libraries(spine-sfml-cpp-testbed GL)
|
||||
else()
|
||||
set(SFML_LIBS ${SFML_DIR}/lib)
|
||||
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/sfml-main-d.lib)
|
||||
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/sfml-graphics-s-d.lib)
|
||||
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/sfml-window-s-d.lib)
|
||||
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/sfml-system-s-d.lib)
|
||||
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/freetype.lib)
|
||||
target_link_libraries(spine-sfml-cpp-example opengl32)
|
||||
target_link_libraries(spine-sfml-cpp-example gdi32)
|
||||
target_link_libraries(spine-sfml-cpp-example winmm)
|
||||
target_link_libraries(spine-sfml-cpp-testbed ${SFML_LIBS}/sfml-main-d.lib)
|
||||
target_link_libraries(spine-sfml-cpp-testbed ${SFML_LIBS}/sfml-graphics-s-d.lib)
|
||||
target_link_libraries(spine-sfml-cpp-testbed ${SFML_LIBS}/sfml-window-s-d.lib)
|
||||
target_link_libraries(spine-sfml-cpp-testbed ${SFML_LIBS}/sfml-system-s-d.lib)
|
||||
target_link_libraries(spine-sfml-cpp-testbed ${SFML_LIBS}/freetype.lib)
|
||||
target_link_libraries(spine-sfml-cpp-testbed opengl32)
|
||||
target_link_libraries(spine-sfml-cpp-testbed gdi32)
|
||||
target_link_libraries(spine-sfml-cpp-testbed winmm)
|
||||
target_link_libraries(spine-sfml-cpp-example opengl32 gdi32 winmm)
|
||||
target_link_libraries(spine-sfml-cpp-testbed opengl32 gdi32 winmm)
|
||||
add_definitions(-DSFML_STATIC)
|
||||
endif()
|
||||
|
||||
# copy data to build directory
|
||||
# Copy data to build directory
|
||||
add_custom_command(TARGET spine-sfml-cpp-example
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_CURRENT_LIST_DIR}/data $<TARGET_FILE_DIR:spine-sfml-cpp-example>/data)
|
||||
|
||||
add_custom_command(TARGET spine-sfml-cpp-testbed
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_CURRENT_LIST_DIR}/data $<TARGET_FILE_DIR:spine-sfml-cpp-example>/data)
|
||||
${CMAKE_CURRENT_LIST_DIR}/data $<TARGET_FILE_DIR:spine-sfml-cpp-testbed>/data)
|
||||
|
||||
@ -22,7 +22,7 @@ spine-sfml supports all Spine features except two color tinting.
|
||||
|
||||
1. Create a new SFML project. See the [SFML documentation](http://www.sfml-dev.org/tutorials/2.1/) or have a look at the example in this repository.
|
||||
2. Download the Spine Runtimes source using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
||||
3. Add the sources from `spine-cpp/spine-cpp/src/spine` and `spine-sfml/src/spine` to your project
|
||||
3. Add the sources from `spine-cpp/spine-cpp/src/spine` and `spine-sfml/cpp/src/spine` to your project
|
||||
4. Add the folder `spine-cpp/spine-cpp/include` to your header search path. Note that includes are specified as `#inclue <spine/file.h>`, so the `spine` directory cannot be omitted when copying the source files.
|
||||
|
||||
See the [Spine Runtimes documentation](http://esotericsoftware.com/spine-documentation#runtimesTitle) on how to use the APIs or check out the Spine SFML example.
|
||||
@ -53,7 +53,7 @@ The entire example code is contained in [main.cpp](example/main.cpp)
|
||||
1. Install the SFML dependencies, e.g. on Ubuntu/Debian via `sudo apt install libsfml-dev`
|
||||
2. Install CMake, e.g. on Ubuntu/Debian via `sudo apt-get install -y cmake`
|
||||
3. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
||||
4. Open a terminal, and `cd` into the `spine-runtimes/spine-sfml` folder
|
||||
4. Open a terminal, and `cd` into the `spine-runtimes/spine-sfml/cpp` folder
|
||||
5. Type `mkdir build && cd build && cmake ../..` to generate Make files
|
||||
6. Type `make` to compile the example
|
||||
7. Run the example by `cd spine-sfml && ./spine-sfml-example`
|
||||
@ -64,11 +64,11 @@ The entire example code is contained in [main.cpp](example/main.cpp)
|
||||
2. Install [Homebrew](http://brew.sh/)
|
||||
3. Open a terminal and install CMake via `brew install cmake`
|
||||
4. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
||||
5. Open a terminal, and `cd` into the `spine-runtimes/spine-sfml` folder
|
||||
6. Type `mkdir build && cd build && cmake -G Xcode ../..` to generate an Xcode project called `spine.xcodeproj`
|
||||
7. Open the Xcode project in `spine-runtimes/spine-sfml/build/`
|
||||
8. In Xcode, set the active scheme from `ALL_BUILD` to `spine-sfml-example`
|
||||
9. Click the `Run` button or type `CMD+R` to run the example
|
||||
5. Open a terminal, and `cd` into the `spine-runtimes/spine-sfml/cpp` folder
|
||||
6. Type `mkdir build && cd build && cmake -G Xcode ..` to generate an Xcode project called `spine-sfml.xcodeproj`
|
||||
7. Type `open spine-sfml.xcodeproj` to open the Xcode project
|
||||
8. In Xcode, set the active scheme to `spine-sfml-cpp-example`
|
||||
9. Click the `Run` button or press `CMD+R` to run the example
|
||||
|
||||
## Notes
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user