Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iridescence: new package #24669

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
01c271c
iridescence: new recipe
valgur Apr 9, 2024
891e990
iridescence: add support for latest, non-docking version of imgui
valgur Apr 9, 2024
a243f95
iridescence: drop unused imgui_docking option
valgur Apr 9, 2024
89a24f5
iridescence: adjust CMake file and target name
valgur Apr 9, 2024
4c4ff81
iridescence: fix an invalid libpng include
valgur Apr 21, 2024
cf76118
iridescence: bump imgui
valgur Apr 21, 2024
94b4250
iridescence: revert libglvnd use
valgur Apr 21, 2024
e11e2f5
iridescence: use correct CMake targets in test_package
valgur Apr 21, 2024
6fc3c79
iridescence: enable static builds
valgur Apr 21, 2024
9b6c8f9
iridescence: drop force=True from imgui
valgur Apr 21, 2024
e4edcd5
iridescence: add khrplatform dependency
valgur Apr 21, 2024
949c55a
iridescence: fix a missing #include <vector>
valgur Apr 21, 2024
955d8e0
iridescence: fix conflicts with windows defines
valgur Apr 22, 2024
3cce444
iridescence: require VS 17
valgur Apr 22, 2024
82e80bc
iridescence: bump assimp
valgur May 21, 2024
cc35a96
iridescence: MSVC is not supported
valgur May 26, 2024
1c4164f
iridescence: update to cci.20240709
valgur Jul 18, 2024
a4c12f5
iridescence: adjust min compiler versions for <filesystem>
valgur Jul 24, 2024
5e254b3
iridescence: bump to v0.1.2
valgur Aug 5, 2024
bb69b72
iridescence: add newer CMake
valgur Aug 5, 2024
52443a8
Merge remote-tracking branch 'upstream/master' into new/iridescence
valgur Aug 22, 2024
149730e
iridescence: bump to v0.1.3
valgur Aug 22, 2024
cb524cc
iridescence: bump assimp version
AbrilRBS Aug 23, 2024
8610adc
iridescence: update glm version
valgur Aug 23, 2024
0bfda7d
iridescence: remove merged fixes
valgur Aug 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions recipes/iridescence/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sources:
"0.1.3":
url: "https://github.com/koide3/iridescence/archive/refs/tags/v0.1.3.tar.gz"
sha256: "986305710ba7903f9106cd3fadd82661a1f16300a18a5be4014a185ef17f637f"
patches:
"0.1.3":
- patch_file: "patches/001-unvendor-deps.patch"
patch_description: "Use dependencies from Conan"
patch_type: "conan"
- patch_file: "patches/002-fix-guik-includes.patch"
patch_description: "Fix a missing include in guik/screen_capture.cpp"
patch_type: "bugfix"
148 changes: 148 additions & 0 deletions recipes/iridescence/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, rename, replace_in_file
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version
import os

required_conan_version = ">=1.53.0"


class IridescenceConan(ConanFile):
name = "iridescence"
description = "3D visualization library for rapid prototyping of 3D algorithms"
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://koide3.github.io/iridescence"
topics = ("visualization", "imgui", "opengl", "localization", "mapping", "point-cloud", "slam")

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}

@property
def _min_cppstd(self):
return 17

@property
def _compilers_minimum_version(self):
return {
"gcc": "9",
"clang": "9",
"apple-clang": "11",
"Visual Studio": "16",
"msvc": "192",
}

def export_sources(self):
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("assimp/5.4.2")
self.requires("boost/1.84.0", transitive_headers=True)
self.requires("eigen/3.4.0", transitive_headers=True)
self.requires("glm/1.0.1")
self.requires("libjpeg/9e")
self.requires("libpng/[>=1.6 <2]")
self.requires("portable-file-dialogs/0.1.0", transitive_headers=True)
# Upstream uses -docking version of imgui, but it would cause version conflicts on CCI
self.requires("imgui/1.90.5", transitive_headers=True, transitive_libs=True)
self.requires("imguizmo/cci.20231114")
self.requires("implot/0.16")
self.requires("glfw/3.4", transitive_headers=True, transitive_libs=True)
self.requires("opengl/system")
# https://github.com/koide3/iridescence/blob/7034275ee6516eb4d155f645cd8327173edfeb9d/thirdparty/gl3w/GL/glcorearb.h#L82
self.requires("khrplatform/cci.20200529", transitive_headers=True)

def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)

if is_msvc(self):
# Build fails with several compilation errors
raise ConanInvalidConfiguration("MSVC is not supported")
if self.settings.os == "Windows" and self.options.shared:
raise ConanInvalidConfiguration("Shared builds are not supported on Windows")

def build_requirements(self):
self.tool_requires("cmake/[>=3.16 <4]")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
tc.variables["IMGUI_BACKENDS"] = os.path.join(self.dependencies["imgui"].package_folder, "res", "bindings").replace("\\", "/")
tc.variables["BUILD_EXAMPLES"] = "OFF"
tc.variables["BUILD_PYTHON_BINDINGS"] = "OFF"
tc.variables["BUILD_WITH_MARCH_NATIVE"] = "OFF"
tc.variables["BUILD_EXT_TESTS"] = "OFF"
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
if "docking" not in str(self.dependencies["imgui"].ref.version):
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
tc.preprocessor_definitions["ImGuiConfigFlags_DockingEnable"] = "0"
tc.generate()

deps = CMakeDeps(self)
deps.generate()

VirtualBuildEnv(self).generate()

def _patch_sources(self):
apply_conandata_patches(self)
if Version(self.dependencies["imgui"].ref.version) >= "1.90":
# https://github.com/ocornut/imgui/blob/master/imgui.cpp#L460
replace_in_file(self, os.path.join(self.source_folder, "src", "guik", "viewer", "viewer_ui.cpp"),
"ImGui::GetWindowContentRegionWidth()",
"(ImGui::GetWindowContentRegionMax().x - ImGui::GetWindowContentRegionMin().x)")

def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
rename(self, os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "Iridescence")
self.cpp_info.set_property("cmake_target_name", "Iridescence::Iridescence")

self.cpp_info.libs = ["iridescence"]
self.cpp_info.includedirs.append(os.path.join("include", "iridescence"))

if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.extend(["m", "pthread", "dl"])
96 changes: 96 additions & 0 deletions recipes/iridescence/all/patches/001-unvendor-deps.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,12 +26,18 @@

find_package(OpenGL REQUIRED)

-find_package(glm)
-find_package(glfw3)
-find_package(Eigen3)
-find_package(PNG)
-find_package(JPEG)
-find_package(assimp QUIET)
+find_package(glm REQUIRED)
+find_package(glfw3 REQUIRED)
+find_package(Eigen3 REQUIRED)
+find_package(PNG REQUIRED)
+find_package(JPEG REQUIRED)
+find_package(assimp REQUIRED)
+
+find_package(imgui REQUIRED CONFIG)
+find_package(imguizmo REQUIRED CONFIG)
+find_package(implot REQUIRED CONFIG)
+find_package(portable-file-dialogs REQUIRED CONFIG)
+find_package(khrplatform REQUIRED CONFIG)
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved

if(NOT glm_FOUND)
message(STATUS "System GLM not found. Download GLM 1.0.1.")
@@ -94,7 +100,7 @@
endif()

if(${assimp_FOUND})
- list(APPEND EXTRA_LIBRARIES assimp)
+ list(APPEND EXTRA_LIBRARIES assimp::assimp)
list(APPEND EXTRA_SOURCE src/glk/io/mesh_io.cpp)
endif()

@@ -115,20 +121,8 @@
add_library(iridescence
# GL and IMGUI
thirdparty/gl3w/gl3w.cpp
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
- thirdparty/imgui/imgui.cpp
- thirdparty/imgui/imgui_demo.cpp
- thirdparty/imgui/imgui_draw.cpp
- thirdparty/imgui/imgui_tables.cpp
- thirdparty/imgui/imgui_widgets.cpp
- thirdparty/ImGuizmo/ImCurveEdit.cpp
- thirdparty/ImGuizmo/ImGradient.cpp
- thirdparty/ImGuizmo/ImGuizmo.cpp
- thirdparty/ImGuizmo/ImSequencer.cpp
- thirdparty/implot/implot.cpp
- thirdparty/implot/implot_demo.cpp
- thirdparty/implot/implot_items.cpp
- thirdparty/imgui/backends/imgui_impl_glfw.cpp
- thirdparty/imgui/backends/imgui_impl_opengl3.cpp
+ ${IMGUI_BACKENDS}/imgui_impl_glfw.cpp
+ ${IMGUI_BACKENDS}/imgui_impl_opengl3.cpp
# glk
src/glk/path_std.cpp
src/glk/mesh.cpp
@@ -195,19 +189,19 @@
)
target_include_directories(iridescence PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/imgui>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/imgui/examples>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/imgui/backends>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ImGuizmo>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/implot>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/portable-file-dialogs>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gl3w>
$<INSTALL_INTERFACE:include/iridescence>
+ ${IMGUI_BACKENDS}
)
target_link_libraries(iridescence PUBLIC
Eigen3::Eigen
OpenGL::GL
glfw
+ imgui::imgui
+ imguizmo::imguizmo
+ implot::implot
+ portable-file-dialogs::portable-file-dialogs
+ khrplatform::khrplatform
${EXTRA_LIBRARIES}
)
target_link_libraries(iridescence PRIVATE
@@ -287,10 +281,6 @@

install(DIRECTORY include/ DESTINATION ${INCLUDE_INSTALL_DIR})
install(DIRECTORY thirdparty/gl3w/GL/ DESTINATION ${INCLUDE_INSTALL_DIR}/GL)
-install(FILES thirdparty/imgui/imgui.h thirdparty/imgui/imconfig.h thirdparty/imgui/imgui_internal.h thirdparty/imgui/imstb_textedit.h DESTINATION ${INCLUDE_INSTALL_DIR})
-install(FILES thirdparty/implot/implot.h thirdparty/implot/implot_internal.h DESTINATION ${INCLUDE_INSTALL_DIR})
-install(FILES thirdparty/portable-file-dialogs/portable-file-dialogs.h DESTINATION ${INCLUDE_INSTALL_DIR})
-install(FILES thirdparty/ImGuizmo/ImGuizmo.h DESTINATION ${INCLUDE_INSTALL_DIR})
install(DIRECTORY data/ DESTINATION ${CMAKE_INSTALL_DATADIR}/iridescence/data)

install(TARGETS iridescence
12 changes: 12 additions & 0 deletions recipes/iridescence/all/patches/002-fix-guik-includes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- include/guik/screen_capture.hpp
+++ include/guik/screen_capture.hpp
@@ -6,6 +6,9 @@
#include <atomic>
#include <thread>
#include <iostream>
+#include <string>
+#include <utility>
+#include <vector>
#include <Eigen/Core>
#include <guik/concurrent_queue.hpp>

8 changes: 8 additions & 0 deletions recipes/iridescence/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)

find_package(Iridescence REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE Iridescence::Iridescence)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
26 changes: 26 additions & 0 deletions recipes/iridescence/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")
29 changes: 29 additions & 0 deletions recipes/iridescence/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <glk/primitives/primitives.hpp>
#include <guik/viewer/light_viewer.hpp>

void test() {
auto viewer = guik::LightViewer::instance();

float angle = 0.0f;

viewer->register_ui_callback("ui", [&]() {
ImGui::DragFloat("Angle", &angle, 0.01f);

if (ImGui::Button("Close")) {
viewer->close();
}
});

while (viewer->spin_once()) {
Eigen::AngleAxisf transform(angle, Eigen::Vector3f::UnitZ());
viewer->update_drawable("sphere", glk::Primitives::sphere(), guik::Rainbow(transform));
viewer->update_drawable("wire_sphere", glk::Primitives::wire_sphere(), guik::FlatColor({0.1f, 0.7f, 1.0f, 1.0f}, transform));
}
}

int main(int argc, char* argv[]) {
if(argc > 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call!

test();
}
return 0;
}
3 changes: 3 additions & 0 deletions recipes/iridescence/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.1.3":
folder: all
Loading