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

Add imgui module #210

Merged
merged 4 commits into from
Nov 28, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/actions/f3d-superbuild/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ runs:
-DBUILD_SHARED_LIBS_draco=OFF
-DBUILD_SHARED_LIBS_openexr=OFF
-DBUILD_SHARED_LIBS_imath=OFF
-DBUILD_SHARED_LIBS_imgui=OFF
-DBUILD_SHARED_LIBS_occt=OFF
-DBUILD_SHARED_LIBS_openusd=ON
-DBUILD_SHARED_LIBS_openvdb=OFF
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/wheels/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ runs:
shell: bash
run: |
echo "CMAKE_PREFIX_PATH=../fsbb/install" >> $GITHUB_ENV
echo "SKBUILD_CMAKE_ARGS=-DF3D_DEPENDENCIES_DIR=${{ env.ESCAPED_WS }}/fsbb/install/bin;-DF3D_PLUGIN_BUILD_ALEMBIC=ON;-DF3D_PLUGIN_BUILD_ASSIMP=ON;-DF3D_PLUGIN_BUILD_DRACO=ON;-DF3D_PLUGIN_BUILD_OCCT=ON;-DF3D_PLUGIN_OCCT_COLORING_SUPPORT=ON;-DF3D_MODULE_EXR=ON;-DF3D_WINDOWS_GUI=OFF;-DF3D_MACOS_BUNDLE=OFF" >> $GITHUB_ENV
echo "SKBUILD_CMAKE_ARGS=-DF3D_DEPENDENCIES_DIR=${{ env.ESCAPED_WS }}/fsbb/install/bin;-DF3D_PLUGIN_BUILD_ALEMBIC=ON;-DF3D_PLUGIN_BUILD_ASSIMP=ON;-DF3D_PLUGIN_BUILD_DRACO=ON;-DF3D_PLUGIN_BUILD_OCCT=ON;-DF3D_PLUGIN_OCCT_COLORING_SUPPORT=ON;-DF3D_MODULE_EXR=ON;-DF3D_MODULE_UI=ON;-DF3D_WINDOWS_GUI=OFF;-DF3D_MACOS_BUNDLE=OFF" >> $GITHUB_ENV

- name: Build superbuild and wheels
if: |
Expand Down
1 change: 1 addition & 0 deletions .github/actions/wheels/build_f3d_superbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmake -S ./source -B ./fsbb \
-DENABLE_alembic=ON \
-DENABLE_assimp=ON \
-DENABLE_draco=ON \
-DENABLE_imgui=ON \
-DENABLE_occt=ON \
-DENABLE_openexr=ON \
-DENABLE_openusd=OFF \
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function (superbuild_find_projects var)
f3d
hdf5
imath
imgui
ispc
lz4
netcdf
Expand Down Expand Up @@ -136,6 +137,7 @@ set(_superbuild_default_alembic ON)
set(_superbuild_default_assimp ON)
set(_superbuild_default_draco ON)
set(_superbuild_default_exodus ON)
set(_superbuild_default_imgui ON)
set(_superbuild_default_occt ON)
set(_superbuild_default_openvdb ON)
set(_superbuild_default_openexr ON)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ This repository also generate a nightly release of F3D.
- `ENABLE_alembic`: ON by defaut, build and package alembic and the associated F3D plugin
- `ENABLE_assimp`: ON by defaut, build and package assimp and the associated F3D plugin
- `ENABLE_draco`: ON by defaut, build and package draco and the associated F3D plugin
- `ENABLE_imgui`: ON by default, build and package imgui and the associated F3D module
- `ENABLE_occt`: ON by defaut, build and package occt and the associated F3D plugin
- `ENABLE_openexr`: ON by default, build and package OpenEXR and the associated VTK module
- `ENABLE_openexr`: ON by default, build and package OpenEXR and the associated F3D module
- `ENABLE_ospray`: ON by defaut, build and package ospray and the associated VTK module
- `ENABLE_tbb`: ON by default, build and package TBB to enable multi-threading
- `ENABLE_pybind11`: OFF by defaut, build pybind11 and F3D python bindings, not packageable
Expand Down
3 changes: 2 additions & 1 deletion projects/f3d.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ superbuild_add_project(f3d
LICENSE.md
doc/THIRD_PARTY_LICENSES.md
DEPENDS vtk cxx17
DEPENDS_OPTIONAL pybind11 alembic assimp draco occt openexr openusd openvdb
DEPENDS_OPTIONAL pybind11 alembic assimp draco imgui occt openexr openusd openvdb
CMAKE_ARGS
-DCMAKE_INSTALL_NAME_DIR:PATH=<INSTALL_DIR>/lib
-DF3D_LINUX_GENERATE_MAN:BOOL=${f3d_build_for_linux}
-DF3D_LINUX_INSTALL_DEFAULT_CONFIGURATION_FILE_IN_PREFIX:BOOL=${f3d_build_for_linux}
-DF3D_MACOS_BUNDLE:BOOL=${f3d_build_for_macos}
-DF3D_MODULE_EXR:BOOL=${openexr_enabled}
-DF3D_MODULE_RAYTRACING:BOOL=${ospray_enabled}
-DF3D_MODULE_UI:BOOL=${imgui_enabled}
-DF3D_PLUGINS_STATIC_BUILD:BOOL=ON
-DF3D_PLUGIN_BUILD_ALEMBIC:BOOL=${alembic_enabled}
-DF3D_PLUGIN_BUILD_ASSIMP:BOOL=${assimp_enabled}
Expand Down
7 changes: 7 additions & 0 deletions projects/imgui.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
superbuild_add_project(imgui
BUILD_SHARED_LIBS_INDEPENDENT
LICENSE_FILES
LICENSE.txt
)

superbuild_apply_patch(imgui cmake-build "Add CMake build system")
109 changes: 109 additions & 0 deletions projects/patches/imgui-cmake-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
commit cab05d14c0ef97e286971f388df2f656642e6835
Author: Michael Migliore <[email protected]>
Date: Thu Nov 28 09:20:46 2024 +0100

Add CMake build system

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..dbb79cd0
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,71 @@
+cmake_minimum_required(VERSION 3.16)
+project(imgui CXX)
+
+add_library(${PROJECT_NAME} "")
+
+include(GenerateExportHeader)
+generate_export_header(${PROJECT_NAME}
+ EXPORT_FILE_NAME imgui_export.h
+ EXPORT_MACRO_NAME IMGUI_API)
+
+target_include_directories(
+ ${PROJECT_NAME}
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ $<INSTALL_INTERFACE:include>
+)
+
+target_sources(
+ ${PROJECT_NAME}
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui_draw.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui_tables.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui_widgets.cpp
+)
+
+target_compile_definitions(
+ ${PROJECT_NAME}
+ PRIVATE
+ IMGUI_DISABLE_DEMO_WINDOWS
+ IMGUI_DISABLE_DEBUG_TOOLS
+)
+
+set_target_properties(
+ ${PROJECT_NAME}
+ PROPERTIES
+ CXX_STANDARD 11
+ POSITION_INDEPENDENT_CODE ON
+)
+
+install(
+ TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}_target
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+)
+
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/imgui_export.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imconfig.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui_internal.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imstb_textedit.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imstb_rectpack.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imstb_truetype.h
+ DESTINATION include
+)
+
+include(CMakePackageConfigHelpers)
+configure_package_config_file(imgui-config.cmake.in imgui-config.cmake INSTALL_DESTINATION share/imgui)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/imgui-config.cmake DESTINATION share/imgui)
+
+install(
+ EXPORT ${PROJECT_NAME}_target
+ NAMESPACE ${PROJECT_NAME}::
+ FILE ${PROJECT_NAME}-targets.cmake
+ DESTINATION share/${PROJECT_NAME}
+)
diff --git a/imgui-config.cmake.in b/imgui-config.cmake.in
new file mode 100644
index 00000000..b9e55800
--- /dev/null
+++ b/imgui-config.cmake.in
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0012 NEW)
+
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+
+include("${CMAKE_CURRENT_LIST_DIR}/imgui-targets.cmake")
diff --git a/imgui.h b/imgui.h
index d6286592..c91cb811 100644
--- a/imgui.h
+++ b/imgui.h
@@ -65,6 +65,8 @@ Index of this file:

#ifndef IMGUI_DISABLE

+#include "imgui_export.h"
mwestphal marked this conversation as resolved.
Show resolved Hide resolved
+
//-----------------------------------------------------------------------------
// [SECTION] Header mess
//-----------------------------------------------------------------------------
4 changes: 2 additions & 2 deletions testing/baselines/TestAlembic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestAssimp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestDraco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestOCCT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestOCCTColoring.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestOSPRay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestRenderingGLX.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestRenderingHeadlessEGL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestRenderingHeadlessOSMESA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestRenderingWGL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestSimple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestSimpleColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestSplat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestUSD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions testing/baselines/TestVDB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions versions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ superbuild_set_revision(openvdb
DOWNLOAD_NAME openvdb-v11.0.0.tar.gz
URL_MD5 025f4fc4db58419341a4991f1a16174a)

superbuild_set_revision(imgui
URL "https://github.com/ocornut/imgui/archive/refs/tags/v1.91.5.tar.gz"
DOWNLOAD_NAME imgui-v1.91.5.tar.gz
URL_MD5 264b2c35eaa1ab1595eb9afe080b4e1a)

superbuild_set_selectable_source(vtk
SELECT 9.3.1 DEFAULT
URL "https://www.vtk.org/files/release/9.3/VTK-9.3.1.tar.gz"
Expand Down