Dawn/lib/CMakeLists.txt

54 lines
1.5 KiB
CMake

# Copyright (c) 2021 Dominic Msters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# GLFW
if(DAWN_TARGET_GLFW)
if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
set(DAWN_EMSCRIPTEN_FLAGS "${DAWN_EMSCRIPTEN_FLAGS} -s USE_GLFW=3" CACHE INTERNAL ${DAWN_CACHE_TARGET})
else()
add_subdirectory(glad)
add_subdirectory(glfw)
endif()
endif()
# SDL
if(DAWN_TARGET_SDL2)
add_subdirectory(glad)
add_subdirectory(SDL)
endif()
# GLM
add_subdirectory(glm)
# STB
add_library(stb INTERFACE)
target_include_directories(stb INTERFACE stb)
# FreeType
if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
set(DAWN_EMSCRIPTEN_FLAGS "${DAWN_EMSCRIPTEN_FLAGS} -s USE_FREETYPE=1" CACHE INTERNAL ${DAWN_CACHE_TARGET})
else()
add_subdirectory(freetype)
endif()
# LibArchive
add_subdirectory(libarchive)
# OpenAL
if(DAWN_TARGET_OPENAL)
set(LIBTYPE "STATIC")
add_subdirectory(openal-soft)
set(BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE)
set(BUILD_EXAMPLES OFF CACHE BOOL "Build examples" FORCE)
add_subdirectory(AudioFile)
endif()
# Test
if(DEFINED DAWN_EMSCRIPTEN_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DAWN_EMSCRIPTEN_FLAGS}" CACHE INTERNAL ${DAWN_CACHE_TARGET})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DAWN_EMSCRIPTEN_FLAGS}" CACHE INTERNAL ${DAWN_CACHE_TARGET})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${DAWN_EMSCRIPTEN_FLAGS}" CACHE INTERNAL ${DAWN_CACHE_TARGET})
endif()