61 lines
2.7 KiB
CMake
61 lines
2.7 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
project(frillrun)
|
|
|
|
include_directories(include)
|
|
include_directories(${PROJECT_SOURCE_DIR}/src)
|
|
|
|
file(GLOB src
|
|
"${PROJECT_SOURCE_DIR}/include/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/engine/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/component/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/component/animation/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/component/game/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/component/physics/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/component/ui/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/component/utility/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/component/visual/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/entity/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/entity/game/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/entity/ui/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/entity/utility/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/ecs/entity/visual/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/input/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/render/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/resource/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/state/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/state/level/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/state/title/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/state/cutscene/*.c"
|
|
"${PROJECT_SOURCE_DIR}/src/game/state/ending/*.c"
|
|
)
|
|
|
|
add_executable(${PROJECT_NAME} ${src})
|
|
|
|
set (CMAKE_C_FLAGS "-O2 -Wall -Wextra -pedantic -Wno-unused-variable -Wno-unused-parameter -Wno-discarded-qualifiers -Wno-parantheses")
|
|
|
|
if (EMSCRIPTEN)
|
|
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -sFULL_ES2 -sFULL_ES3 -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS='['png']' -sUSE_SDL_MIXER=2 -sSDL2_MIXER_FORMATS='['ogg']' -sUSE_SDL_TTF=2")
|
|
add_link_options(" --preload-file res --use-preload-plugins sNO_DYNAMIC_EXECUTION=1 -sALLOW_MEMORY_GROWTH=1 -sASSERTIONS=1 -sDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0")
|
|
elseif (WIN32)
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mwindows")
|
|
target_link_libraries(${PROJECT_NAME} mingw32 m SDL2main SDL2 SDL2_image SDL2_mixer SDL2_ttf opengl32 glew32)
|
|
elseif (UNIX)
|
|
target_link_libraries(${PROJECT_NAME} m SDL2 SDL2_image SDL2_mixer SDL2_ttf GL GLEW)
|
|
endif()
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDEBUG -g")
|
|
else()
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
endif()
|
|
|
|
message("System: ${CMAKE_SYSTEM_NAME}")
|
|
message("Project: ${PROJECT_NAME}")
|
|
message("Build: ${CMAKE_BUILD_TYPE}")
|
|
message("Flags: ${CMAKE_C_FLAGS}")
|