Преглед на файлове

update polyscope (#3255)

* fix glm

* update polyscope

* update stb
Hoildkv преди 1 година
родител
ревизия
d56bf6d1d7
променени са 5 файла, в които са добавени 149 реда и са изтрити 5 реда
  1. 1 1
      packages/g/glfw/xmake.lua
  2. 1 1
      packages/g/glm/xmake.lua
  3. 141 0
      packages/p/polyscope/patches/v2.1.0/deps.patch
  4. 5 3
      packages/p/polyscope/xmake.lua
  5. 1 0
      packages/s/stb/xmake.lua

+ 1 - 1
packages/g/glfw/xmake.lua

@@ -4,7 +4,7 @@ package("glfw")
     set_description("GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development.")
     set_license("zlib")
 
-    add_urls("https://github.com/glfw/glfw/archive/$(version).tar.gz",
+    add_urls("https://github.com/glfw/glfw/archive/refs/tags/$(version).tar.gz",
              "https://github.com/glfw/glfw.git")
     add_versions("3.3.2", "98768e12e615fbe9f3386f5bbfeb91b5a3b45a8c4c77159cef06b1f6ff749537")
     add_versions("3.3.4", "cc8ac1d024a0de5fd6f68c4133af77e1918261396319c24fd697775a6bc93b63")

+ 1 - 1
packages/g/glm/xmake.lua

@@ -15,7 +15,7 @@ package("glm")
     add_configs("modules", {description = "Build with C++20 modules support.", default = false, type = "boolean"})
 
     on_load(function (package)
-        if not package:config("modules") then
+        if package:config("modules") then
             package:config_set("header_only", false)
             package:config_set("cxx_standard", "20")
         end

+ 141 - 0
packages/p/polyscope/patches/v2.1.0/deps.patch

@@ -0,0 +1,141 @@
+diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt
+index 3b61d1e..714d247 100644
+--- a/deps/CMakeLists.txt
++++ b/deps/CMakeLists.txt
+@@ -1,23 +1,21 @@
+ if("${POLYSCOPE_BACKEND_OPENGL3_GLFW}")
+ 
+   ## Glad
+-  add_subdirectory(glad)
+ 
+   ## GLFW
+   set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
+   set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
+   set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
+   set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
+-  add_subdirectory(glfw)
++  find_package(glfw3 REQUIRED)
+ endif()
+ 
+ if("${POLYSCOPE_BACKEND_OPENGL_MOCK}")
+ endif()
+ 
+ ## Imgui
+-add_subdirectory(imgui)
+ 
+ ## Argparse
+ 
+ ## Other dependencies
+-add_subdirectory(stb)
++add_library(stb OBJECT stb_impl.cpp)
+diff --git a/deps/MarchingCubeCpp/include/MarchingCube/MC.h b/deps/MarchingCubeCpp/include/MarchingCube/MC.h
+index 62e6c37..e2d204b 100644
+--- a/deps/MarchingCubeCpp/include/MarchingCube/MC.h
++++ b/deps/MarchingCubeCpp/include/MarchingCube/MC.h
+@@ -5,8 +5,10 @@
+ #include <cmath>
+ 
+ // Added by nsharp: use glm instead of internal vector class
++#define GLM_ENABLE_EXPERIMENTAL
+ #include <glm/glm.hpp>
+ #include <glm/gtx/norm.hpp>
++#undef GLM_ENABLE_EXPERIMENTAL
+ 
+ namespace MC
+ {
+diff --git a/examples/demo-app/demo_app.cpp b/examples/demo-app/demo_app.cpp
+index 8af2b5a..a8be07c 100644
+--- a/examples/demo-app/demo_app.cpp
++++ b/examples/demo-app/demo_app.cpp
+@@ -24,7 +24,7 @@
+ 
+ #include "args/args.hxx"
+ #include "happly.h"
+-#include "json/json.hpp"
++#include "nlohmann/json.hpp"
+ 
+ #include "simple_dot_mesh_parser.h"
+ #include "surface_mesh_io.h"
+diff --git a/include/polyscope/internal.h b/include/polyscope/internal.h
+index d339e77..c875248 100644
+--- a/include/polyscope/internal.h
++++ b/include/polyscope/internal.h
+@@ -2,6 +2,7 @@
+ 
+ #pragma once
+ 
++#include <cstdint>
+ #include <string>
+ 
+ 
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 77e6dbd..3b2d98c 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -48,7 +48,7 @@ if("${POLYSCOPE_BACKEND_OPENGL3_GLFW}")
+ 
+   # Link settings
+   list(APPEND BACKEND_LIBS
+-    glfw ${GLFW_LIBRARIES}
++    ${GLFW_LIBRARIES}
+   )
+ 
+   if(APPLE)
+@@ -330,15 +330,9 @@ add_definitions(-DNOMINMAX)
+ 
+ # Include settings
+ target_include_directories(polyscope PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../include")
+-target_include_directories(polyscope PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../deps/glm")
+-#target_include_directories(polyscope PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../deps/args") # not used, polyscope generates no apps directly
+-target_include_directories(polyscope PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../deps/happly")
+-target_include_directories(polyscope PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../deps/MarchingCubeCpp")
+-target_include_directories(polyscope PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../deps/json/include")
+-target_include_directories(polyscope PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../deps/stb")
+ target_include_directories(polyscope PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../deps/MarchingCubeCpp/include")
+-target_include_directories(polyscope PRIVATE "${BACKEND_INCLUDE_DIRS}")
+         
+ # Link settings
+ target_link_libraries(polyscope PUBLIC imgui)
+ target_link_libraries(polyscope PRIVATE "${BACKEND_LIBS}" stb)
++install(TARGETS polyscope LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin)
+diff --git a/src/polyscope.cpp b/src/polyscope.cpp
+index 914d587..f4ccf92 100644
+--- a/src/polyscope.cpp
++++ b/src/polyscope.cpp
+@@ -16,7 +16,7 @@
+ 
+ #include "stb_image.h"
+ 
+-#include "json/json.hpp"
++#include "nlohmann/json.hpp"
+ using json = nlohmann::json;
+ 
+ #include "backends/imgui_impl_opengl3.h"
+diff --git a/src/transformation_gizmo.cpp b/src/transformation_gizmo.cpp
+index 25c25f8..36fedfd 100644
+--- a/src/transformation_gizmo.cpp
++++ b/src/transformation_gizmo.cpp
+@@ -4,8 +4,10 @@
+ 
+ #include "polyscope/polyscope.h"
+ 
++#define GLM_ENABLE_EXPERIMENTAL
+ #include <glm/gtc/matrix_transform.hpp>
+ #include <glm/gtx/transform.hpp>
++#undef GLM_ENABLE_EXPERIMENTAL
+ 
+ #include <cmath>
+ 
+diff --git a/src/view.cpp b/src/view.cpp
+index 5d3c60b..dd03ef0 100644
+--- a/src/view.cpp
++++ b/src/view.cpp
+@@ -7,7 +7,7 @@
+ 
+ #include "imgui.h"
+ 
+-#include "json/json.hpp"
++#include "nlohmann/json.hpp"
+ using json = nlohmann::json;
+ 
+ namespace polyscope {

+ 5 - 3
packages/p/polyscope/xmake.lua

@@ -6,17 +6,19 @@ package("polyscope")
 
     add_urls("https://github.com/nmwsharp/polyscope/archive/refs/tags/$(version).tar.gz",
              "https://github.com/nmwsharp/polyscope.git")
+    add_versions("v2.1.0", "bdad2daab33a44b3b6424cec82b43cecb842b529769fd0df3bf7d8e616cea34c")
     add_versions("v1.3.0", "c0d3594b1c818c6e7efe2c2589d71f5e254db383d36a92555aa909a2114f12d4")
 
-    add_patches("1.3.0", path.join(os.scriptdir(), "patches", "v1.3.0", "deps.patch"), "2d183713be791deddcfb48e4546793f584071eb1aa7a045e03c7ceed841470c8")
-    add_patches("1.3.0", path.join(os.scriptdir(), "patches", "v1.3.0", "imgui.patch"), "e7865d6de85103098cdc25ab8a0e94dd26fb5f718609f20093b91891cc8f21e1")
+    add_patches("2.1.0", "patches/v2.1.0/deps.patch", "01bc0b31193e65b8cc079d9f232f73fb995b3cfd276840add58a01dfcf477cc8")
+    add_patches("1.3.0", "patches/v1.3.0/deps.patch", "2d183713be791deddcfb48e4546793f584071eb1aa7a045e03c7ceed841470c8")
+    add_patches("1.3.0", "patches/v1.3.0/imgui.patch", "e7865d6de85103098cdc25ab8a0e94dd26fb5f718609f20093b91891cc8f21e1")
 
     if is_plat("windows") then
         add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
     end
 
     add_deps("cmake")
-    add_deps("imgui <=1.86", {configs = {glfw_opengl3 = true}})
+    add_deps("imgui <=1.86", {configs = {glfw = true, opengl3 = true}})
     add_deps("glad", "glfw", "glm", "happly", "nlohmann_json", "stb")
     on_install("windows", "macosx", "linux", function (package)
         os.mv("deps/stb/stb_impl.cpp", "deps/stb_impl.cpp")

+ 1 - 0
packages/s/stb/xmake.lua

@@ -8,6 +8,7 @@ package("stb")
     add_versions("2021.07.13", "3a1174060a7dd4eb652d4e6854bc4cd98c159200")
     add_versions("2021.09.10", "af1a5bc352164740c1cc1354942b1c6b72eacb8a")
     add_versions("2023.01.30", "5736b15f7ea0ffb08dd38af21067c314d6a3aae9")
+    add_versions("2023.12.15", "f4a71b13373436a2866c5d68f8f80ac6f0bc1ffe")
     
     if is_plat("mingw") and is_subhost("msys") then
         add_extsources("pacman::stb")