cmake_minimum_required(VERSION 3.24) project(RaylibDmx) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) # nvim/fleet users (ONLY WORKS WITH MINGW/NINJA BUILDERS) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include(FetchContent) # 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 GIT_SHALLOW TRUE GIT_TAG 4.5.0 ) FetchContent_MakeAvailable(raylib) FetchContent_Declare( imgui GIT_REPOSITORY https://github.com/ocornut/imgui.git 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}) # configure rlImGui (raylib backend for ImGui) FetchContent_Declare( rlimgui GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git GIT_SHALLOW TRUE GIT_TAG main ) FetchContent_MakeAvailable(rlimgui) # Add source files file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp") set(PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/src") # Declare the executable add_executable(${PROJECT_NAME}) target_sources(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCES}) target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE}) # Link with Raylib target_link_libraries(${PROJECT_NAME} PRIVATE raylib) # Create rlImGui library add_library(rlImGui STATIC ${rlimgui_SOURCE_DIR}/rlImGui.cpp) target_include_directories(rlImGui PUBLIC ${rlimgui_SOURCE_DIR} ${imgui_SOURCE_DIR}) target_link_libraries(rlImGui PRIVATE raylib ImGui) # Link ImGui and rlImGui with the executable target_link_libraries(${PROJECT_NAME} PRIVATE ImGui rlImGui)