-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
44 lines (32 loc) · 1.5 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
cmake_minimum_required(VERSION 3.26)
project(squasher_LD54)
set(CMAKE_CXX_STANDARD 20)
if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -sUSE_SDL_TTF=2 -sSDL2_IMAGE_FORMATS=\"png\"")
include_directories("C:\\Users\\Pawel\\Desktop\\emsdk-3.1.51\\upstream\\emscripten\\cache\\sysroot\\include")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -static-libstdc++ -static-libgcc")
endif ()
if (${WIN32})
set(SDL2_INCLUDE_DIR C:/SDL2_64/include)
set(SDL2_LIB_DIR C:/SDL2_64/lib)
include_directories(${SDL2_INCLUDE_DIR})
link_directories(${SDL2_LIB_DIR})
endif ()
file(
GLOB SOURCES LIST_DIRECTORIES false
${CMAKE_CURRENT_LIST_DIR}/source/*.cpp
)
add_executable(squasher_LD54 ${SOURCES})
set_target_properties(squasher_LD54 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/bin")
if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
set(DATA_DIR "\"${CMAKE_CURRENT_LIST_DIR}/data/\"")
set(HIGHSCR_FILE "\"${CMAKE_CURRENT_LIST_DIR}/bin/highscore.txt\"@highscore.txt")
set_target_properties(squasher_LD54 PROPERTIES LINK_FLAGS " --preload-file ${DATA_DIR}@data/ --preload-file ${HIGHSCR_FILE}")
endif ()
if (${WIN32})
target_link_libraries(squasher_LD54 mingw32 SDL2main SDL2 SDL2_image SDL2_ttf)
elseif (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
target_link_libraries(squasher_LD54 SDL2main SDL2 SDL2_image SDL2_ttf)
endif ()