Skip to content

Commit 301390c

Browse files
committed
[imgui] Add options to use system imgui
(cherry picked from commit cef093a)
1 parent 9238119 commit 301390c

File tree

27 files changed

+720
-79
lines changed

27 files changed

+720
-79
lines changed

.github/workflows/ci_macos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
COMPILER: clang
3535
BUILD_TYPE: ${{ matrix.build_type }}
3636
BUILD_DARTPY: ON
37+
DART_USE_SYSTEM_IMGUI: OFF
3738
IN_CI: ON
3839
ENABLE_SIMD: ${{ matrix.enable_simd }}
3940
steps:

.github/workflows/ci_ubuntu.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5656
CHECK_FORMAT: ${{ matrix.check_format }}
5757
ENABLE_SIMD: ${{ matrix.enable_simd }}
58+
DART_USE_SYSTEM_IMGUI: OFF
5859
IN_CI: ON
5960
IN_DOCKER: ON
6061
steps:

.github/workflows/ci_windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
-DDART_MSVC_DEFAULT_OPTIONS=ON ^
6363
-DDART_VERBOSE=ON ^
6464
-DBUILD_SHARED_LIBS=${{ matrix.build_shared_libs }} ^
65+
-DDART_USE_SYSTEM_IMGUI=OFF ^
6566
|| exit /b
6667
cmake ^
6768
--build build ^

.github/workflows/publish_dartpy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
if: ${{ matrix.os == 'windows-latest' && (matrix.release_only == false || github.ref == 'refs/heads/main') }}
100100
uses: johnwason/vcpkg-action@v6
101101
with:
102-
pkgs: assimp ccd eigen3 fcl fmt spdlog bullet3 coin-or-ipopt freeglut glfw3 nlopt ode opengl osg pagmo2 tinyxml2 urdfdom
102+
pkgs: assimp ccd eigen3 fcl fmt spdlog bullet3 coin-or-ipopt freeglut glfw3 imgui nlopt ode opengl osg pagmo2 tinyxml2 urdfdom
103103
triplet: x64-windows
104104
revision: "2024.02.14"
105105
github-binarycache: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ dist/
7070

7171
# pixi environments
7272
.pixi
73+
74+
# ImGui configuration
75+
imgui.ini

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ dart_option(DART_FAST_DEBUG "Add -O1 option for DEBUG mode build" OFF)
102102
# See: https://medium.com/@alasher/colored-c-compiler-output-with-ninja-clang-gcc-10bfe7f2b949
103103
dart_option(DART_FORCE_COLORED_OUTPUT
104104
"Always produce ANSI-colored output (GNU/Clang only)." OFF)
105+
dart_option(DART_USE_SYSTEM_IMGUI "Use system ImGui" OFF)
105106
dart_option(DART_IN_CI "Indicate building DART as part of CI" OFF)
106107

107108
#===============================================================================

cmake/DARTFindimgui.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2011-2024, The DART development contributors
2+
# All rights reserved.
3+
#
4+
# The list of contributors can be found at:
5+
# https://github.com/dartsim/dart/blob/main/LICENSE
6+
#
7+
# This file is provided under the "BSD-style" License
8+
9+
find_package(imgui CONFIG)
10+
11+
if(NOT imgui_FOUND)
12+
find_package(imgui REQUIRED MODULE)
13+
endif()
14+
15+
if(imgui_FOUND AND NOT TARGET imgui::imgui)
16+
add_library(imgui::imgui INTERFACE IMPORTED)
17+
set_target_properties(imgui::imgui PROPERTIES
18+
INTERFACE_INCLUDE_DIRECTORIES "${imgui_INCLUDE_DIRS}"
19+
INTERFACE_LINK_LIBRARIES "${imgui_LIBRARIES}"
20+
)
21+
endif()

cmake/Findimgui.cmake

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (c) 2011-2024, The DART development contributors
2+
# All rights reserved.
3+
#
4+
# The list of contributors can be found at:
5+
# https://github.com/dartsim/dart/blob/main/LICENSE
6+
#
7+
# This file is provided under the "BSD-style" License
8+
9+
# Find imgui
10+
#
11+
# This sets the following variables:
12+
# imgui_FOUND
13+
# imgui_INCLUDE_DIRS
14+
# imgui_LIBRARIES
15+
# imgui_VERSION
16+
17+
find_package(PkgConfig QUIET)
18+
19+
# Check to see if pkgconfig is installed.
20+
pkg_check_modules(PC_imgui imgui QUIET)
21+
22+
# Include directories
23+
find_path(imgui_INCLUDE_DIRS
24+
NAMES imgui.h
25+
HINTS ${PC_imgui_INCLUDEDIR}
26+
PATHS "${CMAKE_INSTALL_PREFIX}/include"
27+
)
28+
29+
# Library
30+
find_library(imgui_LIBRARIES
31+
NAMES imgui
32+
HINTS ${PC_imgui_LIBDIR}
33+
)
34+
35+
# Version
36+
if(PC_imgui_VERSION)
37+
set(imgui_VERSION ${PC_imgui_VERSION})
38+
endif()
39+
40+
# Set (NAME)_FOUND if all the variables and the version are satisfied.
41+
include(FindPackageHandleStandardArgs)
42+
find_package_handle_standard_args(imgui
43+
FAIL_MESSAGE DEFAULT_MSG
44+
REQUIRED_VARS imgui_INCLUDE_DIRS imgui_LIBRARIES
45+
VERSION_VAR imgui_VERSION
46+
)

dart/config.hpp.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,6 @@
8383
// BULLET_DEFINITIONS or generate a #cmakedefine header.
8484
#cmakedefine BT_USE_DOUBLE_PRECISION
8585

86+
#cmakedefine01 DART_USE_SYSTEM_IMGUI
87+
8688
#endif // #ifndef DART_CONFIG_HPP_

dart/external/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
add_subdirectory(convhull_3d)
2-
add_subdirectory(imgui)
2+
if(NOT DART_USE_SYSTEM_IMGUI)
3+
add_subdirectory(imgui)
4+
endif()
35
add_subdirectory(ikfast)
46
add_subdirectory(lodepng)
57
add_subdirectory(odelcpsolver)

0 commit comments

Comments
 (0)