Lephe
31da1c0998
* Add build instructions for Dear ImGui that build the SDL + OpenGL 3 / OpenGL ES 2 backend. * Use Dear ImGui's bundled GL3W as a loader (including in azur itself, which has not been using a loader until now). * Properly select headers for OpenGL ES 2.0 (with the VAO extension) and attributes for WebGL; clear up OpenGL 4 error codes. * If FreeType2 is available through pkg-config, or if empscripten is used (since it has a FreeType port), use FreeType to render fonts in Dear ImGui for much-appreciated hinting quality. Minor changes: * Add window title to azur_init(). * Use emscripten's infinite loop simulation to make sure everything stays in the same thread. This is needed for Dear ImGui to work.
74 lines
1.8 KiB
CMake
74 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.19)
|
|
project(Facets VERSION 0.1)
|
|
|
|
# TODO: Set AZUR_DEBUG based on CMake Debug/Release setting
|
|
set(AZUR_DEBUG ON)
|
|
|
|
# When using [fxsdk build-cg], assume gint
|
|
if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
|
set(FACETS_PLATFORM gint)
|
|
endif()
|
|
|
|
# General options
|
|
add_compile_options(-Wall -Wextra -O2
|
|
-fmacro-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}/=)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# gint
|
|
|
|
if(FACETS_PLATFORM STREQUAL gint)
|
|
set(AZUR_PLATFORM_GENERIC TRUE)
|
|
set(AZUR_TOOLKIT_GINT TRUE)
|
|
set(AZUR_GRAPHICS_GINT_CG TRUE)
|
|
set(AZUR_TERMINAL_NONE TRUE)
|
|
|
|
find_package(Gint 2.4 REQUIRED)
|
|
find_package(LibProf 2.4 REQUIRED)
|
|
|
|
link_libraries(LibProf::LibProf Gint::Gint)
|
|
endif()
|
|
|
|
# linux
|
|
|
|
if(FACETS_PLATFORM STREQUAL linux)
|
|
set(AZUR_PLATFORM_GENERIC TRUE)
|
|
set(AZUR_TOOLKIT_SDL TRUE)
|
|
set(AZUR_GRAPHICS_OPENGL_3_3 TRUE)
|
|
set(AZUR_TERMINAL_ANSI TRUE)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(sdl2 REQUIRED sdl2 IMPORTED_TARGET)
|
|
pkg_check_modules(sdl2_image REQUIRED SDL2_image IMPORTED_TARGET)
|
|
pkg_check_modules(opengl REQUIRED opengl IMPORTED_TARGET)
|
|
pkg_check_modules(glx REQUIRED glx IMPORTED_TARGET)
|
|
|
|
link_libraries(PkgConfig::sdl2_image PkgConfig::sdl2 PkgConfig::opengl -lm)
|
|
endif()
|
|
|
|
# emscripten
|
|
|
|
if(FACETS_PLATFORM STREQUAL emscripten)
|
|
set(AZUR_PLATFORM_EMSCRIPTEN TRUE)
|
|
set(AZUR_TOOLKIT_SDL TRUE)
|
|
set(AZUR_GRAPHICS_OPENGL_ES_2_0 TRUE)
|
|
set(AZUR_TERMINAL_PLAIN TRUE)
|
|
|
|
set(PORTS -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS=["png"])
|
|
add_compile_options(${PORTS})
|
|
add_link_options(${PORTS} -O2)
|
|
endif()
|
|
|
|
#---
|
|
|
|
# This provides Dear ImGui but also GL3W as an OpenGL loader
|
|
if(NOT FACETS_PLATFORM STREQUAL gint)
|
|
add_subdirectory(imgui-builds)
|
|
endif()
|
|
|
|
add_subdirectory(azur)
|