cmake: Adding dearImGui
This commit is contained in:
@@ -7,6 +7,14 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(IMGUI_BACKEND "imgui_impl_dx11.cpp") # DirectX 11 for Windows
|
||||||
|
elseif(APPLE)
|
||||||
|
set(IMGUI_BACKEND "imgui_impl_metal.mm") # Metal for macOS
|
||||||
|
elseif(UNIX)
|
||||||
|
set(IMGUI_BACKEND "imgui_impl_opengl3.cpp") # OpenGL for Linux
|
||||||
|
endif()
|
||||||
|
|
||||||
# Copying assets
|
# Copying assets
|
||||||
file(COPY "${CMAKE_SOURCE_DIR}/assets" DESTINATION "${CMAKE_BINARY_DIR}")
|
file(COPY "${CMAKE_SOURCE_DIR}/assets" DESTINATION "${CMAKE_BINARY_DIR}")
|
||||||
|
|
||||||
@@ -30,6 +38,25 @@ if (NOT raylib_POPULATED)
|
|||||||
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
|
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# imgui
|
||||||
|
FetchContent_Declare(
|
||||||
|
imgui
|
||||||
|
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
||||||
|
GIT_TAG docking
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(imgui)
|
||||||
|
|
||||||
|
set(imgui_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/imgui-src)
|
||||||
|
|
||||||
|
# rlimgui
|
||||||
|
FetchContent_Declare(
|
||||||
|
rlImGui
|
||||||
|
GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git
|
||||||
|
GIT_TAG main
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(rlImGui)
|
||||||
|
set(rlImGui_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/rlimgui-src)
|
||||||
|
|
||||||
# nlohmann::json
|
# nlohmann::json
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
@@ -43,6 +70,12 @@ include_directories(${imgui_SOURCE_DIR} ${rlImGui_SOURCE_DIR})
|
|||||||
|
|
||||||
set(SRC_CXX_FILES "./srcs/main.cpp"
|
set(SRC_CXX_FILES "./srcs/main.cpp"
|
||||||
"./srcs/Model.cpp"
|
"./srcs/Model.cpp"
|
||||||
|
"${rlImGui_SOURCE_DIR}/rlImGui.cpp"
|
||||||
|
"${imgui_SOURCE_DIR}/imgui.cpp"
|
||||||
|
"${imgui_SOURCE_DIR}/imgui_draw.cpp"
|
||||||
|
"${imgui_SOURCE_DIR}/imgui_widgets.cpp"
|
||||||
|
"${imgui_SOURCE_DIR}/imgui_tables.cpp"
|
||||||
|
"${imgui_SOURCE_DIR}/backends/${IMGUI_BACKEND}"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(${NAME} ${SRC_CXX_FILES})
|
add_executable(${NAME} ${SRC_CXX_FILES})
|
||||||
|
|||||||
Reference in New Issue
Block a user