This commit introduces a new header file `nanovg_gl46.h` that implements the NanoVG rendering context using OpenGL 4.6. The new backend utilizes Direct State Access (DSA) functions, immutable texture storage, and explicit layout qualifiers. It includes definitions for creating and deleting the rendering context, as well as functions for handling images with OpenGL 4.6.
102 lines
3.1 KiB
CMake
102 lines
3.1 KiB
CMake
cmake_minimum_required(VERSION 3.25)
|
|
project(live-wallpaper LANGUAGES C CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
# ── CPM ──────────────────────────────────────────────────────────────────────
|
|
set(CPM_DOWNLOAD_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake")
|
|
|
|
if(NOT EXISTS "${CPM_DOWNLOAD_LOCATION}")
|
|
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
|
|
file(DOWNLOAD
|
|
"https://github.com/cpm-cmake/CPM.cmake/releases/latest/download/CPM.cmake"
|
|
"${CPM_DOWNLOAD_LOCATION}"
|
|
)
|
|
endif()
|
|
|
|
include("${CPM_DOWNLOAD_LOCATION}")
|
|
|
|
# ── Dependencies ─────────────────────────────────────────────────────────────
|
|
CPMAddPackage(
|
|
NAME SDL3
|
|
GITHUB_REPOSITORY libsdl-org/SDL
|
|
GIT_TAG main
|
|
OPTIONS
|
|
"SDL_SHARED OFF"
|
|
"SDL_STATIC ON"
|
|
"SDL_TEST_LIBRARY OFF"
|
|
"SDL_TESTS OFF"
|
|
"SDL_EXAMPLES OFF"
|
|
"SDL_X11_XSCRNSAVER OFF"
|
|
)
|
|
CPMAddPackage(
|
|
NAME lua
|
|
GIT_TAG v5.4.7
|
|
GITHUB_REPOSITORY walterschell/Lua
|
|
OPTIONS
|
|
"LUA_BUILD_COMPILER OFF"
|
|
"LUA_BUILD_INTERPRETER OFF"
|
|
)
|
|
CPMAddPackage(
|
|
NAME sol2
|
|
GITHUB_REPOSITORY ThePhD/sol2
|
|
GIT_TAG v3.3.0
|
|
OPTIONS
|
|
"SOL2_LUA_VERSION 5.4.7"
|
|
)
|
|
CPMAddPackage(
|
|
NAME stb
|
|
GITHUB_REPOSITORY nothings/stb
|
|
GIT_TAG master
|
|
DOWNLOAD_ONLY YES
|
|
)
|
|
if(stb_ADDED)
|
|
add_library(stb INTERFACE)
|
|
target_include_directories(stb INTERFACE ${stb_SOURCE_DIR})
|
|
endif()
|
|
# ── Local dependencies ───────────────────────────────────────────────────────
|
|
add_subdirectory(external/glad)
|
|
add_subdirectory(external/nanovg)
|
|
|
|
find_package(OpenGL REQUIRED)
|
|
find_package(X11 REQUIRED)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(GST REQUIRED IMPORTED_TARGET
|
|
gstreamer-1.0
|
|
gstreamer-app-1.0
|
|
gstreamer-video-1.0
|
|
)
|
|
|
|
# ── Source Files ─────────────────────────────────────────────────────────────
|
|
file(GLOB_RECURSE SOURCE_FILES
|
|
src/*.cpp
|
|
src/*.hpp
|
|
src/*.h
|
|
)
|
|
|
|
# ── Executable ───────────────────────────────────────────────────────────────
|
|
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
|
|
|
target_link_libraries(${PROJECT_NAME}
|
|
PRIVATE
|
|
SDL3::SDL3-static
|
|
OpenGL::GL
|
|
X11::X11
|
|
Xext
|
|
Lua::Library
|
|
sol2
|
|
stb
|
|
nanovg
|
|
glad
|
|
PkgConfig::GST
|
|
)
|
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
)
|