This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
64 lines (51 loc) · 1.96 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
cmake_minimum_required(VERSION 3.16.2)
file(READ version.txt HG_VERSION)
string(STRIP ${HG_VERSION} HG_VERSION)
project(harfang_core VERSION ${HG_VERSION} LANGUAGES CXX C HOMEPAGE_URL "https://harfang3d.com")
set(CMAKE_CXX_STANDARD 98)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
option(HG_ENABLE_COVERAGE "enable code coverage" OFF)
set(HG_ENGINE_BACKEND SOKOL_GLCORE33 CACHE STRING "Graphics backend (default: SOKOL_GLCORE33)")
set_property(CACHE HG_ENGINE_BACKEND PROPERTY STRINGS SOKOL_GLCORE33 SOKOL_GLES2 SOKOL_GLES3 SOKOL_D3D11 SOKOL_METAL SOKOL_WGPU SOKOL_DUMMY_BACKEND)
if(HG_ENABLE_COVERAGE)
include(CodeCoverage)
set(HG_ENGINE_BACKEND "SOKOL_DUMMY_BACKEND")
append_coverage_compiler_flags()
endif()
if(WIN32)
if(MSVC)
add_compile_options(/Zc:__cplusplus)
endif()
add_compile_definitions(GLFW_WIN32=1)
endif()
add_compile_definitions(__STDC_WANT_LIB_EXT1__=1)
add_library(dummy_backend INTERFACE)
if(HG_ENGINE_BACKEND STREQUAL "SOKOL_GLCORE33")
find_package(OpenGL REQUIRED)
add_library(hg::gfx_backend ALIAS OpenGL::GL)
elseif(HG_ENGINE_BACKEND STREQUAL "SOKOL_GLES2")
find_package(OpenGLES3 REQUIRED)
add_library(hg::gfx_backend ALIAS OpenGL::GLES3)
elseif(HG_ENGINE_BACKEND STREQUAL "SOKOL_GLES3")
find_package(OpenGLES2 REQUIRED)
add_library(hg::gfx_backend ALIAS OpenGL::GLES2)
elseif(HG_ENGINE_BACKEND STREQUAL "SOKOL_D3D11")
# [todo]
add_library(hg::gfx_backend ALIAS dummy_backend)
elseif(HG_ENGINE_BACKEND STREQUAL "SOKOL_METAL")
# [todo]
add_library(hg::gfx_backend ALIAS dummy_backend)
elseif(HG_ENGINE_BACKEND STREQUAL "SOKOL_WGPU")
# [todo]
add_library(hg::gfx_backend ALIAS dummy_backend)
elseif(HG_ENGINE_BACKEND STREQUAL "SOKOL_DUMMY_BACKEND")
add_library(hg::gfx_backend ALIAS dummy_backend)
endif()
# add_compile_options(-pedantic)
add_subdirectory(foundation)
add_subdirectory(engine)
add_subdirectory(tests)
if(NOT HG_ENGINE_BACKEND STREQUAL "SOKOL_DUMMY_BACKEND")
add_subdirectory(app_glfw)
add_subdirectory(samples)
endif()