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

Adding imgui-node-editor and imguifiledialog #21650

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 30 additions & 0 deletions recipes/imgui-node-editor/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.4)
project(imgui-node-editor LANGUAGES CXX)

file(GLOB HEADER_FILES ${IMGUI_NODE_EDITOR_SRC_DIR}/*.h)

add_library(${PROJECT_NAME}
${IMGUI_NODE_EDITOR_SRC_DIR}/crude_json.cpp
${IMGUI_NODE_EDITOR_SRC_DIR}/imgui_canvas.cpp
${IMGUI_NODE_EDITOR_SRC_DIR}/imgui_node_editor.cpp
${IMGUI_NODE_EDITOR_SRC_DIR}/imgui_node_editor_api.cpp
)
target_include_directories(${PROJECT_NAME} PRIVATE ${IMGUI_NODE_EDITOR_SRC_DIR})

find_package(imgui CONFIG REQUIRED)

target_link_libraries(${PROJECT_NAME} PUBLIC imgui::imgui)

target_compile_definitions(${PROJECT_NAME} PRIVATE IMGUI_DEFINE_MATH_OPERATORS)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)

include(GNUInstallDirs)

install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
4 changes: 4 additions & 0 deletions recipes/imgui-node-editor/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"0.9.3":
url: "https://github.com/thedmd/imgui-node-editor/archive/refs/tags/v0.9.3.tar.gz"
sha256: "efe3e35dea4e769fca8477c4ec26c1c8566c81c58a9bb6ab430cc2890d3276ca"
68 changes: 68 additions & 0 deletions recipes/imgui-node-editor/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import get, copy
from conan.tools.scm import Version
from conan.tools.microsoft import is_msvc
import os

required_conan_version = ">=1.54"

class ImguiNodeEditorConan(ConanFile):
name = "imgui-node-editor"
description = "Node Editor in ImGui"
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/thedmd/imgui-node-editor"
topics = ("imgui", "node", "graph", )
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}

def export_sources(self):
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)

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

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

def requirements(self):
self.requires("imgui/cci.20230105+1.89.2.docking",transitive_headers=True)

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

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

def generate(self):
tc = CMakeToolchain(self)
tc.variables["IMGUI_NODE_EDITOR_SRC_DIR"] = self.source_folder.replace("\\", "/")
tc.generate()
deps = CMakeDeps(self)
deps.generate()

def build(self):
cmake = CMake(self)
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
cmake.build()

def package(self):
copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
copy(self, pattern="*.cpp", dst=os.path.join(self.package_folder, "res", "src"), src=self.source_folder)
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = ["imgui-node-editor"]
9 changes: 9 additions & 0 deletions recipes/imgui-node-editor/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.4)
project(test_package)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(imgui-node-editor CONFIG REQUIRED)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} imgui-node-editor::imgui-node-editor)
27 changes: 27 additions & 0 deletions recipes/imgui-node-editor/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run


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

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

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

def layout(self):
cmake_layout(self)

def test(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(cmd, env="conanrun")
6 changes: 6 additions & 0 deletions recipes/imgui-node-editor/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <imgui_node_editor.h>

int main() {
ax::NodeEditor::GetCurrentEditor();
return 0;
}
8 changes: 8 additions & 0 deletions recipes/imgui-node-editor/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.4)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
23 changes: 23 additions & 0 deletions recipes/imgui-node-editor/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os

from conans import ConanFile, CMake
from conans.tools import cross_building


class ImguiNodeEditorTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package_multi"
test_type = "explicit"

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

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

def test(self):
if not cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
3 changes: 3 additions & 0 deletions recipes/imgui-node-editor/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.9.3":
folder: "all"
27 changes: 27 additions & 0 deletions recipes/imguifiledialog/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.4)
project(imguifiledialog LANGUAGES CXX)

file(GLOB HEADER_FILES ${IMGUIFILEDIALOG_SRC_DIR}/*.h)

add_library(${PROJECT_NAME}
${IMGUIFILEDIALOG_SRC_DIR}/ImGuiFileDialog.cpp
)
target_include_directories(${PROJECT_NAME} PRIVATE ${IMGUIFILEDIALOG_SRC_DIR})

find_package(imgui CONFIG REQUIRED)

target_link_libraries(${PROJECT_NAME} PUBLIC imgui::imgui)

target_compile_definitions(${PROJECT_NAME} PRIVATE IMGUI_DEFINE_MATH_OPERATORS)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)

include(GNUInstallDirs)

install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
4 changes: 4 additions & 0 deletions recipes/imguifiledialog/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"0.6.6.1":
url: "https://github.com/aiekick/ImGuiFileDialog/archive/refs/tags/v0.6.6.1.tar.gz"
sha256: "7267e1113d5f1dcef83809b3a1ad1d4a0262594dc62448d8bbf777b6bd7986a5"
68 changes: 68 additions & 0 deletions recipes/imguifiledialog/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import get, copy
from conan.tools.scm import Version
from conan.tools.microsoft import is_msvc
import os

required_conan_version = ">=1.54"

class ImguiFileDialogConan(ConanFile):
name = "imguifiledialog"
description = "ImGuiFileDialog is a file selection dialog built for Dear ImGui."
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/aiekick/ImGuiFileDialog"
topics = ("imgui", "dialog", "filesystem", )
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}

def export_sources(self):
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)

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

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

def requirements(self):
self.requires("imgui/cci.20230105+1.89.2.docking",transitive_headers=True)

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

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

def generate(self):
tc = CMakeToolchain(self)
tc.variables["IMGUIFILEDIALOG_SRC_DIR"] = self.source_folder.replace("\\", "/")
tc.generate()
deps = CMakeDeps(self)
deps.generate()

def build(self):
cmake = CMake(self)
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
cmake.build()

def package(self):
copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
copy(self, pattern="*.cpp", dst=os.path.join(self.package_folder, "res", "src"), src=self.source_folder)
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = ["imguifiledialog"]
9 changes: 9 additions & 0 deletions recipes/imguifiledialog/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.4)
project(test_package)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(imguifiledialog CONFIG REQUIRED)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} imguifiledialog::imguifiledialog)
27 changes: 27 additions & 0 deletions recipes/imguifiledialog/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run


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

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

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

def layout(self):
cmake_layout(self)

def test(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(cmd, env="conanrun")
6 changes: 6 additions & 0 deletions recipes/imguifiledialog/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <ImGuiFileDialog.h>

int main() {
ImGuiFileDialog::Instance();
return 0;
}
8 changes: 8 additions & 0 deletions recipes/imguifiledialog/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.4)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
23 changes: 23 additions & 0 deletions recipes/imguifiledialog/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os

from conans import ConanFile, CMake
from conans.tools import cross_building


class ImguiFileDialogTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package_multi"
test_type = "explicit"

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

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

def test(self):
if not cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
3 changes: 3 additions & 0 deletions recipes/imguifiledialog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.6.6.1":
folder: "all"