@@ -287,54 +287,113 @@ add_library(spirv_cross OBJECT
287287target_compile_definitions (spirv_cross PUBLIC SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS )
288288
289289# cmake-git-version-tracking
290+ # note that checking if a repository is dirty may cost build time (especially a lot if like us you have a lot of submodules) - by default we run with all checks but if you want to increase build time iterations I recommend to exclude this check
291+ option (GIT_EXCLUDE_IS_DIRTY "Exclude IS_DIRTY from git tracking checks, will increase build time iterations at the expense of the meta information loss" OFF )
290292add_subdirectory (git-version-tracking EXCLUDE_FROM_ALL )
291293NBL_ADD_GIT_TRACKING_META_LIBRARY (nabla "${NBL_ROOT_PATH} " )
292294NBL_ADD_GIT_TRACKING_META_LIBRARY (dxc "${CMAKE_CURRENT_SOURCE_DIR} /dxc/dxc" )
293295NBL_GENERATE_GIT_TRACKING_META ()
294296
295297if (NBL_BUILD_IMGUI)
298+ set (NBL_IMGUI_ROOT "${CMAKE_CURRENT_SOURCE_DIR} /imgui" )
299+ set (NBL_IMGUI_TEST_ENGINE_PROJECT_ROOT "${THIRD_PARTY_SOURCE_DIR} /imgui_test_engine" )
300+ set (NBL_IMGUI_TEST_ENGINE_ROOT "${NBL_IMGUI_TEST_ENGINE_PROJECT_ROOT} /imgui_test_engine" )
301+ set (NBL_IMGUI_TEST_SUITE_ROOT "${NBL_IMGUI_TEST_ENGINE_PROJECT_ROOT} /imgui_test_suite" )
302+ set (NBL_IMPLOT_ROOT "${NBL_IMGUI_TEST_SUITE_ROOT} /thirdparty/implot" )
303+
296304 add_library (imgui STATIC
297- "imgui/imconfig.h"
298- "imgui/imgui_demo.cpp"
299- "imgui/imgui_draw.cpp"
300- "imgui/imgui_internal.h"
301- "imgui/imgui_tables.cpp"
302- "imgui/imgui_widgets.cpp"
303- "imgui/imgui.cpp"
304- "imgui/imgui.h"
305- "imgui/misc/cpp/imgui_stdlib.cpp"
306- "imgui/misc/cpp/imgui_stdlib.h"
307- "imgui/imstb_rectpack.h"
308- "imgui/imstb_textedit.h"
309- "imgui/imstb_truetype.h"
305+ "${NBL_IMGUI_ROOT} /imconfig.h"
306+ "${NBL_IMGUI_ROOT} /imgui_demo.cpp"
307+ "${NBL_IMGUI_ROOT} /imgui_draw.cpp"
308+ "${NBL_IMGUI_ROOT} /imgui_internal.h"
309+ "${NBL_IMGUI_ROOT} /imgui_tables.cpp"
310+ "${NBL_IMGUI_ROOT} /imgui_widgets.cpp"
311+ "${NBL_IMGUI_ROOT} /imgui.cpp"
312+ "${NBL_IMGUI_ROOT} /misc/freetype/imgui_freetype.cpp"
313+ "${NBL_IMGUI_ROOT} /imgui.h"
314+ "${NBL_IMGUI_ROOT} /misc/cpp/imgui_stdlib.cpp"
315+ "${NBL_IMGUI_ROOT} /misc/cpp/imgui_stdlib.h"
316+ "${NBL_IMGUI_ROOT} /imstb_rectpack.h"
317+ "${NBL_IMGUI_ROOT} /imstb_textedit.h"
318+ "${NBL_IMGUI_ROOT} /imstb_truetype.h"
310319 )
311- target_include_directories (imgui
312- PUBLIC "imgui"
313- PUBLIC "imgui/misc/cpp"
314- PUBLIC "imgui/backends"
320+
321+ target_link_libraries (imgui PUBLIC freetype )
322+
323+ target_include_directories (imgui PUBLIC
324+ "${NBL_IMGUI_ROOT} "
325+ "${NBL_IMGUI_ROOT} /misc/cpp"
326+ "${NBL_IMGUI_ROOT} /backends"
327+ "${NBL_IMGUI_TEST_SUITE_ROOT} "
328+ $<TARGET_PROPERTY :freetype ,INCLUDE_DIRECTORIES >
315329 )
316330
317- # ImPlot
318331 add_library (implot STATIC
319- "implot/implot.h"
320- "implot/implot_internal.h"
321- "implot/implot.cpp"
322- "implot/implot_items.cpp"
332+ "${NBL_IMPLOT_ROOT} /implot.h"
333+ "${NBL_IMPLOT_ROOT} /implot_internal.h"
334+ "${NBL_IMPLOT_ROOT} /implot.cpp"
335+ "${NBL_IMPLOT_ROOT} /implot_items.cpp"
336+ "${NBL_IMPLOT_ROOT} /implot_demo.cpp"
323337 )
338+
324339 target_include_directories (implot
325- PUBLIC "imgui"
340+ PUBLIC $<TARGET_PROPERTY :imgui ,INCLUDE_DIRECTORIES >
341+ PUBLIC "${NBL_IMPLOT_ROOT} "
326342 )
343+
327344 target_link_libraries (implot PUBLIC imgui )
328345 target_compile_definitions (implot PUBLIC IMPLOT_DEBUG IMPLOT_DLL_EXPORT )
329- set_property (TARGET implot PROPERTY CXX_STANDARD 11 )
346+ set_target_properties (implot PROPERTIES CXX_STANDARD 20 )
347+
330348 if (MSVC )
331349 target_compile_options (implot PRIVATE /MT /W4 /WX /arch:AVX2 /fp:fast /permissive- )
332350 else ()
333351 target_compile_options (implot PRIVATE -Wall -Wextra -pedantic -Werror -mavx2 -Ofast )
334352 endif ()
353+
354+ file (GLOB_RECURSE NBL_TEST_SUITE_SOURCES CONFIGURE_DEPENDS "${NBL_IMGUI_TEST_SUITE_ROOT} /imgui_test*.cpp" )
355+ file (GLOB_RECURSE NBL_TEST_SUITE_SOURCES CONFIGURE_DEPENDS "${NBL_IMGUI_TEST_SUITE_ROOT} /imgui_test*.cpp" )
356+
357+ add_library (imtestsuite STATIC
358+ ${NBL_TEST_SUITE_SOURCES}
359+ )
360+
361+ target_include_directories (imtestsuite PUBLIC
362+ "${NBL_IMGUI_TEST_ENGINE_PROJECT_ROOT} "
363+ "${NBL_IMGUI_TEST_ENGINE_ROOT} "
364+ "${NBL_IMGUI_TEST_SUITE_ROOT} "
365+ $<TARGET_PROPERTY :imgui ,INCLUDE_DIRECTORIES >
366+ $<TARGET_PROPERTY :implot ,INCLUDE_DIRECTORIES >
367+ )
368+
369+ set_target_properties (imtestsuite PROPERTIES CXX_STANDARD 14 ) # NOTE! THOSE TESTS DO NOT COMPILE WITH HIGHER STANDARDS SO WE WRAP SOURCES INTO LIBRARY COMPILED WITH LOWER ONE
370+ target_link_libraries (imtestsuite PUBLIC implot )
371+
372+ file (GLOB_RECURSE NBL_TEST_ENGINE_SOURCES CONFIGURE_DEPENDS "${NBL_IMGUI_TEST_ENGINE_ROOT} /*.cpp" )
373+
374+ add_library (imtestengine STATIC
375+ ${NBL_TEST_ENGINE_SOURCES}
376+ )
377+
378+ target_include_directories (imtestengine PUBLIC
379+ $<TARGET_PROPERTY :imtestsuite ,INCLUDE_DIRECTORIES >
380+ )
381+
382+ target_link_libraries (imtestengine PUBLIC imtestsuite )
335383
336384 set (IMGUIZMO_BUILD_EXAMPLE OFF )
337385 add_subdirectory (imguizmo EXCLUDE_FROM_ALL )
386+
387+ # note we override imgui config with our own
388+ set (NBL_IMGUI_USER_CONFIG_FILEPATH "${NBL_IMGUI_ROOT} /nabla_imconfig.h" )
389+
390+ if (NOT EXISTS "${NBL_IMGUI_USER_CONFIG_FILEPATH} " )
391+ message (FATAL_ERROR "\" ${NBL_IMGUI_USER_CONFIG_FILEPATH} \" doesn't exist!" )
392+ endif ()
393+
394+ target_compile_definitions (imgui PUBLIC
395+ IMGUI_USER_CONFIG= "${NBL_IMGUI_USER_CONFIG_FILEPATH} "
396+ )
338397endif ()
339398
340399add_library (aesGladman OBJECT
@@ -425,7 +484,7 @@ if (NBL_BUILD_MITSUBA_LOADER)
425484 list (APPEND NBL_3RDPARTY_TARGETS expat)
426485endif ()
427486if (NBL_BUILD_IMGUI)
428- list (APPEND NBL_3RDPARTY_TARGETS imgui implot imguizmo)
487+ list (APPEND NBL_3RDPARTY_TARGETS imgui implot imtestsuite imtestengine imguizmo)
429488endif ()
430489if (ENABLE_HLSL)
431490 list (APPEND NBL_3RDPARTY_TARGETS HLSL)
0 commit comments