-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
62 lines (51 loc) · 1.66 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
cmake_minimum_required(VERSION 3.16)
project(laserkombat)
include(FindPkgConfig)
pkg_search_module(SDL2 REQUIRED sdl2)
pkg_search_module(SDL2_TTF REQUIRED SDL2_ttf)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fpermissive")
file(GLOB SOURCES
${PROJECT_SOURCE_DIR}/src/*.cpp
)
if(WIN32)
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/platform/windows/appicon.rc)
else()
add_executable(${PROJECT_NAME} ${SOURCES})
endif()
# Link SDL2main for systems which need it
if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2main)
endif()
# Set the build static option
SET(BUILD_STATIC_DEFAULT OFF)
if(WIN32 OR VITA)
SET(BUILD_STATIC_DEFAULT ON)
endif()
option(BUILD_STATIC "Build a static binary" ${BUILD_STATIC_DEFAULT})
if(BUILD_STATIC)
set(CMAKE_CXX_FLAGS "-static ${CMAKE_CXX_FLAGS}")
target_link_libraries(${PROJECT_NAME} PRIVATE ${SDL2_STATIC_LIBRARIES} ${SDL2_TTF_STATIC_LIBRARIES})
else()
target_link_libraries(${PROJECT_NAME} PRIVATE ${SDL2_LIBRARIES} ${SDL2_TTF_LIBRARIES})
endif()
include_directories(
${PROJECT_SOURCE_DIR}/include
${SDL2_INCLUDE_DIRS}
${SDL2_TTF_INCLUDE_DIRS}
)
if(VITA)
include("$ENV{VITASDK}/share/vita.cmake" REQUIRED)
vita_create_self(${PROJECT_NAME}.self ${PROJECT_NAME})
vita_create_vpk(${PROJECT_NAME}.vpk "LKRE00001" ${PROJECT_NAME}.self
VERSION "01.00"
NAME "Laser Kombat"
FILE platform/vita/sce_sys sce_sys
FILE README.md README.md
FILE COPYING COPYING
FILE assets assets
)
else()
file(COPY assets DESTINATION ${CMAKE_BINARY_DIR})
endif()