forked from beefviper/hode-vs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
75 lines (65 loc) · 2.41 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
63
64
65
66
67
68
69
70
71
72
73
74
75
project(hode)
cmake_minimum_required(VERSION 3.0)
include(FindPkgConfig)
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "-pedantic -MMD ${CMAKE_CXX_FLAGS}")
if(CMAKE_BUILD_TYPE MATCHES "Deb")
set (CMAKE_CXX_FLAGS "-g ${CMAKE_CXX_FLAGS}")
endif()
endif()
set(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}")
if(VITA)
set(ENV{PKG_CONFIG_PATH} "$ENV{VITASDK}/arm-vita-eabi/lib/pkgconfig")
endif(VITA)
if(MSVC)
find_package(SDL2 CONFIG REQUIRED)
find_path(DIRENT_INCLUDE_DIRS "dirent.h")
find_path(GETOPT_INCLUDE_DIRS "getopt.h")
find_library(GETOPT_LIBRARY getopt)
elseif(APPLE)
find_package(SDL2 REQUIRED)
else(MSVC)
pkg_check_modules(SDL2 sdl2 REQUIRED)
endif(MSVC)
include_directories(
${SDL2_INCLUDE_DIRS}
)
file(GLOB SRC *.cpp)
list(FILTER SRC EXCLUDE REGEX ".*android.cpp|system_psp.cpp|system_wii.cpp")
add_executable(${CMAKE_PROJECT_NAME}
${SRC}
)
if(MSVC)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE SDL2::SDL2 SDL2::SDL2main)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${DIRENT_INCLUDE_DIRS})
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${GETOPT_INCLUDE_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${GETOPT_LIBRARY})
elseif(APPLE)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE SDL2::SDL2)
else(MSVC)
target_link_libraries(${CMAKE_PROJECT_NAME} ${SDL2_STATIC_LIBRARIES})
endif(MSVC)
if(NSWITCH)
add_definitions(-D__SWITCH__)
add_custom_target(${CMAKE_PROJECT_NAME}.nro
DEPENDS ${CMAKE_PROJECT_NAME}
COMMAND nacptool --create "Heart of Darkness" "cyx, usineur" "0.2.9f" ${CMAKE_PROJECT_NAME}.nacp
COMMAND elf2nro ${CMAKE_PROJECT_NAME} ${CMAKE_PROJECT_NAME}.nro --icon=${CMAKE_SOURCE_DIR}/3p/res/icon.jpg --nacp=${CMAKE_PROJECT_NAME}.nacp
)
add_custom_target(nxlink
COMMAND nxlink -a $(SWITCHIP) ${CMAKE_PROJECT_NAME}.nro -s -p ${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}.nro
DEPENDS ${CMAKE_PROJECT_NAME}.nro
)
endif(NSWITCH)
if(VITA)
include("${VITASDK}/share/vita.cmake" REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fpermissive")
vita_create_self(eboot.bin ${CMAKE_PROJECT_NAME} UNSAFE)
vita_create_vpk(${CMAKE_PROJECT_NAME}.vpk "HODEVITA1" eboot.bin
NAME ${CMAKE_PROJECT_NAME}
FILE 3p/res/icon0.png sce_sys/icon0.png
FILE 3p/res/bg.png sce_sys/livearea/contents/bg.png
FILE 3p/res/startup.png sce_sys/livearea/contents/startup.png
FILE 3p/res/template.xml sce_sys/livearea/contents/template.xml
)
endif(VITA)