mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-11 04:18:29 +01:00
made glfw more portable
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
Project(cmimgui_glfw)
|
Project(cmimgui_glfw)
|
||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.11)
|
||||||
if(WIN32) # to mingw work as all the others
|
if(WIN32) # to mingw work as all the others
|
||||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
@@ -64,17 +64,24 @@ endif(WIN32)
|
|||||||
|
|
||||||
# GLFW
|
# GLFW
|
||||||
list(APPEND IMGUI_SOURCES ${BAKENDS_FOLDER}imgui_impl_glfw.cpp)
|
list(APPEND IMGUI_SOURCES ${BAKENDS_FOLDER}imgui_impl_glfw.cpp)
|
||||||
find_package(glfw3 REQUIRED)
|
|
||||||
|
|
||||||
# alternatively, you can build from source.
|
set(GLFW_VERSION 3.3.8)
|
||||||
# this tends to be quite the lifesaver on windows.
|
include(FetchContent)
|
||||||
# set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
FetchContent_Declare(
|
||||||
# set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
glfw
|
||||||
# set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
URL https://github.com/glfw/glfw/archive/refs/tags/${GLFW_VERSION}.tar.gz)
|
||||||
# add_subdirectory(<path_to_glfw_source>)
|
|
||||||
|
|
||||||
# imgui/glfw get confused if not statically built
|
FetchContent_GetProperties(glfw)
|
||||||
# on windows.
|
if (NOT glfw_POPULATED)
|
||||||
|
set(FETCHCONTENT_QUIET NO)
|
||||||
|
FetchContent_Populate(glfw)
|
||||||
|
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||||
|
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||||
|
add_subdirectory(${glfw_SOURCE_DIR} ${glfw_BINARY_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# glfw/imgui gets confused if it is not statically built.
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
add_library(cimgui STATIC ${IMGUI_SOURCES})
|
add_library(cimgui STATIC ${IMGUI_SOURCES})
|
||||||
ELSE()
|
ELSE()
|
||||||
|
Reference in New Issue
Block a user