2023-11-19 11:59:25 +01:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2025-01-15 19:45:06 +01:00
|
|
|
# https://github.com/ocornut/imgui backends with custom modifications made to the OpenGL 3 and GLFW backends
|
|
|
|
project(imgui_backend)
|
2023-11-19 11:59:25 +01:00
|
|
|
|
2025-01-31 23:48:38 +01:00
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
2023-11-19 11:59:25 +01:00
|
|
|
|
2024-02-24 15:06:10 +01:00
|
|
|
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
2025-01-15 19:45:06 +01:00
|
|
|
add_library(imgui_backend OBJECT
|
2024-02-24 15:06:10 +01:00
|
|
|
source/imgui_impl_opengl3.cpp
|
|
|
|
source/imgui_impl_glfw.cpp
|
|
|
|
)
|
|
|
|
|
2025-01-15 19:45:06 +01:00
|
|
|
target_include_directories(imgui_backend PUBLIC
|
2024-02-24 15:06:10 +01:00
|
|
|
include
|
|
|
|
)
|
|
|
|
|
2025-01-15 19:45:06 +01:00
|
|
|
target_link_libraries(imgui_backend PRIVATE imgui_includes)
|
2024-02-24 15:06:10 +01:00
|
|
|
|
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
find_package(Freetype REQUIRED)
|
|
|
|
|
|
|
|
find_package(GLFW QUIET)
|
|
|
|
if (NOT GLFW_FOUND OR "${GLFW_LIBRARIES}" STREQUAL "")
|
|
|
|
find_package(glfw3 QUIET)
|
|
|
|
set(GLFW_INCLUDE_DIRS ${glfw3_INCLUDE_DIRS})
|
|
|
|
set(GLFW_LIBRARIES ${glfw3_LIBRARIES})
|
|
|
|
|
2025-01-31 19:43:39 +01:00
|
|
|
if (NOT glfw3_FOUND AND "${GLFW_LIBRARIES}" STREQUAL "")
|
2024-02-24 15:06:10 +01:00
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_search_module(GLFW REQUIRED glfw3)
|
2025-01-31 19:43:39 +01:00
|
|
|
|
|
|
|
if ("${GLFW_LIBRARIES}" MATCHES ".+dll")
|
|
|
|
set(GLFW_LIBRARIES "glfw3")
|
|
|
|
endif ()
|
|
|
|
else()
|
|
|
|
set(GLFW_LIBRARIES GLFW::GLFW)
|
2024-02-24 15:06:10 +01:00
|
|
|
endif ()
|
|
|
|
endif()
|
|
|
|
|
2025-01-15 19:45:06 +01:00
|
|
|
target_include_directories(imgui_backend PUBLIC ${FREETYPE_INCLUDE_DIRS} ${OpenGL_INCLUDE_DIRS})
|
|
|
|
target_link_directories(imgui_backend PUBLIC ${FREETYPE_LIBRARY_DIRS} ${OpenGL_LIBRARY_DIRS})
|
|
|
|
target_link_libraries(imgui_backend PUBLIC ${GLFW_LIBRARIES} ${OPENGL_LIBRARIES})
|
2024-02-24 15:06:10 +01:00
|
|
|
endif()
|
2023-12-21 16:02:28 +01:00
|
|
|
|
2024-02-24 15:06:10 +01:00
|
|
|
target_include_directories(imgui_all_includes INTERFACE include)
|