Merge branch '4.1' into 4.2-beta

This commit is contained in:
Mario Zechner 2022-08-06 18:43:02 +02:00
commit 0f3e75b56e
8 changed files with 15 additions and 17 deletions

View File

@ -11,8 +11,8 @@ if(MSVC)
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-c++11-long-long -Wno-variadic-macros -Wextra -pedantic -Wnonportable-include-path -Wshadow -std=c89")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunused-value -Wno-c++11-long-long -Wno-variadic-macros -Wextra -Wnon-virtual-dtor -pedantic -Wnonportable-include-path -Wshadow -std=c++11 -fno-exceptions -fno-rtti")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wunused-value -Wno-variadic-macros -Wextra -pedantic -Wshadow -std=c89")
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")

View File

@ -16,20 +16,22 @@ FetchContent_MakeAvailable(SDL)
include_directories(src)
add_library(spine-sdl-c STATIC src/spine-sdl-c.c src/spine-sdl-c.h src/stb_image.h)
target_link_libraries(spine-sdl-c LINK_PUBLIC SDL2 spine-c)
target_link_libraries(spine-sdl-c LINK_PUBLIC SDL2-static spine-c)
install(TARGETS spine-sdl-c DESTINATION dist/lib)
install(FILES src/spine-sdl-c.h src/stb_image.h DESTINATION dist/include)
add_library(spine-sdl-cpp STATIC src/spine-sdl-cpp.cpp src/spine-sdl-cpp.h src/stb_image.h)
target_link_libraries(spine-sdl-cpp LINK_PUBLIC SDL2 spine-cpp)
target_link_libraries(spine-sdl-cpp LINK_PUBLIC SDL2-static spine-cpp)
install(TARGETS spine-sdl-cpp DESTINATION dist/lib)
install(FILES src/spine-sdl-cpp.h src/stb_image.h DESTINATION dist/include)
add_executable(spine-sdl-c-example example/main.c)
target_link_libraries(spine-sdl-c-example SDL2 spine-sdl-c)
target_link_libraries(spine-sdl-c-example SDL2-static spine-sdl-c)
set_property(TARGET spine-sdl-c-example PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/spine-sdl")
add_executable(spine-sdl-cpp-example example/main.cpp)
target_link_libraries(spine-sdl-cpp-example SDL2 spine-sdl-cpp)
target_link_libraries(spine-sdl-cpp-example SDL2-static spine-sdl-cpp)
set_property(TARGET spine-sdl-cpp-example PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/spine-sdl")
# copy data to build directory
add_custom_command(TARGET spine-sdl-c-example PRE_BUILD

View File

@ -38,9 +38,7 @@ The Spine SFML example works on Windows, Linux and Mac OS X. For a spine-c based
6. Click `Browse Build` and select the `spine-runtimes/spine-sdl/build` directory. You can create the `build` folder directly in the file dialog via `New Folder`.
7. Click `Configure`. Then click `Generate`. This will create a Visual Studio solution file called `spine.sln` in `spine-runtimes/spine-sdl/build` and also download the SDL dependencies.
8. Open the `spine.sln` file in Visual Studio
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)`
9. Right click the `spine-sdl-example-c` or `spine-sdl-example-cpp` project in the solution explorer and select `Set as Startup Project` from the context menus
12. Click `Local Windows Debugger` to run the example
The entire example code is contained in [main.cpp](example/main.cpp#L61)

View File

@ -29,6 +29,7 @@
#include <spine-sdl-c.h>
#include <SDL.h>
#undef main
int main() {
if (SDL_Init(SDL_INIT_VIDEO)) {

View File

@ -29,8 +29,9 @@
#include <spine-sdl-cpp.h>
#include <SDL.h>
#undef main
int main() {
int main(int argc, char **argv) {
if (SDL_Init(SDL_INIT_VIDEO)) {
printf("Error: %s", SDL_GetError());
return -1;

View File

@ -30,7 +30,6 @@
#include "spine-sdl-c.h"
#include <spine/spine.h>
#include <spine/extension.h>
#include <SDL.h>
#define STB_IMAGE_IMPLEMENTATION

View File

@ -32,13 +32,12 @@
#include <spine/spine.h>
#include <SDL.h>
#ifdef __cplusplus
extern "C" {
#endif
struct SDL_Renderer;
struct SDL_Texture;
struct SDL_Vertex;
_SP_ARRAY_DECLARE_TYPE(spSdlVertexArray, struct SDL_Vertex)
typedef struct spSkeletonDrawable {

View File

@ -31,9 +31,7 @@
#define SPINE_SDL
#include <spine/spine.h>
struct SDL_Renderer;
struct SDL_Vertex;
#include <SDL.h>
namespace spine {
class SkeletonDrawable {