diff options
Diffstat (limited to 'media-libs/imgui/files/imgui-1.87-CMakeLists.txt')
-rw-r--r-- | media-libs/imgui/files/imgui-1.87-CMakeLists.txt | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/media-libs/imgui/files/imgui-1.87-CMakeLists.txt b/media-libs/imgui/files/imgui-1.87-CMakeLists.txt new file mode 100644 index 000000000..0823d1dc3 --- /dev/null +++ b/media-libs/imgui/files/imgui-1.87-CMakeLists.txt @@ -0,0 +1,160 @@ +cmake_minimum_required(VERSION 3.8.2) +project(imgui VERSION 1.73.0 LANGUAGES CXX C) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +include(GNUInstallDirs) + +option(IMGUI_ALLEGRO OFF) +option(IMGUI_EXAMPLES "Build ImGui examples" OFF) +option(IMGUI_FREETYPE OFF) +option(IMGUI_GLFW OFF) +option(IMGUI_GLUT OFF) +option(IMGUI_OPENGL OFF) +option(IMGUI_SDL OFF) +option(IMGUI_VULKAN OFF) + +add_library (imgui_objects + OBJECT + imgui.cpp + imgui_demo.cpp + imgui_draw.cpp + imgui_tables.cpp + imgui_widgets.cpp +) +add_library (imgui SHARED "") +target_include_directories(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") +#set(IMGUI_COMMON_FLAGS "-DIMGUI_USE_WCHAR32 -DIMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION -DIMGUI_STB_RECT_PACK_FILENAME=\"<stb/stb_rect_pack.h>\"") +set(IMGUI_COMMON_FLAGS "-DIMGUI_USE_WCHAR32") + +if(IMGUI_ALLEGRO) + find_package(PkgConfig REQUIRED) + pkg_check_modules(ALLEGRO5 REQUIRED allegro-5 allegro_main-5 allegro_primitives-5) + target_sources(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_allegro5.cpp") + target_include_directories(imgui_objects PUBLIC ${ALLEGRO5_INCLUDE_DIRS}) + list(APPEND IMGUI_LIBRARIES ${ALLEGRO5_LIBRARIES}) +endif() +if(IMGUI_FREETYPE) + find_package(Freetype REQUIRED) + target_sources(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype/imgui_freetype.cpp") + target_include_directories(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype" ${FREETYPE_INCLUDE_DIRS}) + list(APPEND IMGUI_LIBRARIES ${FREETYPE_LIBRARIES}) +# set(IMGUI_COMMON_FLAGS "${IMGUI_COMMON_FLAGS} -DIMGUI_ENABLE_FREETYPE -DIMGUI_ENABLE_STB_TRUETYPE -DIMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION -DIMGUI_STB_TRUETYPE_FILENAME=\"<stb/stb_truetype.h>\"") + set(IMGUI_COMMON_FLAGS "${IMGUI_COMMON_FLAGS} -DIMGUI_ENABLE_FREETYPE -DIMGUI_ENABLE_STB_TRUETYPE") + add_executable(binary_to_compressed_c "${CMAKE_CURRENT_SOURCE_DIR}/misc/fonts/binary_to_compressed_c.cpp") + target_include_directories(binary_to_compressed_c PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") + target_link_libraries(binary_to_compressed_c PUBLIC imgui) + install(TARGETS binary_to_compressed_c DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui") +endif() +if(IMGUI_GLFW) + find_package(glfw3 REQUIRED) + target_sources(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glfw.cpp") + list(APPEND IMGUI_LIBRARIES glfw) +endif() +if(IMGUI_GLUT) + find_package(FreeGLUT REQUIRED) + target_sources(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glut.cpp") + target_include_directories(imgui_objects PUBLIC ${FreeGLUT_INCLUDE_DIRS}) + list(APPEND IMGUI_LIBRARIES FreeGLUT::freeglut) +endif() +if(IMGUI_OPENGL) + find_package(OpenGL REQUIRED) + target_sources(imgui_objects + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl2.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp" + ) + target_include_directories(imgui_objects PUBLIC ${OPENGL_INCLUDE_DIR}) + list(APPEND IMGUI_LIBRARIES ${OPENGL_gl_LIBRARY}) +endif() +if(IMGUI_SDL) + find_package(SDL2 REQUIRED) + target_sources(imgui_objects + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdl.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdlrenderer.cpp" + ) + target_include_directories(imgui_objects PUBLIC "${SDL2_INCLUDE_DIRS}") + list(APPEND IMGUI_LIBRARIES "${SDL2_LIBRARIES}") +endif() +if(IMGUI_VULKAN) + find_package(Vulkan REQUIRED) + target_sources(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_vulkan.cpp") + set(IMGUI_COMMON_FLAGS "${IMGUI_COMMON_FLAGS} -DImTextureID=ImU64") + target_include_directories(imgui_objects PUBLIC ${Vulkan_INCLUDE_DIRS}) + list(APPEND IMGUI_LIBRARIES Vulkan::Vulkan) +endif() + +if(IMGUI_EXAMPLES) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples" DESTINATION "${CMAKE_INSTALL_DOCDIR}") + add_executable(example_null "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_null/main.cpp") + target_include_directories(example_null PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") + target_link_libraries(example_null PUBLIC imgui) + install(TARGETS example_null DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + if(IMGUI_ALLEGRO) + add_executable(example_allegro5 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_allegro5/main.cpp") + target_include_directories(example_allegro5 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") + target_link_libraries(example_allegro5 PUBLIC imgui) + install(TARGETS example_allegro5 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + if(IMGUI_GLFW AND IMGUI_OPENGL) + add_executable(example_glfw_opengl2 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_glfw_opengl2/main.cpp") + target_include_directories(example_glfw_opengl2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") + target_link_libraries(example_glfw_opengl2 PUBLIC imgui) + install(TARGETS example_allegro5 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + add_executable(example_glfw_opengl3 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_glfw_opengl3/main.cpp") + target_include_directories(example_glfw_opengl3 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") + target_link_libraries(example_glfw_opengl3 PUBLIC imgui) + install(TARGETS example_glfw_opengl3 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + if(IMGUI_GLFW AND IMGUI_VULKAN) + add_executable(example_glfw_vulkan "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_glfw_vulkan/main.cpp") + target_include_directories(example_glfw_vulkan PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") + target_link_libraries(example_glfw_vulkan PUBLIC imgui) + install(TARGETS example_glfw_vulkan DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + if(IMGUI_GLUT AND IMGUI_OPENGL) + add_executable(example_glut_opengl2 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_glut_opengl2/main.cpp") + target_include_directories(example_glut_opengl2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") + target_link_libraries(example_glut_opengl2 PUBLIC imgui) + install(TARGETS example_glut_opengl2 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + if(IMGUI_SDL) + add_executable(example_sdl_sdlrenderer "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_sdl_sdlrenderer/main.cpp") + target_include_directories(example_sdl_sdlrenderer PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends" "${SDL2_INCLUDE_DIRS}") + target_link_libraries(example_sdl_sdlrenderer PUBLIC imgui) + install(TARGETS example_sdl_sdlrenderer DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + if(IMGUI_OPENGL) + add_executable(example_sdl_opengl2 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_sdl_opengl2/main.cpp") + target_include_directories(example_sdl_opengl2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends" "${SDL2_INCLUDE_DIRS}") + target_link_libraries(example_sdl_opengl2 PUBLIC imgui) + install(TARGETS example_sdl_opengl2 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + add_executable(example_sdl_opengl3 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_sdl_opengl3/main.cpp") + target_include_directories(example_sdl_opengl3 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends" "${SDL2_INCLUDE_DIRS}") + target_link_libraries(example_sdl_opengl3 PUBLIC imgui) + install(TARGETS example_sdl_opengl2 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + if(IMGUI_VULKAN) + add_executable(example_sdl_vulkan "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_sdl_vulkan/main.cpp") + target_include_directories(example_sdl_vulkan PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends" "${SDL2_INCLUDE_DIRS}") + target_link_libraries(example_sdl_vulkan PUBLIC imgui) + install(TARGETS example_sdl_vulkan DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + endif() +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IMGUI_COMMON_FLAGS} -fpermissive") +target_sources (imgui PUBLIC $<TARGET_OBJECTS:imgui_objects>) + +add_library(imgui::imgui ALIAS imgui) +target_link_libraries(imgui PUBLIC ${IMGUI_LIBRARIES}) + +file(GLOB IMGUI_INCLUDE_FILES "*.h" "backends/*.h" "misc/freetype/*.h") +install(FILES ${IMGUI_INCLUDE_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/imgui") +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/backends/vulkan" DESTINATION "${CMAKE_INSTALL_DATADIR}/imgui/backends") +file(GLOB IMGUI_DOC_FILES "docs/*") +install(FILES ${IMGUI_DOC_FILES} DESTINATION "${CMAKE_INSTALL_DOCDIR}") +install(TARGETS imgui) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/imgui.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/imgui.pc" @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/imgui.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +set(IMGUI_COMMON_FLAGS "${IMGUI_COMMON_FLAGS}" PARENT_SCOPE) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE) |