66 lines
1.8 KiB
CMake
66 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
# Set the project name
|
|
project(RaylibDmx)
|
|
|
|
# Set the C++ standard
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# Include FetchContent module
|
|
include(FetchContent)
|
|
|
|
# Download and configure raylib
|
|
FetchContent_Declare(
|
|
raylib
|
|
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
|
GIT_TAG 4.5.0 # or the latest version you want to use
|
|
)
|
|
FetchContent_MakeAvailable(raylib)
|
|
|
|
# Download and configure ImGui
|
|
FetchContent_Declare(
|
|
imgui
|
|
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
|
GIT_TAG v1.89.2 # or the latest version you want to use
|
|
)
|
|
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})
|
|
|
|
# Download and configure rlImGui (raylib backend for ImGui)
|
|
FetchContent_Declare(
|
|
rlimgui
|
|
GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git
|
|
GIT_TAG main # Use the correct branch name
|
|
)
|
|
FetchContent_MakeAvailable(rlimgui)
|
|
|
|
# Add executable target with the source files
|
|
file(GLOB_RECURSE SOURCES "src/*.cpp")
|
|
add_executable(${PROJECT_NAME} ${SOURCES})
|
|
|
|
# Link raylib to your project
|
|
target_link_libraries(${PROJECT_NAME} raylib)
|
|
|
|
# Add rlImGui to the project
|
|
set(RLIMGUI_SOURCES
|
|
${rlimgui_SOURCE_DIR}/rlImGui.cpp
|
|
)
|
|
|
|
# Create the rlImGui library
|
|
add_library(rlImGui STATIC ${RLIMGUI_SOURCES})
|
|
target_include_directories(rlImGui PUBLIC ${rlimgui_SOURCE_DIR} ${imgui_SOURCE_DIR})
|
|
target_link_libraries(rlImGui raylib ImGui)
|
|
|
|
# Link ImGui and rlImGui to your project
|
|
target_link_libraries(${PROJECT_NAME} ImGui rlImGui)
|