LumaShow/CMakeLists.txt

92 lines
2.6 KiB
CMake
Raw Normal View History

2024-08-15 20:44:16 -06:00
cmake_minimum_required(VERSION 3.24)
2024-08-16 03:21:55 -06:00
project(LumaShow)
2024-08-16 02:16:34 -06:00
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2024-08-15 20:44:16 -06:00
# nvim/fleet users (ONLY WORKS WITH MINGW/NINJA BUILDERS)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Need this to make FETCHCONTENT_QUIET off
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
set(FETCHCONTENT_QUIET OFF)
include(FetchContent)
2024-08-15 20:44:16 -06:00
# Dependencies
## - Raylib
## - rlImGui
#### - ImGui
# Use FetchContent to download and build raylib
# This is a faster alternative to using a git repo, since this just downloads the source
# while the git repo pull takes a lot longer. Not sure why, other repos don't seem to have this issue
# If you would like to use git instead, use this:
# - - - - - - - - - - - - - - - - - - - - - - - -
#FetchContent_Declare(
# raylib
# GIT_REPOSITORY "https://github.com/raysan5/raylib.git"
# GIT_TAG "master"
# GIT_SHALLOW TRUE
# GIT_PROGRESS TRUE
#)
# - - - - - - - - - - - - - - - - - - - - - - - -
FetchContent_Declare(
raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
2024-08-15 20:44:16 -06:00
GIT_SHALLOW TRUE
GIT_TAG 4.5.0
)
FetchContent_MakeAvailable(raylib)
FetchContent_Declare(
imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
2024-08-15 20:44:16 -06:00
GIT_SHALLOW TRUE
GIT_TAG v1.91.0
)
FetchContent_MakeAvailable(imgui)
# Build ImGui as a static library
add_library(ImGui STATIC
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui_demo.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
)
target_include_directories(ImGui PUBLIC ${imgui_SOURCE_DIR})
2024-08-15 20:44:16 -06:00
# configure rlImGui (raylib backend for ImGui)
FetchContent_Declare(
rlimgui
GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git
2024-08-15 20:44:16 -06:00
GIT_SHALLOW TRUE
GIT_TAG main
)
FetchContent_MakeAvailable(rlimgui)
2024-08-16 02:16:34 -06:00
# Add source files
file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp")
set(PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/src")
2024-08-16 02:16:34 -06:00
# Declare the executable
add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE})
2024-08-16 02:16:34 -06:00
# Link with Raylib
target_link_libraries(${PROJECT_NAME} PRIVATE raylib)
2024-08-16 02:16:34 -06:00
# Create rlImGui library
add_library(rlImGui STATIC ${rlimgui_SOURCE_DIR}/rlImGui.cpp)
target_include_directories(rlImGui PUBLIC ${rlimgui_SOURCE_DIR} ${imgui_SOURCE_DIR})
2024-08-16 02:16:34 -06:00
target_link_libraries(rlImGui PRIVATE raylib ImGui)
2024-08-16 02:16:34 -06:00
# Link ImGui and rlImGui with the executable
target_link_libraries(${PROJECT_NAME} PRIVATE ImGui rlImGui)