@@ -103,7 +103,7 @@ if (NBL_COMPILE_WITH_CUDA)
103103 endif ()
104104endif ()
105105
106- # => TODO: clean
106+ # => TODO: clean!
107107# a little bit of globbing for headers never hurt anyone
108108file (GLOB_RECURSE TEMP_GLOB_RES "${NBL_ROOT_PATH} /include/*.h" )
109109set (NABLA_HEADERS_PUBLIC ${NABLA_HEADERS_PUBLIC} ${TEMP_GLOB_RES} )
@@ -112,6 +112,9 @@ set(NABLA_HEADERS_PUBLIC ${NABLA_HEADERS_PUBLIC} ${TEMP_GLOB_RES})
112112file (GLOB_RECURSE TEMP_GLOB_RES "${NBL_ROOT_PATH} /src/*.h" )
113113set (NABLA_HEADERS_PUBLIC2 ${NABLA_HEADERS_PUBLIC2} ${TEMP_GLOB_RES} ) # TODO: we should have moved all headers from src directory to /include, but we need it for install target
114114
115+ file (GLOB_RECURSE NABLA_HLSL_PUBLIC "${NBL_ROOT_PATH} /include/*.hlsl" )
116+ list (APPEND NABLA_HEADERS_PUBLIC ${NABLA_HLSL_PUBLIC} )
117+
115118foreach (NBL_CURRENT_HEADER IN LISTS NABLA_HEADERS_PUBLIC2)
116119 cmake_path(GET NBL_CURRENT_HEADER PARENT_PATH NBL_CURRENT_HEADER_DIR)
117120 file (RELATIVE_PATH NBL_TMP_REL_DESTINATION "${NBL_ROOT_PATH} /src" ${NBL_CURRENT_HEADER_DIR} )
@@ -350,6 +353,7 @@ else()
350353 )
351354endif ()
352355add_library (Nabla::Nabla ALIAS Nabla)
356+ set_source_files_properties (${NABLA_HLSL_PUBLIC} PROPERTIES HEADER_FILE_ONLY ON )
353357
354358# from old build config template:
355359#
@@ -846,4 +850,29 @@ target_compile_definitions(Nabla
846850 INTERFACE NBL_CPACK_PACKAGE_DXC_DLL_DIR_ABS_KEY="${_NBL_DXC_PACKAGE_RUNTIME_DLL_DIR_PATH_} "
847851)
848852
849- NBL_ADJUST_FOLDERS(src)
853+ NBL_ADJUST_FOLDERS(src)
854+ function (EXTRACT_BY_REGEX OUT REGEX )
855+ set (tmp "${ARGN} " )
856+ list (FILTER tmp INCLUDE REGEX "${REGEX} " )
857+ set (${OUT} "${tmp} " PARENT_SCOPE)
858+ endfunction ()
859+
860+ get_target_property (SRC Nabla SOURCES )
861+ EXTRACT_BY_REGEX(NABLA_HLSL_FILES ".*\\ .hlsl$" ${SRC} )
862+ EXTRACT_BY_REGEX(NABLA_HEADER_FILES ".*\\ .(h|hpp|tcc)$" ${SRC} )
863+ EXTRACT_BY_REGEX(NABLA_SOURCE_FILES ".*\\ .(c|cpp)$" ${SRC} )
864+
865+ source_group (TREE "${NBL_ROOT_PATH} "
866+ PREFIX "HLSL Files"
867+ FILES ${NABLA_HLSL_FILES}
868+ )
869+
870+ source_group (TREE "${NBL_ROOT_PATH} "
871+ PREFIX "Header Files"
872+ FILES ${NABLA_HEADER_FILES}
873+ )
874+
875+ source_group (TREE "${NBL_ROOT_PATH} "
876+ PREFIX "Source Files"
877+ FILES ${NABLA_SOURCE_FILES}
878+ )
0 commit comments