Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 75f3a2ee authored by g4m4's avatar g4m4
Browse files

[UI] Integrate the imgui GLFW Vulkan demo

parent c47cac45
No related branches found
No related tags found
No related merge requests found
Pipeline #61694 failed
...@@ -153,6 +153,9 @@ ...@@ -153,6 +153,9 @@
"environment": { "environment": {
"CFLAGS": "/fsanitize=address", "CFLAGS": "/fsanitize=address",
"CXXFLAGS": "/fsanitize=address" "CXXFLAGS": "/fsanitize=address"
},
"cacheVariables": {
"CMAKE_VERBOSE_MAKEFILE": "ON"
} }
}, },
{ {
......
...@@ -3,12 +3,67 @@ include(cmake/cpm.cmake) ...@@ -3,12 +3,67 @@ include(cmake/cpm.cmake)
# Done as a function so that updates to variables like CMAKE_CXX_FLAGS don't # Done as a function so that updates to variables like CMAKE_CXX_FLAGS don't
# propagate out to other targets # propagate out to other targets
function(setup_dependencies) function(setup_dependencies)
# doctest # doctest
if(${SANDBOX_ENABLE_TESTS}) if(${SANDBOX_ENABLE_TESTS})
cpmaddpackage(GITHUB_REPOSITORY doctest/doctest GIT_TAG v2.4.11) cpmaddpackage(GITHUB_REPOSITORY doctest/doctest GIT_TAG v2.4.11)
endif() endif()
# cmake-format: off
if(${SANDBOX_ENABLE_UI})
# GLFW
cpmaddpackage(
GITHUB_REPOSITORY
glfw/glfw
GIT_TAG
3.4
OPTIONS
"GLFW_BUILD_EXAMPLES OFF"
"GLFW_BUILD_TESTS OFF"
"GLFW_BUILD_DOCS OFF"
"GLFW_INSTALL OFF")
# imgui
cpmaddpackage(
GITHUB_REPOSITORY
ocornut/imgui
GIT_TAG
v1.91.9b)
# cmake-format: on
if(imgui_ADDED)
add_library(imgui)
target_sources(
imgui
PUBLIC FILE_SET
header
TYPE
HEADERS
BASE_DIRS
${imgui_SOURCE_DIR}
FILES
${imgui_SOURCE_DIR}/imgui.h)
target_sources(
imgui
PRIVATE ${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
${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_vulkan.cpp)
target_include_directories(
imgui PUBLIC $<BUILD_INTERFACE:${imgui_SOURCE_DIR}>
$<BUILD_INTERFACE:${imgui_SOURCE_DIR}>/backends)
target_link_libraries(imgui PUBLIC glfw Vulkan::Vulkan)
# if(UNIX) find_package(Threads REQUIRED) target_link_libraries(miniaudio
# PUBLIC ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) endif()
endif()
# Vulkan
find_package(Vulkan REQUIRED)
endif()
endfunction() endfunction()
# CPM licenses target here # CPM licenses target here
......
# @brief SandBox UI executable root cmake file
add_executable(sandbox_ui)
add_executable(sandbox::ui ALIAS sandbox_ui)
target_sources(sandbox_ui PRIVATE "main.cc")
target_link_libraries(sandbox_ui PUBLIC imgui sandbox::lib)
add_custom_command(
TARGET sandbox_ui
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E echo
"sandbox_ui runtime dependencies: $<TARGET_RUNTIME_DLLS:sandbox_ui>")
set(have_runtime_dlls $<BOOL:$<TARGET_RUNTIME_DLLS:sandbox_ui>>)
set(runtime_dlls_command
${CMAKE_COMMAND} -E copy_if_different $<TARGET_RUNTIME_DLLS:sandbox_ui>
$<TARGET_FILE_DIR:sandbox_ui>)
add_custom_command(
TARGET sandbox_ui
POST_BUILD
COMMAND "$<${have_runtime_dlls}:${runtime_dlls_command}>"
COMMAND_EXPAND_LISTS)
install(
TARGETS sandbox_ui
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment