# Third-party dependencies for the editor and the example viewer, fetched with FetchContent. # Everything is overridable from the command line, e.g. # cmake -B build -DHPP_RAYLIB_TAG=5.5 -DHPP_IMGUI_TAG=v1.91.9b-docking -DHPP_RLIMGUI_TAG= include(FetchContent) set(HPP_RAYLIB_TAG "5.5" CACHE STRING "raylib git tag (the editor is written against the 5.5 API)") set(HPP_IMGUI_TAG "docking" CACHE STRING "Dear ImGui git ref - MUST be the docking branch (or a *-docking tag)") set(HPP_RLIMGUI_TAG "main" CACHE STRING "rlImGui git ref") option(HPP_USE_SYSTEM_RAYLIB "Use an installed raylib instead of fetching one" OFF) if(HPP_USE_SYSTEM_RAYLIB) find_package(raylib REQUIRED) else() set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(BUILD_GAMES OFF CACHE BOOL "" FORCE) FetchContent_Declare(raylib GIT_REPOSITORY https://github.com/raysan5/raylib.git GIT_TAG ${HPP_RAYLIB_TAG} GIT_SHALLOW TRUE) FetchContent_MakeAvailable(raylib) endif() if(HPP_BUILD_EDITOR) # SOURCE_SUBDIR points at a folder that does not exist: we only want the sources, not their build systems. FetchContent_Declare(imgui GIT_REPOSITORY https://github.com/ocornut/imgui.git GIT_TAG ${HPP_IMGUI_TAG} GIT_SHALLOW TRUE SOURCE_SUBDIR hpp_no_cmake) FetchContent_Declare(rlimgui GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git GIT_TAG ${HPP_RLIMGUI_TAG} GIT_SHALLOW TRUE SOURCE_SUBDIR hpp_no_cmake) FetchContent_MakeAvailable(imgui rlimgui) add_library(hpp_imgui STATIC ${imgui_SOURCE_DIR}/imgui.cpp ${imgui_SOURCE_DIR}/imgui_draw.cpp ${imgui_SOURCE_DIR}/imgui_tables.cpp ${imgui_SOURCE_DIR}/imgui_widgets.cpp ${imgui_SOURCE_DIR}/imgui_demo.cpp ${imgui_SOURCE_DIR}/misc/cpp/imgui_stdlib.cpp ${rlimgui_SOURCE_DIR}/rlImGui.cpp) target_include_directories(hpp_imgui PUBLIC ${imgui_SOURCE_DIR} ${imgui_SOURCE_DIR}/misc/cpp ${rlimgui_SOURCE_DIR}) target_compile_definitions(hpp_imgui PUBLIC NO_FONT_AWESOME) # skip rlImGui's bundled icon font target_link_libraries(hpp_imgui PUBLIC raylib) endif()