2
2
# This file is part of the "Nabla Engine".
3
3
# For conditions of distribution and use, see copyright notice in nabla.h
4
4
5
- function (NBL_HOOK_COMMON_API NBL_EXCLUDE_TARGETS_LIST )
6
- if (NOT TARGET nblExamplesAPI )
7
- message (FATAL_ERROR "nblExamplesAPI not defined!" )
8
- endif ()
9
-
10
- NBL_GET_ALL_TARGETS (NBL_TARGETS )
11
-
12
- foreach (NBL_TARGET IN LISTS NBL_TARGETS )
13
- # TODO: exclude builtin targets created by examples as well - doesn't impact anything at all now
14
- if (NOT ${NBL_TARGET} IN_LIST NBL_EXCLUDE_TARGETS_LIST )
15
-
16
- target_include_directories (${NBL_TARGET} PRIVATE $< TARGET_PROPERTY:nblExamplesAPI,INTERFACE_INCLUDE_DIRECTORIES> )
17
- target_link_libraries (${NBL_TARGET} PRIVATE nblExamplesAPI )
18
- endif ()
19
- endforeach ()
20
- endfunction ()
21
-
22
- # PCH & CommonAPI library for Nabla framework examples
23
- add_subdirectory (common EXCLUDE_FROM_ALL )
24
-
25
5
if (NBL_BUILD_EXAMPLES )
6
+ project (NablaExamples )
7
+
26
8
if (NBL_BUILD_ANDROID )
27
9
nbl_android_create_media_storage_apk ()
28
10
endif ()
29
11
12
+ #! Common api library & precompiled headers for Nabla framework examples
13
+ add_subdirectory (common EXCLUDE_FROM_ALL )
14
+
15
+ #! use "EXCLUDE_FROM_ALL" to exclude an example from the NablaExamples project
16
+ #[[
17
+ useful if we don't want the example to be tested by CI but still want
18
+ the example's project to be generated
19
+
20
+ https://cmake.org/cmake/help/latest/prop_tgt/EXCLUDE_FROM_ALL.html
21
+ ]]
22
+
30
23
# showcase the use of `nbl::core`,`nbl::system` and `nbl::asset`
31
- add_subdirectory (01_HelloCoreSystemAsset EXCLUDE_FROM_ALL )
24
+ add_subdirectory (01_HelloCoreSystemAsset )
32
25
# showcase the use of `system::IApplicationFramework` and `nbl::video`
33
- add_subdirectory (02_HelloCompute EXCLUDE_FROM_ALL )
26
+ add_subdirectory (02_HelloCompute )
34
27
# showcase physical device selection, resource embedding and the use of identical headers in HLSL and C++
35
- add_subdirectory (03_DeviceSelectionAndSharedSources EXCLUDE_FROM_ALL )
28
+ add_subdirectory (03_DeviceSelectionAndSharedSources )
36
29
# showcase the creation of windows and polling for input
37
- add_subdirectory (04_HelloUI EXCLUDE_FROM_ALL )
30
+ add_subdirectory (04_HelloUI )
38
31
# showcase the semi-advanced use of Nabla's Streaming Buffers and BDA
39
- add_subdirectory (05_StreamingAndBufferDeviceAddressApp EXCLUDE_FROM_ALL )
32
+ add_subdirectory (05_StreamingAndBufferDeviceAddressApp )
40
33
# showcase the use of a graphics queue
41
- add_subdirectory (06_HelloGraphicsQueue EXCLUDE_FROM_ALL )
34
+ add_subdirectory (06_HelloGraphicsQueue )
42
35
# showcase the set-up of multiple queues
43
- add_subdirectory (07_StagingAndMultipleQueues EXCLUDE_FROM_ALL )
36
+ add_subdirectory (07_StagingAndMultipleQueues )
44
37
# showcase the set-up of a swapchain and picking of a matching device
45
- add_subdirectory (08_HelloSwapchain EXCLUDE_FROM_ALL )
46
- add_subdirectory (09_GeometryCreator EXCLUDE_FROM_ALL )
47
- # demonstrate the counting sort utility
48
- add_subdirectory (10_CountingSort EXCLUDE_FROM_ALL )
38
+ add_subdirectory (08_HelloSwapchain )
39
+ add_subdirectory (09_GeometryCreator )
40
+ # demonstrate the counting sort utility
41
+ add_subdirectory (10_CountingSort )
49
42
# showcase use of FFT for post-FX Bloom effect
50
- add_subdirectory (11_FFT EXCLUDE_FROM_ALL )
51
-
43
+ add_subdirectory (11_FFT )
52
44
53
45
# Waiting for a refactor
54
- #add_subdirectory(27_PLYSTLDemo EXCLUDE_FROM_ALL )
55
- #add_subdirectory(33_Draw3DLine EXCLUDE_FROM_ALL )
46
+ #add_subdirectory(27_PLYSTLDemo)
47
+ #add_subdirectory(33_Draw3DLine)
56
48
57
49
# Unit Test Examples
58
- add_subdirectory (20_AllocatorTest EXCLUDE_FROM_ALL )
59
- add_subdirectory (21_LRUCacheUnitTest EXCLUDE_FROM_ALL )
60
- add_subdirectory (22_CppCompat EXCLUDE_FROM_ALL )
61
- add_subdirectory (23_Arithmetic2UnitTest EXCLUDE_FROM_ALL )
62
- add_subdirectory (24_ColorSpaceTest EXCLUDE_FROM_ALL )
50
+ add_subdirectory (20_AllocatorTest )
51
+ add_subdirectory (21_LRUCacheUnitTest )
52
+ add_subdirectory (22_CppCompat )
53
+ add_subdirectory (23_Arithmetic2UnitTest )
54
+ add_subdirectory (24_ColorSpaceTest )
63
55
add_subdirectory (25_FilterTest EXCLUDE_FROM_ALL )
64
- add_subdirectory (26_Blur EXCLUDE_FROM_ALL )
65
- add_subdirectory (27_MPMCScheduler EXCLUDE_FROM_ALL )
66
- add_subdirectory (28_FFTBloom EXCLUDE_FROM_ALL )
67
- add_subdirectory (29_Arithmetic2Bench EXCLUDE_FROM_ALL )
68
- # add_subdirectory(36_CUDAInterop EXCLUDE_FROM_ALL )
56
+ add_subdirectory (26_Blur )
57
+ add_subdirectory (27_MPMCScheduler )
58
+ add_subdirectory (28_FFTBloom )
59
+ add_subdirectory (29_Arithmetic2Bench )
60
+ # add_subdirectory(36_CUDAInterop)
69
61
70
62
# Showcase compute pathtracing
71
- add_subdirectory (30_ComputeShaderPathTracer EXCLUDE_FROM_ALL )
63
+ add_subdirectory (30_ComputeShaderPathTracer )
72
64
73
- add_subdirectory (38_EXRSplit EXCLUDE_FROM_ALL )
65
+ add_subdirectory (38_EXRSplit )
74
66
# if (NBL_BUILD_MITSUBA_LOADER AND NBL_BUILD_OPTIX)
75
- # add_subdirectory(39_DenoiserTonemapper EXCLUDE_FROM_ALL )
67
+ # add_subdirectory(39_DenoiserTonemapper)
76
68
# endif()
77
69
78
- #add_subdirectory(43_SumAndCDFFilters EXCLUDE_FROM_ALL )
70
+ #add_subdirectory(43_SumAndCDFFilters)
79
71
add_subdirectory (47_DerivMapTest EXCLUDE_FROM_ALL )
80
72
add_subdirectory (54_Transformations EXCLUDE_FROM_ALL )
81
73
add_subdirectory (55_RGB18E7S3 EXCLUDE_FROM_ALL )
82
- add_subdirectory (61_UI EXCLUDE_FROM_ALL )
83
- add_subdirectory (62_CAD EXCLUDE_FROM_ALL )
74
+ add_subdirectory (61_UI )
75
+ add_subdirectory (62_CAD )
84
76
add_subdirectory (62_SchusslerTest EXCLUDE_FROM_ALL )
85
- add_subdirectory (64_EmulatedFloatTest EXCLUDE_FROM_ALL )
77
+ add_subdirectory (64_EmulatedFloatTest )
86
78
add_subdirectory (0_ImportanceSamplingEnvMaps EXCLUDE_FROM_ALL ) #TODO: integrate back into 42
87
79
88
80
add_subdirectory (66_HLSLBxDFTests EXCLUDE_FROM_ALL )
89
- add_subdirectory (67_RayQueryGeometry EXCLUDE_FROM_ALL )
90
- add_subdirectory (68_JpegLoading EXCLUDE_FROM_ALL )
81
+ add_subdirectory (67_RayQueryGeometry )
82
+ add_subdirectory (68_JpegLoading )
91
83
92
- add_subdirectory (70_FLIPFluids EXCLUDE_FROM_ALL )
93
- add_subdirectory (71_RayTracingPipeline EXCLUDE_FROM_ALL )
84
+ add_subdirectory (70_FLIPFluids )
85
+ add_subdirectory (71_RayTracingPipeline )
86
+
87
+ # add new examples *before* NBL_GET_ALL_TARGETS invocation, it gathers recursively all targets created so far in this subdirectory
88
+ NBL_GET_ALL_TARGETS (TARGETS )
89
+
90
+ # we want to loop only over the examples so we exclude examples' interface libraries created in common subdirectory
91
+ list (REMOVE_ITEM TARGETS ${NBL_EXAMPLES_API_TARGET} ${NBL_EXAMPLES_API_LIBRARIES} )
92
+
93
+ # we link common example api library and force examples to reuse its PCH
94
+ foreach (T IN LISTS TARGETS )
95
+ target_link_libraries (${T} PUBLIC ${NBL_EXAMPLES_API_TARGET} )
96
+ target_include_directories (${T} PUBLIC $< TARGET_PROPERTY:${NBL_EXAMPLES_API_TARGET} ,INCLUDE_DIRECTORIES> )
97
+ target_precompile_headers (${T} REUSE_FROM "${NBL_EXAMPLES_API_TARGET} " )
98
+ endforeach ()
94
99
95
- NBL_HOOK_COMMON_API ( " ${NBL_EXAMPLES_API_TARGETS} " )
96
- endif ()
100
+ NBL_ADJUST_FOLDERS ( examples )
101
+ endif ()
0 commit comments