From 2bdf6763cee51de991c6321699003e8b92d8d727 Mon Sep 17 00:00:00 2001
From: renderexpert
Date: Fri, 10 Jan 2025 19:56:37 +0000
Subject: [PATCH] Add glfw, imgui and cmake metal dependencies
Signed-off-by: renderexpert
---
.github/workflows/linux-check.yaml | 8 +++++
.gitmodules | 9 +++++
3party/CMake-MetalShaderSupport | 1 +
3party/CMakeLists.txt | 14 ++++++++
3party/glfw | 1 +
3party/imgui/CMakeLists.txt | 16 +++++++++
3party/imgui/imgui | 1 +
data/copyright.html | 57 ++++++++++++++++++++++++++++++
docs/INSTALL.md | 4 +++
9 files changed, 111 insertions(+)
create mode 160000 3party/CMake-MetalShaderSupport
create mode 160000 3party/glfw
create mode 100644 3party/imgui/CMakeLists.txt
create mode 160000 3party/imgui/imgui
diff --git a/.github/workflows/linux-check.yaml b/.github/workflows/linux-check.yaml
index 17adeecbd2..bce6b20487 100644
--- a/.github/workflows/linux-check.yaml
+++ b/.github/workflows/linux-check.yaml
@@ -61,6 +61,10 @@ jobs:
libgl1-mesa-dev \
libglvnd-dev \
libharfbuzz-dev \
+ libxrandr-dev \
+ libxinerama-dev \
+ libxcursor-dev \
+ libxi-dev \
qt6-base-dev \
libqt6svg6-dev \
qt6-positioning-dev \
@@ -128,6 +132,10 @@ jobs:
libgl1-mesa-dev \
libglvnd-dev \
libharfbuzz-dev \
+ libxrandr-dev \
+ libxinerama-dev \
+ libxcursor-dev \
+ libxi-dev \
qt6-base-dev \
libqt6svg6-dev \
qt6-positioning-dev \
diff --git a/.gitmodules b/.gitmodules
index c426b49813..6ddb8a5169 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -56,3 +56,12 @@
[submodule "3party/utfcpp"]
path = 3party/utfcpp
url = https://github.com/nemtrif/utfcpp.git
+[submodule "3party/glfw"]
+ path = 3party/glfw
+ url = https://github.com/glfw/glfw.git
+[submodule "3party/CMake-MetalShaderSupport"]
+ path = 3party/CMake-MetalShaderSupport
+ url = https://github.com/dpogue/CMake-MetalShaderSupport.git
+[submodule "3party/imgui/imgui"]
+ path = 3party/imgui/imgui
+ url = https://github.com/ocornut/imgui
diff --git a/3party/CMake-MetalShaderSupport b/3party/CMake-MetalShaderSupport
new file mode 160000
index 0000000000..989857d2e5
--- /dev/null
+++ b/3party/CMake-MetalShaderSupport
@@ -0,0 +1 @@
+Subproject commit 989857d2e5e54869c35ad06fb21a67d12a2dbc67
diff --git a/3party/CMakeLists.txt b/3party/CMakeLists.txt
index 57d0592dc3..e232703b2c 100644
--- a/3party/CMakeLists.txt
+++ b/3party/CMakeLists.txt
@@ -66,4 +66,18 @@ add_subdirectory(vulkan_wrapper)
if (PLATFORM_DESKTOP)
add_subdirectory(libtess2)
+
+ set(GLFW_BUILD_DOCS OFF CACHE BOOL "")
+ set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "")
+ set(GLFW_BUILD_TESTS OFF CACHE BOOL "")
+ set(GLFW_INSTALL OFF CACHE BOOL "")
+ set(GLFW_VULKAN_STATIC OFF CACHE BOOL "")
+ set(GLFW_BUILD_WAYLAND OFF CACHE BOOL "")
+ # Disable ARC for glfw and re-enable after it because it's globally set in the root CMakeLists.txt
+ set(CMAKE_OBJC_FLAGS "")
+ add_subdirectory(glfw)
+ set_target_properties(glfw PROPERTIES UNITY_BUILD OFF)
+ set(CMAKE_OBJC_FLAGS -fobjc-arc)
+
+ add_subdirectory(imgui)
endif()
diff --git a/3party/glfw b/3party/glfw
new file mode 160000
index 0000000000..21fea01161
--- /dev/null
+++ b/3party/glfw
@@ -0,0 +1 @@
+Subproject commit 21fea01161e0d6b70c0c5c1f52dc8e7a7df14a50
diff --git a/3party/imgui/CMakeLists.txt b/3party/imgui/CMakeLists.txt
new file mode 100644
index 0000000000..ebbdde8c48
--- /dev/null
+++ b/3party/imgui/CMakeLists.txt
@@ -0,0 +1,16 @@
+project(imgui)
+
+set(SRC
+ imgui/imgui_draw.cpp
+ imgui/imgui_tables.cpp
+ imgui/imgui_widgets.cpp
+ imgui/imgui.cpp
+ imgui/backends/imgui_impl_glfw.cpp
+)
+
+add_library(${PROJECT_NAME} ${SRC})
+target_include_directories(${PROJECT_NAME}
+ PRIVATE ${OMIM_ROOT}/3party/glfw/include
+ PUBLIC ${OMIM_ROOT}/3party/imgui/imgui
+ PUBLIC .
+)
diff --git a/3party/imgui/imgui b/3party/imgui/imgui
new file mode 160000
index 0000000000..6982ce43f5
--- /dev/null
+++ b/3party/imgui/imgui
@@ -0,0 +1 @@
+Subproject commit 6982ce43f5b143c5dce5fab0ce07dd4867b705ae
diff --git a/data/copyright.html b/data/copyright.html
index b83b74ae60..c517a2b17c 100644
--- a/data/copyright.html
+++ b/data/copyright.html
@@ -155,6 +155,12 @@
Chromium's Courgette;
BSD License
+ CMake Metal support files
+ © 2024 Darryl Pogue and Contributors;License
+
+ Dear ImGui
+ © 2014-2025 Omar Cornut; MIT License
+
Expat
© 1998–2000 Thai Open Source Software Center Ltd and Clark Cooper,
© 2001–2019 Expat maintainers; MIT License
@@ -164,6 +170,9 @@
FreeType
© 2013 The FreeType Project; FTL
+ GLFW
+ © 2002-2006 Marcus Geelnard;2006-2019 Camilla Löwy; Zlib License
+
GLM
© 2005–2014 G-Truc Creation; MIT License
@@ -1058,6 +1067,54 @@ of the copyright holder.
+
+
+
CMake Metal support files
+
Copyright 2024 Darryl Pogue and Contributors
+
All rights reserved.
+
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+
* Neither the name of Kitware, Inc. nor the names of Contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
------------------------------------------------------------------------------
+
+
See version control history for details of individual contributions.
+
+
The above copyright and license notice applies to distributions of
+ CMake in source and binary form. Third-party software packages supplied
+ with CMake under compatible licenses provide their own copyright notices
+ documented in corresponding subdirectories or source files.
+
+
------------------------------------------------------------------------------
+
+
CMake was initially developed by Kitware with the following sponsorship:
+
+
* National Library of Medicine at the National Institutes of Health as part of the Insight Segmentation and Registration Toolkit (ITK).
+
+
* US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel Visualization Initiative.
+
+
* National Alliance for Medical Image Computing (NAMIC) is funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149.
+
+
* Kitware, Inc.
+
+