boilerplate's boilerplate
This commit is contained in:
15
.gitmodules
vendored
Normal file
15
.gitmodules
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[submodule "external/tomlplusplus"]
|
||||||
|
path = external/tomlplusplus
|
||||||
|
url = https://github.com/marzer/tomlplusplus
|
||||||
|
[submodule "external/spdlog"]
|
||||||
|
path = external/spdlog
|
||||||
|
url = https://github.com/gabime/spdlog
|
||||||
|
[submodule "external/glad"]
|
||||||
|
path = external/glad
|
||||||
|
url = https://github.com/Dav1dde/glad
|
||||||
|
[submodule "external/glm"]
|
||||||
|
path = external/glm
|
||||||
|
url = https://github.com/g-truc/glm
|
||||||
|
[submodule "external/stb"]
|
||||||
|
path = external/stb
|
||||||
|
url = https://github.com/nothings/stb
|
||||||
123
CMakeLists.txt
Normal file
123
CMakeLists.txt
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Force Clang before project()
|
||||||
|
# -----------------------------
|
||||||
|
if(NOT DEFINED CMAKE_C_COMPILER)
|
||||||
|
set(CMAKE_C_COMPILER clang CACHE STRING "" FORCE)
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED CMAKE_CXX_COMPILER)
|
||||||
|
set(CMAKE_CXX_COMPILER clang++ CACHE STRING "" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Project setup
|
||||||
|
# -----------------------------
|
||||||
|
project(exalock LANGUAGES C CXX)
|
||||||
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Vendored dependencies (submodules)
|
||||||
|
# -----------------------------
|
||||||
|
add_subdirectory(external/spdlog)
|
||||||
|
add_subdirectory(external/tomlplusplus)
|
||||||
|
add_subdirectory(external/glm)
|
||||||
|
|
||||||
|
# stb is header-only
|
||||||
|
add_library(stb INTERFACE)
|
||||||
|
target_include_directories(stb INTERFACE external/stb)
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# GLAD (official CMake integration)
|
||||||
|
# -----------------------------
|
||||||
|
add_subdirectory(external/glad/cmake)
|
||||||
|
|
||||||
|
# For OpenGL ES 2.0:
|
||||||
|
glad_add_library(glad_gles2 STATIC API gles2=2.0)
|
||||||
|
|
||||||
|
# For desktop OpenGL 3.3 core profile, you could use:
|
||||||
|
# glad_add_library(glad_gl33 STATIC API gl:core=3.3)
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# System dependencies (ABI-bound)
|
||||||
|
# -----------------------------
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
|
pkg_check_modules(WAYLAND REQUIRED
|
||||||
|
wayland-client
|
||||||
|
wayland-egl
|
||||||
|
)
|
||||||
|
pkg_check_modules(EGL REQUIRED egl)
|
||||||
|
pkg_check_modules(GLES REQUIRED glesv2)
|
||||||
|
pkg_check_modules(XKB REQUIRED xkbcommon)
|
||||||
|
pkg_check_modules(PAM REQUIRED pam)
|
||||||
|
pkg_check_modules(FREETYPE REQUIRED freetype2)
|
||||||
|
pkg_check_modules(HARFBUZZ REQUIRED harfbuzz)
|
||||||
|
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Executable
|
||||||
|
# -----------------------------
|
||||||
|
add_executable(${PROJECT_NAME} src/main.cpp)
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Auto-discover other source files
|
||||||
|
# -----------------------------
|
||||||
|
file(GLOB_RECURSE ALL_CPP "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
||||||
|
list(REMOVE_ITEM ALL_CPP "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||||
|
target_sources(${PROJECT_NAME} PRIVATE ${ALL_CPP})
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Include directories
|
||||||
|
# -----------------------------
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
|
src
|
||||||
|
${WAYLAND_INCLUDE_DIRS}
|
||||||
|
${EGL_INCLUDE_DIRS}
|
||||||
|
${GLES_INCLUDE_DIRS}
|
||||||
|
${XKB_INCLUDE_DIRS}
|
||||||
|
${PAM_INCLUDE_DIRS}
|
||||||
|
${FREETYPE_INCLUDE_DIRS}
|
||||||
|
${HARFBUZZ_INCLUDE_DIRS}
|
||||||
|
${FONTCONFIG_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Link libraries
|
||||||
|
# -----------------------------
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
spdlog::spdlog
|
||||||
|
tomlplusplus::tomlplusplus
|
||||||
|
glm::glm
|
||||||
|
stb
|
||||||
|
glad_gles2
|
||||||
|
${WAYLAND_LIBRARIES}
|
||||||
|
${EGL_LIBRARIES}
|
||||||
|
${GLES_LIBRARIES}
|
||||||
|
${XKB_LIBRARIES}
|
||||||
|
${PAM_LIBRARIES}
|
||||||
|
${FREETYPE_LIBRARIES}
|
||||||
|
${HARFBUZZ_LIBRARIES}
|
||||||
|
${FONTCONFIG_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Compiler warnings
|
||||||
|
# -----------------------------
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
|
||||||
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wpedantic
|
||||||
|
-Wconversion
|
||||||
|
-Wshadow
|
||||||
|
-Wnull-dereference
|
||||||
|
-Wdouble-promotion
|
||||||
|
)
|
||||||
|
endif()
|
||||||
1
external/glad
vendored
Submodule
1
external/glad
vendored
Submodule
Submodule external/glad added at 27bed11815
1
external/glm
vendored
Submodule
1
external/glm
vendored
Submodule
Submodule external/glm added at 8f6213d379
1
external/spdlog
vendored
Submodule
1
external/spdlog
vendored
Submodule
Submodule external/spdlog added at 0209b12c50
1
external/stb
vendored
Submodule
1
external/stb
vendored
Submodule
Submodule external/stb added at f1c79c0282
1
external/tomlplusplus
vendored
Submodule
1
external/tomlplusplus
vendored
Submodule
Submodule external/tomlplusplus added at e7aaccca3f
4
src/main.cpp
Normal file
4
src/main.cpp
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
int main (int argc, char *argv[]) {
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user