fetch imgui (#537)

* initial attempt

* forgot to add linux to the deps

* little more cleanup

* cleanup

* remove imgui

* include dirs

* windows

* metal stuff

* metal

* windows

* try just moving this for now

* makeavailable is working now
This commit is contained in:
briaguya
2024-04-30 22:11:46 -04:00
committed by GitHub
parent 10940fbe71
commit 4869a4748b
245 changed files with 143 additions and 110545 deletions
+21 -21
View File
@@ -23,34 +23,34 @@ endif()
include(cmake/Utils.cmake)
set(ADDITIONAL_LIB_INCLUDES "")
# =========== Dependencies =============
include(cmake/dependencies/common.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
include(cmake/dependencies/android.cmake)
elseif (CMAKE_SYSTEM_NAME STREQUAL "iOS")
include(cmake/dependencies/ios.cmake)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
include(cmake/dependencies/windows.cmake)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
include(cmake/dependencies/mac.cmake)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(PLATFORM "OS64COMBINED")
include(FetchContent)
FetchContent_Declare(iostoolchain
GIT_REPOSITORY https://github.com/leetal/ios-cmake
GIT_TAG 06465b27698424cf4a04a5ca4904d50a3c966c45
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
)
FetchContent_GetProperties(iostoolchain)
if(NOT iostoolchain_POPULATED)
FetchContent_Populate(iostoolchain)
endif()
set(CMAKE_IOS_TOOLCHAIN_FILE ${iostoolchain_SOURCE_DIR}/ios.toolchain.cmake)
set_property(GLOBAL PROPERTY IOS_TOOLCHAIN_FILE ${CMAKE_IOS_TOOLCHAIN_FILE})
include(${CMAKE_IOS_TOOLCHAIN_FILE})
if (CMAKE_SYSTEM_NAME STREQUAL "iOS")
include(cmake/dependencies/ios.cmake)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
include(cmake/dependencies/linux.cmake)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
include(cmake/dependencies/windows.cmake)
endif()
# === Platform Specific Configuration ===
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
include(cmake/ios-toolchain-populate.cmake)
endif()
# =========== Sources =============
add_subdirectory("extern")
add_subdirectory("src")
+2
View File
@@ -10,3 +10,5 @@ if (NOT ${SDL2_FOUND})
FetchContent_MakeAvailable(SDL2)
message("SDL2 downloaded to " ${FETCHCONTENT_BASE_DIR}/sdl2-src)
endif()
target_link_libraries(ImGui PUBLIC SDL2::SDL2)
+31
View File
@@ -1 +1,32 @@
include(FetchContent)
find_package(OpenGL QUIET)
#=================== ImGui ===================
FetchContent_Declare(
ImGui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG ce0d0ac8298ce164b5d862577e8b087d92f6e90e # docking 1.90.0
)
FetchContent_MakeAvailable(ImGui)
list(APPEND ADDITIONAL_LIB_INCLUDES ${imgui_SOURCE_DIR} ${imgui_SOURCE_DIR}/backends)
add_library(ImGui STATIC)
set_property(TARGET ImGui PROPERTY CXX_STANDARD 20)
target_sources(ImGui
PRIVATE
${imgui_SOURCE_DIR}/imgui_demo.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/imgui.cpp
)
target_sources(ImGui
PRIVATE
${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_sdl2.cpp
)
target_include_directories(ImGui PUBLIC ${imgui_SOURCE_DIR} ${imgui_SOURCE_DIR}/backends PRIVATE ${SDL2_INCLUDE_DIRS})
+12 -1
View File
@@ -67,4 +67,15 @@ if (NOT ${libzip_FOUND})
)
FetchContent_MakeAvailable(libzip)
list(APPEND ADDITIONAL_LIB_INCLUDES ${libzip_SOURCE_DIR}/lib ${libzip_BINARY_DIR})
endif()
endif()
#=================== ImGui ===================
target_sources(ImGui
PRIVATE
${imgui_SOURCE_DIR}/backends/imgui_impl_metal.mm
)
target_include_directories(ImGui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/extern/metal-cpp)
target_compile_definitions(ImGui PUBLIC IMGUI_IMPL_METAL_CPP)
target_link_libraries(ImGui PUBLIC SDL2::SDL2-static SDL2::SDL2main)
+10
View File
@@ -0,0 +1,10 @@
#=================== ImGui ===================
find_package(SDL2 REQUIRED)
target_link_libraries(ImGui PUBLIC SDL2::SDL2)
if (USE_OPENGLES)
target_link_libraries(ImGui PUBLIC ${OPENGL_GLESv2_LIBRARY})
add_compile_definitions(IMGUI_IMPL_OPENGL_ES3)
else()
target_link_libraries(ImGui PUBLIC ${OPENGL_opengl_LIBRARY})
endif()
+18
View File
@@ -13,3 +13,21 @@ if (NOT ${spdlog_FOUND})
)
FetchContent_MakeAvailable(spdlog)
endif()
#=================== ImGui ===================
target_sources(ImGui
PRIVATE
${imgui_SOURCE_DIR}/backends/imgui_impl_metal.mm
)
target_include_directories(ImGui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/extern/metal-cpp)
target_compile_definitions(ImGui PUBLIC IMGUI_IMPL_METAL_CPP)
find_package(SDL2 REQUIRED)
target_link_libraries(ImGui PUBLIC SDL2::SDL2)
find_package(GLEW REQUIRED)
target_link_libraries(ImGui PUBLIC ${OPENGL_opengl_LIBRARY} GLEW::GLEW)
set_target_properties(ImGui PROPERTIES
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES
)
+13
View File
@@ -12,3 +12,16 @@ if (USE_AUTO_VCPKG)
vcpkg_bootstrap()
vcpkg_install_packages(zlib bzip2 sdl2 glew libzip nlohmann-json tinyxml2 spdlog)
endif()
#=================== ImGui ===================
target_sources(ImGui
PRIVATE
${imgui_SOURCE_DIR}/backends/imgui_impl_dx11.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_win32.cpp
)
find_package(SDL2 CONFIG REQUIRED)
target_link_libraries(ImGui PUBLIC SDL2::SDL2 SDL2::SDL2main)
find_package(GLEW REQUIRED)
target_link_libraries(ImGui PUBLIC opengl32 GLEW::GLEW)
+15
View File
@@ -0,0 +1,15 @@
set(PLATFORM "OS64COMBINED")
include(FetchContent)
FetchContent_Declare(iostoolchain
GIT_REPOSITORY https://github.com/leetal/ios-cmake
GIT_TAG 06465b27698424cf4a04a5ca4904d50a3c966c45
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
)
FetchContent_GetProperties(iostoolchain)
if(NOT iostoolchain_POPULATED)
FetchContent_Populate(iostoolchain)
endif()
set(CMAKE_IOS_TOOLCHAIN_FILE ${iostoolchain_SOURCE_DIR}/ios.toolchain.cmake)
set_property(GLOBAL PROPERTY IOS_TOOLCHAIN_FILE ${CMAKE_IOS_TOOLCHAIN_FILE})
include(${CMAKE_IOS_TOOLCHAIN_FILE})
-75
View File
@@ -1,11 +1,3 @@
find_package(OpenGL QUIET)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
find_package(SDL2 CONFIG REQUIRED)
elseif (NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(SDL2 REQUIRED)
endif()
#=================== DrLibs ===================
set(DRLIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dr_libs)
@@ -26,73 +18,6 @@ if((CMAKE_SYSTEM_NAME MATCHES "Windows") AND ("${CMAKE_CXX_COMPILER_ID}" MATCHES
endif()
endif()
#=================== ImGui ===================
set(IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ImGui)
add_library(ImGui STATIC)
set_property(TARGET ImGui PROPERTY CXX_STANDARD 20)
target_sources(ImGui
PRIVATE
${IMGUI_DIR}/imgui_demo.cpp
${IMGUI_DIR}/imgui_draw.cpp
${IMGUI_DIR}/imgui_tables.cpp
${IMGUI_DIR}/imgui_widgets.cpp
${IMGUI_DIR}/imgui.cpp
)
target_sources(ImGui
PRIVATE
${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp
${IMGUI_DIR}/backends/imgui_impl_sdl2.cpp
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_sources(ImGui
PRIVATE
${IMGUI_DIR}/backends/imgui_impl_dx11.cpp
${IMGUI_DIR}/backends/imgui_impl_win32.cpp
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
target_sources(ImGui
PRIVATE
${IMGUI_DIR}/backends/imgui_impl_metal.mm
)
endif()
target_include_directories(ImGui PUBLIC ${IMGUI_DIR} ${IMGUI_DIR}/backends PRIVATE ${SDL2_INCLUDE_DIRS})
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
target_include_directories(ImGui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/metal-cpp)
target_compile_definitions(ImGui PUBLIC IMGUI_IMPL_METAL_CPP)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(ImGui PUBLIC SDL2::SDL2 SDL2::SDL2main)
elseif (CMAKE_SYSTEM_NAME STREQUAL "iOS")
target_link_libraries(ImGui PUBLIC SDL2::SDL2-static SDL2::SDL2main)
else()
target_link_libraries(ImGui PUBLIC SDL2::SDL2)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
find_package(GLEW REQUIRED)
target_link_libraries(ImGui PUBLIC opengl32 GLEW::GLEW)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_package(GLEW REQUIRED)
target_link_libraries(ImGui PUBLIC ${OPENGL_opengl_LIBRARY} GLEW::GLEW)
set_target_properties(ImGui PROPERTIES
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
if (USE_OPENGLES)
target_link_libraries(ImGui PUBLIC ${OPENGL_GLESv2_LIBRARY})
add_compile_definitions(IMGUI_IMPL_OPENGL_ES3)
else()
target_link_libraries(ImGui PUBLIC ${OPENGL_opengl_LIBRARY})
endif()
endif()
#=================== ZAPDUtils ===================
set(ZAPDUTILS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ZAPDUtils)
-28
View File
@@ -1,28 +0,0 @@
# See http://editorconfig.org to read about the EditorConfig format.
# - In theory automatically supported by VS2017+ and most common IDE or text editors.
# - In practice VS2019-VS2022 stills don't trim trailing whitespaces correctly :(
# - Suggest installing this to trim whitespaces:
# GitHub https://github.com/madskristensen/TrailingWhitespace
# VS2019 https://marketplace.visualstudio.com/items?itemName=MadsKristensen.TrailingWhitespaceVisualizer
# VS2022 https://marketplace.visualstudio.com/items?itemName=MadsKristensen.TrailingWhitespace64
# (in spite of its name doesn't only visualize but also trims)
# - Alternative for older VS2010 to VS2015: https://marketplace.visualstudio.com/items?itemName=EditorConfigTeam.EditorConfig
# top-most EditorConfig file
root = true
# Default settings:
# Use 4 spaces as indentation
[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[imstb_*]
indent_size = 3
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
indent_size = 4
-30
View File
@@ -1,30 +0,0 @@
* text=auto
*.c text
*.cpp text
*.h text
*.m text
*.mm text
*.md text
*.txt text
*.html text
*.bat text
*.frag text
*.vert text
*.mkb text
*.icf text
*.sln text eol=crlf
*.vcxproj text eol=crlf
*.vcxproj.filters text eol=crlf
*.natvis text eol=crlf
Makefile text eol=lf
*.sh text eol=lf
*.pbxproj text eol=lf
*.storyboard text eol=lf
*.plist text eol=lf
*.png binary
*.ttf binary
*.lib binary
-1
View File
@@ -1 +0,0 @@
custom: ['https://github.com/ocornut/imgui/wiki/Sponsors']
-46
View File
@@ -1,46 +0,0 @@
(Click "Preview" above ^ to turn URL into clickable links)
1. FOR FIRST-TIME USERS PROBLEMS COMPILING/LINKING/RUNNING or LOADING FONTS, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions). EVERYTHING ELSE CAN BE POSTED HERE!
2. PLEASE CAREFULLY READ: [FAQ](https://github.com/ocornut/imgui/blob/master/docs/FAQ.md)
3. PLEASE CAREFULLY READ: [Contributing Guidelines](https://github.com/ocornut/imgui/blob/master/docs/CONTRIBUTING.md)
4. PLEASE MAKE SURE that you have: read the FAQ; explored the contents of `ShowDemoWindow()` including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the links above.
5. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users.
6. Delete points 1-6 and PLEASE FILL THE TEMPLATE BELOW before submitting your issue.
Thank you!
----
_(you may also go to Demo>About Window, and click "Config/Build Information" to obtain a bunch of detailed information that you can paste here)_
**Version/Branch of Dear ImGui:**
Version: XXX
Branch: XXX _(master/viewport/docking/etc.)_
**Back-end/Renderer/Compiler/OS**
Back-ends: imgui_impl_XXX.cpp + imgui_impl_XXX.cpp _(or specify if using a custom engine/back-end)_
Compiler: XXX _(if the question is related to building or platform specific features)_
Operating System: XXX
**My Issue/Question:**
XXX _(please provide as much context as possible)_
**Screenshots/Video**
XXX _(you can drag files here)_
**Standalone, minimal, complete and verifiable example:** _(see https://github.com/ocornut/imgui/issues/2261)_
```
// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();
```
-6
View File
@@ -1,6 +0,0 @@
(Click "Preview" to turn any http URL into a clickable link)
1. PLEASE CAREFULLY READ: [Contributing Guidelines](https://github.com/ocornut/imgui/blob/master/docs/CONTRIBUTING.md)
2. Clear this template before submitting your PR.
File diff suppressed because it is too large Load Diff
-15
View File
@@ -1,15 +0,0 @@
#
# This is a dummy workflow used to trigger scheduled builds. Forked repositories most likely should disable this
# workflow to avoid daily builds of inactive repositories.
#
name: scheduled
on:
schedule:
- cron: '0 9 * * *'
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- run: exit 0
-46
View File
@@ -1,46 +0,0 @@
name: static-analysis
on:
workflow_run:
# Perform static analysis together with build workflow. Build triggers of "build" workflow do not need to be repeated here.
workflows:
- build
types:
- requested
jobs:
PVS-Studio:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install Dependencies
env:
# The Secret variable setup in GitHub must be in format: "name_or_email key", on a single line
PVS_STUDIO_LICENSE: ${{ secrets.PVS_STUDIO_LICENSE }}
run: |
if [[ "$PVS_STUDIO_LICENSE" != "" ]];
then
wget -q https://files.viva64.com/etc/pubkey.txt
sudo apt-key add pubkey.txt
sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list
sudo apt-get update
sudo apt-get install -y pvs-studio
pvs-studio-analyzer credentials -o pvs-studio.lic $PVS_STUDIO_LICENSE
fi
- name: PVS-Studio static analysis
run: |
if [[ ! -f pvs-studio.lic ]];
then
echo "PVS Studio license is missing. No analysis will be performed."
echo "If you have a PVS Studio license please create a project secret named PVS_STUDIO_LICENSE with your license."
echo "You may use a free license. More information at https://www.viva64.com/en/b/0457/"
exit 0
fi
cd examples/example_null
pvs-studio-analyzer trace -- make WITH_EXTRA_WARNINGS=1
pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log
plog-converter -a 'GA:1,2;OP:1' -d V1071 -t errorfile -w pvs-studio.log
-59
View File
@@ -1,59 +0,0 @@
## OSX artifacts
.DS_Store
## Dear ImGui artifacts
imgui.ini
## General build artifacts
*.o
*.obj
*.exe
examples/*/Debug/*
examples/*/Release/*
examples/*/x64/*
## Visual Studio artifacts
.vs
ipch
*.opensdf
*.log
*.pdb
*.ilk
*.user
*.sdf
*.suo
*.VC.db
*.VC.VC.opendb
## Getting files created in JSON/Schemas/Catalog/ from a VS2022 update
JSON/
## Commonly used CMake directories
build*/
## Xcode artifacts
project.xcworkspace
xcuserdata
## Emscripten artifacts
examples/*.o.tmp
examples/*.out.js
examples/*.out.wasm
examples/example_glfw_opengl3/web/*
examples/example_sdl2_opengl3/web/*
examples/example_emscripten_wgpu/web/*
## JetBrains IDE artifacts
.idea
cmake-build-*
## Unix executables from our example Makefiles
examples/example_glfw_metal/example_glfw_metal
examples/example_glfw_opengl2/example_glfw_opengl2
examples/example_glfw_opengl3/example_glfw_opengl3
examples/example_glut_opengl2/example_glut_opengl2
examples/example_null/example_null
examples/example_sdl2_metal/example_sdl2_metal
examples/example_sdl2_opengl2/example_sdl2_opengl2
examples/example_sdl2_opengl3/example_sdl2_opengl3
examples/example_sdl2_sdlrenderer/example_sdl2_sdlrenderer
-21
View File
@@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014-2023 Omar Cornut
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More