Skip to content

Commit 4e95000

Browse files
committed
fix builtin-resources with SHARED builds, add a test and update examples_tests submodule
1 parent e36e9b7 commit 4e95000

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

include/nbl/system/CFileArchive.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class CInnerArchiveFile : public CFileView<T>
6868

6969

7070
//!
71-
class CFileArchive : public IFileArchive
71+
class NBL_API2 CFileArchive : public IFileArchive
7272
{
7373
static inline constexpr size_t SIZEOF_INNER_ARCHIVE_FILE = std::max(sizeof(CInnerArchiveFile<CPlainHeapAllocator>), sizeof(CInnerArchiveFile<VirtualMemoryAllocator>));
7474
static inline constexpr size_t ALIGNOF_INNER_ARCHIVE_FILE = std::max(alignof(CInnerArchiveFile<CPlainHeapAllocator>), alignof(CInnerArchiveFile<VirtualMemoryAllocator>));

include/nbl/system/atomic_state.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define _NBL_SYSTEM_ATOMIC_STATE_H_INCLUDED_
33

44
#include <atomic>
5+
#include "assert.h"
56

67
namespace nbl::system
78
{

src/nbl/builtin/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,6 @@ LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "glsl/blit/normalization/shared_nor
240240
LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "hlsl/shapes/line.hlsl")
241241

242242
macro(NBL_ADD_BUILTIN_RESOURCES _TARGET_) # internal & Nabla only, must be added with the macro to properly propagate scope
243-
ADD_CUSTOM_BUILTIN_RESOURCES("${_TARGET_}" NBL_RESOURCES_TO_EMBED "${NBL_ROOT_PATH}/include" "nbl/builtin" "nbl::builtin" "${NBL_ROOT_PATH_BINARY}/include" "${NBL_ROOT_PATH_BINARY}/src")
243+
ADD_CUSTOM_BUILTIN_RESOURCES("${_TARGET_}" NBL_RESOURCES_TO_EMBED "${NBL_ROOT_PATH}/include" "nbl/builtin" "nbl::builtin" "${NBL_ROOT_PATH_BINARY}/include" "${NBL_ROOT_PATH_BINARY}/src" "STATIC" "INTERNAL")
244244
endmacro()
245245

src/nbl/builtin/template/CArchive.h.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
#define _@_GUARD_SUFFIX_@_C_ARCHIVE_H_
33

44
#include "nbl/system/CFileArchive.h"
5+
#include "nbl/core/def/smart_refctd_ptr.h"
56
#include "@NBL_BS_HEADER_FILENAME@"
67

78
namespace @_NAMESPACE_@
89
{
910
constexpr std::string_view pathPrefix = "@_BUNDLE_ARCHIVE_ABSOLUTE_PATH_@";
1011
constexpr bool hasPathPrefix(std::string_view str) { return str.find(pathPrefix) == 0ull; }
1112

12-
class @_NBL_BR_API_@ CArchive final : public nbl::system::CFileArchive
13+
class @NBL_BR_API@ CArchive final : public nbl::system::CFileArchive
1314
{
1415
public:
1516
CArchive(nbl::system::logger_opt_smart_ptr&& logger);

src/nbl/builtin/utils.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ function(ADD_CUSTOM_BUILTIN_RESOURCES _TARGET_NAME_ _BUNDLE_NAME_ _BUNDLE_SEARCH
5555
set(_SHARED_ False)
5656
unset(NBL_BR_API)
5757
endif()
58+
59+
if("${ARGV8}" STREQUAL "INTERNAL")
60+
set(_NBL_INTERNAL_BR_CREATION_ ON)
61+
else()
62+
set(_NBL_INTERNAL_BR_CREATION_ OFF)
63+
endif()
5864

5965
set(NBL_TEMPLATE_RESOURCES_ARCHIVE_HEADER "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/template/CArchive.h.in")
6066
set(NBL_TEMPLATE_RESOURCES_ARCHIVE_SOURCE "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/template/CArchive.cpp.in")
@@ -152,6 +158,10 @@ function(ADD_CUSTOM_BUILTIN_RESOURCES _TARGET_NAME_ _BUNDLE_NAME_ _BUNDLE_SEARCH
152158

153159
if(TARGET Nabla)
154160
get_target_property(_NABLA_INCLUDE_DIRECTORIES_ Nabla INCLUDE_DIRECTORIES)
161+
162+
if(NOT _NBL_INTERNAL_BR_CREATION_)
163+
target_link_libraries(${_TARGET_NAME_} Nabla) # be aware Nabla must be linked to the BRs
164+
endif()
155165
endif()
156166

157167
if(NOT DEFINED _NABLA_INCLUDE_DIRECTORIES_) # TODO, validate by populating generator expressions if any and checking whether a path to the BuildConfigOptions.h exists per config

0 commit comments

Comments
 (0)