Sdlpp: move to cmake
This commit is contained in:
parent
fe157494ec
commit
509e5e36c2
25
sdlpp/CMakeLists.txt
Normal file
25
sdlpp/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
project(libsdlpp)
|
||||
|
||||
add_library(sdlpp STATIC
|
||||
sdlpp_circlecolider.cpp
|
||||
sdlpp_circlerenderer.cpp
|
||||
sdlpp_collision.cpp
|
||||
sdlpp_common.cpp
|
||||
sdlpp_font.cpp
|
||||
sdlpp_linerenderer.cpp
|
||||
sdlpp_rectcolider.cpp
|
||||
sdlpp_rectrenderer.cpp
|
||||
sdlpp_renderer.cpp
|
||||
sdlpp_renderobject.cpp
|
||||
sdlpp_scene.cpp
|
||||
sdlpp_textrenderer.cpp
|
||||
sdlpp_texture.cpp
|
||||
sdlpp_window.cpp
|
||||
sdlpp_fontconfiguration.cpp
|
||||
sdlpp_mouse.cpp
|
||||
)
|
@ -1,64 +0,0 @@
|
||||
MAJOR ?= 1
|
||||
MINOR ?= 0
|
||||
RELEASE ?= 0
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
UNAME_S := Windows
|
||||
CXX = cl
|
||||
CXXFLAGS = -MD -EHsc /DDLLEXPORT
|
||||
OBJEXT = obj
|
||||
RM = del
|
||||
else
|
||||
UNAME_S := $(shell uname -s)
|
||||
CXX ?= g++
|
||||
CXXFLAGS = -std=c++14 -Wall -Wextra -pedantic -g
|
||||
OBJEXT = o
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
SDLPPLIBRARY = libsdlpp.a
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
SDLPPLIBRARY = libsdlpp.a
|
||||
endif
|
||||
ifeq ($(UNAME_S),Windows)
|
||||
SDLPPLIBRARY = libsdlpp.dll
|
||||
endif
|
||||
|
||||
OBJECTFILES = sdlpp_circlecolider.${OBJEXT} sdlpp_circlerenderer.${OBJEXT} sdlpp_collision.${OBJEXT} sdlpp_common.${OBJEXT} sdlpp_font.${OBJEXT} sdlpp_linerenderer.${OBJEXT} sdlpp_rectcolider.${OBJEXT} sdlpp_rectrenderer.${OBJEXT} sdlpp_renderer.${OBJEXT} sdlpp_renderobject.${OBJEXT} sdlpp_scene.${OBJEXT} sdlpp_textrenderer.${OBJEXT} sdlpp_texture.${OBJEXT} sdlpp_window.${OBJEXT} sdlpp_fontconfiguration.${OBJEXT} sdlpp_mouse.${OBJEXT}
|
||||
|
||||
all: ${SDLPPLIBRARY}
|
||||
|
||||
ifeq ($(UNAME_S),Windows)
|
||||
%.${OBJEXT}: %.cpp
|
||||
${CXX} ${CXXFLAGS} /c $< /Fo"$@"
|
||||
else
|
||||
%.${OBJEXT}: %.cpp
|
||||
${CXX} ${CXXFLAGS} -c $< -o $@
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
${SDLPPLIBRARY}: ${OBJECTFILES}
|
||||
${CXX} ${CXXFLAGS} -shared -Wl,-soname,libsdlpp.so.${MAJOR}\
|
||||
-o ${SDLPPLIBRARY} $^
|
||||
ln -sf ${SDLPPLIBRARY} libsdlpp.so
|
||||
ln -sf ${SDLPPLIBRARY} libsdlpp.so.${MAJOR}
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
${SDLPPLIBRARY}: ${OBJECTFILES}
|
||||
${CXX} ${CXXFLAGS} -dynamiclib -install_name ${SDLPPLIBRARY}\
|
||||
-current_version ${MAJOR}.${MINOR} $^ -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -o $@
|
||||
endif
|
||||
ifeq ($(UNAME_S),Windows)
|
||||
${SDLPPLIBRARY}: ${OBJECTFILES}
|
||||
${CXX} /LD $^ /link SDL2.lib SDL2_ttf.lib SDL2_image.lib /OUT:$@ /IMPLIB:libsdlpp.lib
|
||||
endif
|
||||
|
||||
libsdlpp.a: ${OBJECTFILES}
|
||||
ar ruv $@ $^
|
||||
ranlib $@
|
||||
|
||||
clean:
|
||||
${RM} *.so* *.${OBJEXT} *.dylib libsdlpp*
|
||||
|
||||
.PHONY: all clean test
|
Loading…
Reference in New Issue
Block a user