mirror of
https://github.com/GayPizzaSpecifications/padlab.git
synced 2025-08-03 05:10:56 +00:00
31 lines
981 B
CMake
31 lines
981 B
CMake
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
|
|
project(padlab C)
|
|
set(TARGET padlab)
|
|
|
|
set(GFX_BACKEND "OPENGL_LEGACY" CACHE STRING "Graphics API to render with: \"SDL\", \"OPENGL_LEGACY\" 1.1 compatibility profile, \"OPENGL\" 3.3 core profile (WIP), \"METAL\"")
|
|
|
|
set(GL_BACKENDS OPENGL_LEGACY OPENGL)
|
|
set(BACKENDS SDL ${GL_BACKENDS} METAL)
|
|
if (NOT GFX_BACKEND IN_LIST BACKENDS)
|
|
message(FATAL_ERROR "\"${GFX_BACKEND}\" is not a valid graphics backend, GFX_BACKEND may be one of: ${BACKENDS}")
|
|
endif()
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(GNU_COMPILERS GNU Clang AppleClang)
|
|
if (CMAKE_C_COMPILER_ID IN_LIST GNU_COMPILERS)
|
|
set(GNU 1)
|
|
elseif (MSVC)
|
|
string(REPLACE "/W3" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
|
endif()
|
|
|
|
find_package(SDL2 REQUIRED)
|
|
if (GFX_BACKEND IN_LIST GL_BACKENDS)
|
|
if (NOT DEFINED OpenGL_GL_PREFERENCE)
|
|
set(OpenGL_GL_PREFERENCE "GLVND")
|
|
endif()
|
|
find_package(OpenGL REQUIRED)
|
|
endif()
|
|
|
|
add_subdirectory(src)
|