orbit-plus/CMakeLists.txt

47 lines
1.5 KiB
CMake
Raw Normal View History

2023-02-12 04:18:45 +00:00
cmake_minimum_required(VERSION 3.10)
project(orbit-plus C)
set_target_properties(PROPERTIES LINKER_LANGUAGE C)
include_directories(include)
include_directories(${GLEW_INCLUDE_DIRS})
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/ecs/*.c"
"${PROJECT_SOURCE_DIR}/src/game/state/*.c"
"${PROJECT_SOURCE_DIR}/src/game/shader/*.c"
"${PROJECT_SOURCE_DIR}/src/util/*.c"
)
add_executable(${PROJECT_NAME} ${src})
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer REQUIRED)
find_package(SDL2_ttf REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(GLEW REQUIRED)
2023-08-08 06:22:51 +00:00
find_package(OpenGL REQUIRED)
2023-02-12 04:18:45 +00:00
2023-02-12 04:39:47 +00:00
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "-O2 -Wno-discarded-qualifiers -Wno-pointer-arith -Wno-unused-variable -Wno-unused-parameter -Wall -Wextra -pedantic -g")
2023-02-12 04:18:45 +00:00
else()
2023-02-12 04:39:47 +00:00
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_C_FLAGS "-O2 -Wno-discarded-qualifiers -Wno-pointer-arith -Wno-unused-variable -Wno-unused-parameter -Wall -Wextra -pedantic")
endif()
2023-08-08 06:22:51 +00:00
target_link_libraries(${PROJECT_NAME} m SDL2::SDL2 SDL2_mixer::SDL2_mixer SDL2_ttf::SDL2_ttf SDL2_image::SDL2_image GLEW::GLEW OpenGL::GL)
2023-02-12 04:39:47 +00:00
if (WIN32)
set(CMAKE_C_FLAGS "-mwindows ${CMAKE_C_FLAGS}")
2023-06-01 01:31:44 +00:00
target_link_libraries(${PROJECT_NAME} mingw32 m SDL2::SDL2 SDL2_mixer::SDL2_mixer SDL2_ttf::SDL2_ttf SDL2_image::SDL2_image GLEW::GLEW)
2023-02-12 04:18:45 +00:00
endif()
message("System: ${CMAKE_SYSTEM_NAME}")
message("Project: ${PROJECT_NAME}")
message("Build: ${CMAKE_BUILD_TYPE}")
message("Flags: ${CMAKE_C_FLAGS}")