aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/imgui/files/cimgui-1.87-CMakeLists.txt')
-rw-r--r--media-libs/imgui/files/cimgui-1.87-CMakeLists.txt80
1 files changed, 80 insertions, 0 deletions
diff --git a/media-libs/imgui/files/cimgui-1.87-CMakeLists.txt b/media-libs/imgui/files/cimgui-1.87-CMakeLists.txt
new file mode 100644
index 000000000..713125ec6
--- /dev/null
+++ b/media-libs/imgui/files/cimgui-1.87-CMakeLists.txt
@@ -0,0 +1,80 @@
+cmake_minimum_required(VERSION 3.1)
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+project(cimgui)
+
+#general settings
+
+set(IMGUI_LIBRARIES )
+set(IMGUI_COMMON_FLAGS )
+set(GENERATOR_IMPL "internal")
+
+if(IMGUI_FREETYPE)
+ set(GENERATOR_IMPL "${GENERATOR_IMPL} freetype")
+ add_definitions("-DCIMGUI_FREETYPE=1")
+endif(IMGUI_FREETYPE)
+
+add_subdirectory(imgui)
+
+if(IMGUI_BINDINGS)
+add_library(cimgui SHARED "")
+target_link_libraries(cimgui PUBLIC imgui ${IMGUI_LIBRARIES})
+target_compile_definitions(cimgui PUBLIC IMGUI_IMPL_API=extern\t\"C\"\t)
+target_include_directories(cimgui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/generator/output)
+target_include_directories(cimgui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/imgui)
+set_target_properties(cimgui PROPERTIES LINKER_LANGUAGE CXX)
+
+set(GENERATOR_ARGS )
+if(IMGUI_ALLEGRO)
+ list(APPEND GENERATOR_ARGS allegro5)
+endif()
+if(IMGUI_GLFW)
+ list(APPEND GENERATOR_ARGS glfw)
+endif()
+if(IMGUI_GLUT)
+ list(APPEND GENERATOR_ARGS glut)
+endif()
+if(IMGUI_OPENGL)
+ list(APPEND GENERATOR_ARGS opengl2 opengl3)
+endif()
+if(IMGUI_SDL)
+ list(APPEND GENERATOR_ARGS sdl sdlrenderer)
+endif()
+if(IMGUI_VULKAN)
+ list(APPEND GENERATOR_ARGS vulkan)
+endif()
+list(APPEND GENERATOR_ARGS ${IMGUI_COMMON_FLAGS} ${CMAKE_CPP_FLAGS})
+file(GLOB GENERATOR_OUTPUT_FILES "${CMAKE_SOURCE_DIR}/generator/output/*")
+list(APPEND
+ GENERATOR_OUTPUT_FILES
+ ${CMAKE_SOURCE_DIR}/cimgui.cpp
+ ${CMAKE_SOURCE_DIR}/cimgui.h
+ ${CMAKE_SOURCE_DIR}/generator/output/cimgui_nopreprocess.cpp
+ ${CMAKE_SOURCE_DIR}/generator/output/cimgui_nopreprocess.h
+)
+ADD_CUSTOM_COMMAND(VERBATIM
+ OUTPUT ${GENERATOR_OUTPUT_FILES}
+ COMMAND luajit ./generator.lua gcc "${GENERATOR_IMPL}" ${GENERATOR_ARGS}
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/generator"
+)
+set(CIMGUI_SOURCES "${CMAKE_SOURCE_DIR}/cimgui.cpp")
+set(CIMGUI_INCLUDE_FILES "${CMAKE_SOURCE_DIR}/cimgui.h")
+
+target_sources(cimgui
+ PUBLIC
+ ${CIMGUI_SOURCES}
+ ${CIMGUI_INCLUDE_FILES}
+)
+
+include(GNUInstallDirs)
+
+#install
+install(TARGETS cimgui LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(FILES ${CIMGUI_INCLUDE_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/imgui")
+
+#test
+set(CIMGUI_TEST "no" CACHE STRING "Enable compilation of a test unit based on imgui null")
+
+if (CIMGUI_TEST)
+ add_subdirectory(test)
+endif ()
+endif()