69 lines
2.6 KiB
CMake
Executable File
69 lines
2.6 KiB
CMake
Executable File
cmake_minimum_required(VERSION 3.10)
|
|
|
|
project(calamitycobra C)
|
|
|
|
set_target_properties(PROPERTIES LINKER_LANGUAGE C)
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/src)
|
|
|
|
file(GLOB src
|
|
"${PROJECT_SOURCE_DIR}/src/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/engine/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ending/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/gui/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/info/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/intro/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/collectible/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/enemy/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/gui/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/message/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/pause/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/player/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/shadow/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/spawn/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/tutorial/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/play/wave/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/results/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/results/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/scene/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/title/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/sdl/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/util/*.c"
|
|
)
|
|
|
|
add_executable(calamitycobra ${src})
|
|
|
|
if (EMSCRIPTEN)
|
|
set (CMAKE_C_FLAGS "-O2 --preload-file res --use-preload-plugins -s NO_DYNAMIC_EXECUTION=1 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=1 -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0 -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='['png']' -s USE_SDL_MIXER=2 -s SDL2_MIXER_FORMATS='['ogg']' -s USE_SDL_TTF=2")
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
set (CMAKE_C_FLAGS "-DDEBUG -g -Wno-unused-command-line-argument" ${CMAKE_C_FLAGS})
|
|
else()
|
|
set (CMAKE_BUILD_TyPE "Release")
|
|
endif()
|
|
|
|
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
|
else()
|
|
set (CMAKE_C_FLAGS "-O2")
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
set (CMAKE_C_FLAGS "-DDEBUG -g -O2 -Wno-unused-variable -Wno-unused-parameter -Wall -Wextra -pedantic" ${CMAKE_C_FLAGS})
|
|
else()
|
|
set (CMAKE_BUILD_TYPE "Release")
|
|
endif()
|
|
|
|
if (WIN32)
|
|
set (CMAKE_C_FLAGS "-mwindows ${CMAKE_C_FLAGS}")
|
|
target_link_libraries(${PROJECT_NAME} mingw32 m SDL2main SDL2 SDL2_ttf SDL2_image SDL2_mixer)
|
|
else()
|
|
target_link_libraries(${PROJECT_NAME} m SDL2 SDL2_ttf SDL2_image SDL2_mixer)
|
|
endif()
|
|
endif()
|
|
|
|
message("System: ${CMAKE_SYSTEM_NAME}")
|
|
message("Project: ${PROJECT_NAME}")
|
|
message("Build: ${CMAKE_BUILD_TYPE}")
|
|
message("Flags: ${CMAKE_C_FLAGS}")
|