Re: git: 2769cf2656ae - main - x11-toolkits/imgui: New port: Bloat-free Graphical User interface for C++ with minimal dependencies
- Reply: Yuri Victorovich : "Re: git: 2769cf2656ae - main - x11-toolkits/imgui: New port: Bloat-free Graphical User interface for C++ with minimal dependencies"
- In reply to: Yuri Victorovich : "git: 2769cf2656ae - main - x11-toolkits/imgui: New port: Bloat-free Graphical User interface for C++ with minimal dependencies"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Jan 2023 22:52:14 UTC
Yuri Victorovich <yuri@FreeBSD.org> writes: > +OPTIONS_DEFAULT= GLFW OPENGL2 OPENGL3 Can you enable Vulkan by default? vulkan-loader is more likely to be already installed (pulled by another port) than glfw. In glfw package Vulkan is used via dlopen(3), so not visible via *_DEPENDS in the port. I did confirm VULKAN=on works fine on FreeBSD with Intel iGPU using the following which also helped to uncover a bug in imgui itself (missing dependency in shared library). --- examples/example_glfw_vulkan/CMakeLists.txt.orig 2023-01-05 14:49:29 UTC +++ examples/example_glfw_vulkan/CMakeLists.txt @@ -14,32 +14,20 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYP set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES") -# GLFW -set(GLFW_DIR ../../../glfw) # Set this to point to an up-to-date GLFW repo -option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) -option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) -option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF) -option(GLFW_INSTALL "Generate installation target" OFF) -option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF) -add_subdirectory(${GLFW_DIR} binary_dir EXCLUDE_FROM_ALL) -include_directories(${GLFW_DIR}/include) - -# Dear ImGui -set(IMGUI_DIR ../../) -include_directories(${IMGUI_DIR} ${IMGUI_DIR}/backends ..) - # Libraries +find_package(VulkanHeaders REQUIRED) find_package(Vulkan REQUIRED) -#find_library(VULKAN_LIBRARY - #NAMES vulkan vulkan-1) -#set(LIBRARIES "glfw;${VULKAN_LIBRARY}") -set(LIBRARIES "glfw;Vulkan::Vulkan") +find_package(glfw3) +find_package(imgui) +set(LIBRARIES "Vulkan::Vulkan;glfw;imgui::imgui") -# Use vulkan headers from glfw: -include_directories(${GLFW_DIR}/deps) +# Work around underlinking in imgui package e.g., +# ld: error: undefined reference due to --no-allow-shlib-undefined: glDeleteTextures +find_package(OpenGL) +list(APPEND LIBRARIES OpenGL::OpenGL) file(GLOB sources *.cpp) -add_executable(example_glfw_vulkan ${sources} ${IMGUI_DIR}/backends/imgui_impl_glfw.cpp ${IMGUI_DIR}/backends/imgui_impl_vulkan.cpp ${IMGUI_DIR}/imgui.cpp ${IMGUI_DIR}/imgui_draw.cpp ${IMGUI_DIR}/imgui_demo.cpp ${IMGUI_DIR}/imgui_tables.cpp ${IMGUI_DIR}/imgui_widgets.cpp) +add_executable(example_glfw_vulkan ${sources}) target_link_libraries(example_glfw_vulkan ${LIBRARIES}) target_compile_definitions(example_glfw_vulkan PUBLIC -DImTextureID=ImU64)