Skip to content

Commit a666673

Browse files
committed
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla into nano-pipelines
2 parents 2b4a121 + b7fc736 commit a666673

File tree

103 files changed

+5538
-2189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+5538
-2189
lines changed

.gitmodules

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
path = 3rdparty/libexpat
2828
url = [email protected]:Devsh-Graphics-Programming/libexpat.git
2929
branch = master
30-
[submodule "3rdparty/glm"]
31-
path = 3rdparty/glm
32-
url = [email protected]:AnastaZIuk/glm.git
3330
[submodule "3rdparty/freetype2"]
3431
path = 3rdparty/freetype2
3532
url = [email protected]:Devsh-Graphics-Programming/freetype.git
@@ -54,6 +51,7 @@
5451
[submodule "3rdparty/glTFSampleModels"]
5552
path = 3rdparty/glTFSampleModels
5653
url = [email protected]:Devsh-Graphics-Programming/glTF-Sample-Models.git
54+
update = none
5755
[submodule "3rdparty/nbl_spirv_cross"]
5856
path = 3rdparty/nbl_spirv_cross
5957
url = [email protected]:devshgraphicsprogramming/SPIRV-Cross.git
@@ -89,7 +87,7 @@
8987
url = [email protected]:Devsh-Graphics-Programming/Nabla-Continous-Integration-Python-Framework.git
9088
[submodule "3rdparty/boost/superproject"]
9189
path = 3rdparty/boost/superproject
92-
url = [email protected]:boostorg/boost.git
90+
url = ../boost.git
9391
[submodule "3rdparty/argparse"]
9492
path = 3rdparty/argparse
9593
url = [email protected]:p-ranav/argparse.git
@@ -117,3 +115,6 @@
117115
[submodule "docker/compiler-explorer"]
118116
path = docker/compiler-explorer
119117
url = [email protected]:Devsh-Graphics-Programming/Compiler-Explorer-Docker.git
118+
[submodule "3rdparty/glm"]
119+
path = 3rdparty/glm
120+
url = [email protected]:Devsh-Graphics-Programming/glm.git

3rdparty/CMakeLists.txt

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
include(../cmake/common.cmake)
66

7+
project(Nabla-3rdparty LANGUAGES CXX C)
8+
enable_language(C CXX ASM ASM_NASM)
9+
710
option(NBL_FORCE_RELEASE_3RDPARTY "Force map 3rdaprty's configuration regardless Nabla configuration to Release" OFF)
811
option(NBL_FORCE_RELWITHDEBINFO_3RDPARTY "Force map 3rdaprty's configuration regardless Nabla configuration to RelWithDebInfo" OFF)
912

@@ -231,7 +234,7 @@ if(_NBL_COMPILE_WITH_OPEN_EXR_)
231234
endif()
232235

233236

234-
#gli
237+
# gli
235238
option(_NBL_COMPILE_WITH_GLI_ "Build with GLI library" ON)
236239
if(_NBL_COMPILE_WITH_GLI_)
237240
set(_OLD_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
@@ -240,12 +243,23 @@ if(_NBL_COMPILE_WITH_GLI_)
240243
set(BUILD_SHARED_LIBS OFF)
241244
set(BUILD_STATIC_LIBS OFF)
242245
set(BUILD_TESTING OFF)
246+
set(GLI_GLM_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/glm")
243247
add_subdirectory(gli gli EXCLUDE_FROM_ALL)
244248
set(BUILD_SHARED_LIBS ${_OLD_BUILD_SHARED_LIBS})
245249
set(BUILD_STATIC_LIBS ${_OLD_BUILD_STATIC_LIBS})
246250
set(BUILD_TESTING ${_OLD_BUILD_TESTING})
247251
endif()
248252

253+
set(ENABLE_STATIC_LIB ON)
254+
set(ENABLE_SHARED_LIB OFF)
255+
set(ENABLE_EXAMPLES OFF)
256+
set(ENABLE_DOCS OFF)
257+
set(ENABLE_APP OFF)
258+
set(ENABLE_LIB_ONLY ON)
259+
set(ENABLE_TESTS OFF)
260+
set(ENABLE_SUMMARY OFF)
261+
add_subdirectory(bzip2 bzip2 EXCLUDE_FROM_ALL)
262+
249263
add_library(lzma OBJECT
250264
lzma/C/Alloc.c
251265
lzma/C/LzFind.c
@@ -262,17 +276,6 @@ add_library(lz4 OBJECT
262276
lz4/lib/xxhash.c
263277
)
264278

265-
266-
add_library(bzip2 OBJECT
267-
bzip2/blocksort.c
268-
bzip2/bzlib.c
269-
bzip2/compress.c
270-
bzip2/crctable.c
271-
bzip2/decompress.c
272-
bzip2/huffman.c
273-
bzip2/randtable.c
274-
)
275-
276279
add_library(spirv_cross OBJECT
277280
nbl_spirv_cross/spirv_cfg.cpp
278281
nbl_spirv_cross/spirv_cross.cpp
@@ -419,12 +422,6 @@ add_library(aesGladman OBJECT
419422

420423
add_subdirectory(argparse argparse EXCLUDE_FROM_ALL)
421424

422-
option(GLM_TEST_ENABLE_SIMD_SSE4_2 "Enable SSE 4.2 optimizations" ON)
423-
option(GLM_TEST_ENABLE "Build unit tests" OFF)
424-
#add_subdirectory(glm EXCLUDE_FROM_ALL)
425-
set(BUILD_SHARED_LIBS ${_OLD_BUILD_SHARED_LIBS})
426-
set(BUILD_STATIC_LIBS ${_OLD_BUILD_STATIC_LIBS})
427-
428425
if (NBL_BUILD_MITSUBA_LOADER)
429426
option(BUILD_tools "EXPAT: build the xmlwf tool for expat library" OFF)
430427
option(BUILD_examples "EXPAT: build the examples for expat library" OFF)
@@ -465,7 +462,7 @@ set(NBL_3RDPARTY_TARGETS
465462
shaderc_util
466463
shaderc
467464
jpeg-static
468-
bzip2
465+
bz2_static
469466
simdjson
470467
nlohmann_json
471468
glslang
@@ -496,11 +493,7 @@ if (NBL_BUILD_IMGUI)
496493
endif()
497494

498495
foreach(trgt IN LISTS NBL_3RDPARTY_TARGETS)
499-
if(NBL_DYNAMIC_MSVC_RUNTIME)
500-
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
501-
else()
502-
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
503-
endif()
496+
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${NBL_COMPILER_DYNAMIC_RUNTIME}>:DLL>")
504497

505498
if(MSVC AND NBL_SANITIZE_ADDRESS)
506499
set_property(TARGET ${trgt} PROPERTY COMPILE_OPTIONS /fsanitize=address)

3rdparty/boost/CMakeLists.txt

Lines changed: 79 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
1+
get_filename_component(NBL_BOOST_WAVE_DEP_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dep/wave.cmake" ABSOLUTE)
2+
3+
# Boost uses it's own tool for generating dependency list for targets, therefore we
4+
# can make sure manually added dependency subdirectories for a library are valid
5+
# https://www.boost.org/doc/libs/1_83_0/tools/boostdep/doc/html/index.html#boostdep.introduction.building_boostdep
6+
7+
if(NBL_BOOST_GENERATE_DEP_LIST) # internal, for Nabla devs
8+
if(NOT WIN32)
9+
message(FATAL_ERROR "NBL_BOOST_GENERATE_DEP_LIST only for Windows host!")
10+
endif()
11+
12+
macro(NBL_BOOST_EXECUTE)
13+
execute_process(COMMAND ${ARGV} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/superproject")
14+
endmacro()
15+
16+
NBL_BOOST_EXECUTE(git config --file .gitmodules --get-regexp path OUTPUT_VARIABLE NBL_OUTPUT_VARIABLE)
17+
string(REGEX REPLACE "\n" ";" NBL_SUBMODULE_CONFIG_LIST "${NBL_OUTPUT_VARIABLE}")
18+
19+
foreach(NBL_SUBMODULE_NAME ${NBL_SUBMODULE_CONFIG_LIST})
20+
string(REGEX MATCH "submodule\\.(.*)\\.path" NBL_SUBMODULE_NAME "${NBL_SUBMODULE_NAME}")
21+
list(APPEND BOOST_SUBMODULES "${CMAKE_MATCH_1}")
22+
endforeach()
23+
24+
# sync & force update of all boost modules first for the tool purpose (sry guys who use the tool, you need to clone all, I want to keep it simple)
25+
NBL_BOOST_EXECUTE(git submodule sync)
26+
list(APPEND BOOST_FORCE_ALL_CONFIG -c url.https://github.com/[email protected]:)
27+
foreach(SUBMODULE ${BOOST_SUBMODULES})
28+
list(APPEND BOOST_FORCE_ALL_CONFIG -c submodule.${SUBMODULE}.update=checkout)
29+
endforeach()
30+
31+
NBL_BOOST_EXECUTE(git ${BOOST_FORCE_ALL_CONFIG} submodule update --init --recursive -f)
32+
33+
# build boost dep executable
34+
set(NBL_BOOSTDEP_EXE "boostdep.exe")
35+
set(NBL_BOOSTDEP_EXE_FILEPATH "${CMAKE_CURRENT_BINARY_DIR}/superproject/tools/boostdep/bin/${NBL_BOOSTDEP_EXE}")
36+
if(NOT EXISTS "${NBL_BOOSTDEP_EXE_FILEPATH}")
37+
NBL_BOOST_EXECUTE(cmd /C bootstrap.bat)
38+
NBL_BOOST_EXECUTE(cmd /C b2.exe tools/boostdep/build)
39+
NBL_BOOST_EXECUTE("${CMAKE_COMMAND}" -E copy "./dist/bin/${NBL_BOOSTDEP_EXE}" "${NBL_BOOSTDEP_EXE_FILEPATH}")
40+
NBL_BOOST_EXECUTE(git clean -fdx)
41+
NBL_BOOST_EXECUTE(git reset --hard)
42+
endif()
43+
44+
# get wave dependency info
45+
NBL_BOOST_EXECUTE("${NBL_BOOSTDEP_EXE_FILEPATH}" --boost-root "${CMAKE_CURRENT_SOURCE_DIR}/superproject" --brief wave
46+
OUTPUT_VARIABLE NBL_OUTPUT_VAR
47+
)
48+
49+
file(WRITE "${NBL_BOOST_WAVE_DEP_FILE}" "${NBL_OUTPUT_VAR}")
50+
51+
file(STRINGS "${NBL_BOOST_WAVE_DEP_FILE}" NBL_BOOST_LIBS)
52+
set(NBL_BOOST_LIBS ${NBL_BOOST_LIBS})
53+
list(POP_FRONT NBL_BOOST_LIBS)
54+
list(FILTER NBL_BOOST_LIBS EXCLUDE REGEX "#")
55+
list(FILTER NBL_BOOST_LIBS EXCLUDE REGEX "(unknown)")
56+
string(REPLACE "~" "/" NBL_BOOST_LIBS "${NBL_BOOST_LIBS}")
57+
58+
# update boost .gitmodules configuration, discard all but modules reported by wave
59+
# NOTE: you commit this file to version control AND boost's .gitmodules *if got changed*,
60+
# use when updating boost to more recent version
61+
file(WRITE "${NBL_BOOST_WAVE_DEP_FILE}" "set(NBL_BOOST_LIBS ${NBL_BOOST_LIBS})")
62+
63+
message(STATUS "Updating boost .gitmodules")
64+
foreach(SUBMODULE ${BOOST_SUBMODULES})
65+
# 1) fallback, ignore all
66+
NBL_BOOST_EXECUTE(git config --file .gitmodules submodule.${SUBMODULE}.update none)
67+
endforeach()
68+
69+
foreach(NAME ${NBL_BOOST_LIBS})
70+
string(REPLACE "/" "_" SUBMODULE "${NAME}")
71+
message(STATUS "WAVE BOOST DEP SUBMODULE = ${SUBMODULE}")
72+
# 2) pick only submodules reported by wave
73+
NBL_BOOST_EXECUTE(git config --file .gitmodules submodule.${SUBMODULE}.update checkout)
74+
endforeach()
75+
# 3) and the top module itself
76+
NBL_BOOST_EXECUTE(git config --file .gitmodules submodule.wave.update checkout)
77+
endif()
78+
179
set(BOOST_PREPROCESSOR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/superproject/libs/preprocessor/include" CACHE PATH "" FORCE)
280

381
get_filename_component(_BOOST_PREPROCESSOR_BR_BUNDLE_SEARCH_DIRECTORY_ "${BOOST_PREPROCESSOR_INCLUDE}" ABSOLUTE)
@@ -17,8 +95,6 @@ if(NBL_EMBED_BUILTIN_RESOURCES)
1795
ADD_CUSTOM_BUILTIN_RESOURCES(boostBuiltinResourceData BOOST_RESOURCES_TO_EMBED "${_BOOST_PREPROCESSOR_BR_BUNDLE_SEARCH_DIRECTORY_}" "boost" "boost::builtin" "${_BOOST_PREPROCESSOR_BR_OUTPUT_DIRECTORY_HEADER_}" "${_BOOST_PREPROCESSOR_BR_OUTPUT_DIRECTORY_HEADER_}" "STATIC" "INTERNAL")
1896
endif()
1997

20-
get_filename_component(NBL_BOOST_WAVE_DEP_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dep/wave.cmake" ABSOLUTE)
21-
2298
if(NOT EXISTS "${NBL_BOOST_WAVE_DEP_FILE}")
2399
message(FATAL_ERROR "Internal error, generate NBL_BOOST_WAVE_DEP_FILE by enabling NBL_BOOST_GENERATE_DEP_LIST!")
24100
endif()
@@ -41,47 +117,4 @@ endforeach()
41117

42118
set(NBL_BOOST_TARGETS
43119
${NBL_BOOST_TARGETS}
44-
PARENT_SCOPE)
45-
46-
# Boost uses it's own tool for generating dependency list for targets, therefore we
47-
# can make sure manually added dependnecy subdirectories for a library are valid
48-
# https://www.boost.org/doc/libs/1_83_0/tools/boostdep/doc/html/index.html#boostdep.introduction.building_boostdep
49-
50-
if(NBL_BOOST_GENERATE_DEP_LIST) # internal, for Nabla devs
51-
if(WIN32)
52-
set(NBL_BOOSTDEP_EXE "boostdep.exe")
53-
else()
54-
set(NBL_BOOSTDEP_EXE "boostdep")
55-
endif()
56-
57-
set(NBL_BOOSTDEP_EXE_FILEPATH "${CMAKE_CURRENT_BINARY_DIR}/superproject/tools/boostdep/bin/${NBL_BOOSTDEP_EXE}")
58-
59-
if(NOT EXISTS "${NBL_BOOSTDEP_EXE_FILEPATH}")
60-
macro(NBL_BOOST_EXECUTE)
61-
execute_process(COMMAND ${ARGV}
62-
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/superproject"
63-
)
64-
endmacro()
65-
66-
NBL_BOOST_EXECUTE(cmd /C bootstrap.bat)
67-
NBL_BOOST_EXECUTE(cmd /C b2.exe tools/boostdep/build)
68-
NBL_BOOST_EXECUTE("${CMAKE_COMMAND}" -E copy "./dist/bin/${NBL_BOOSTDEP_EXE}" "${NBL_BOOSTDEP_EXE_FILEPATH}")
69-
NBL_BOOST_EXECUTE(git clean -fdx)
70-
NBL_BOOST_EXECUTE(git reset --hard)
71-
endif()
72-
73-
execute_process(COMMAND "${NBL_BOOSTDEP_EXE_FILEPATH}" --boost-root "${CMAKE_CURRENT_SOURCE_DIR}/superproject" --brief wave
74-
OUTPUT_VARIABLE NBL_OUTPUT_VAR
75-
)
76-
77-
file(WRITE "${NBL_BOOST_WAVE_DEP_FILE}" "${NBL_OUTPUT_VAR}")
78-
79-
file(STRINGS "${NBL_BOOST_WAVE_DEP_FILE}" NBL_BOOST_LIBS)
80-
set(NBL_BOOST_LIBS ${NBL_BOOST_LIBS})
81-
list(POP_FRONT NBL_BOOST_LIBS)
82-
list(FILTER NBL_BOOST_LIBS EXCLUDE REGEX "#")
83-
list(FILTER NBL_BOOST_LIBS EXCLUDE REGEX "(unknown)")
84-
string(REPLACE "~" "/" NBL_BOOST_LIBS "${NBL_BOOST_LIBS}")
85-
86-
file(WRITE "${NBL_BOOST_WAVE_DEP_FILE}" "set(NBL_BOOST_LIBS ${NBL_BOOST_LIBS})")
87-
endif()
120+
PARENT_SCOPE)

3rdparty/boost/superproject

3rdparty/bzip2

Submodule bzip2 updated 94 files

3rdparty/dxc/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ if(WIN32)
6363
endif()
6464
endif()
6565

66-
if(NBL_DYNAMIC_MSVC_RUNTIME)
67-
list(APPEND NBL_DXC_CMAKE_OPTIONS "-DCMAKE_MSVC_RUNTIME_LIBRARY:STATIC=MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
68-
else()
69-
list(APPEND NBL_DXC_CMAKE_OPTIONS "-DCMAKE_MSVC_RUNTIME_LIBRARY:STATIC=MultiThreaded$<$<CONFIG:Debug>:Debug>")
70-
endif()
66+
list(APPEND NBL_DXC_CMAKE_OPTIONS "-DCMAKE_MSVC_RUNTIME_LIBRARY:STATIC=MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${NBL_COMPILER_DYNAMIC_RUNTIME}>:DLL>")
7167

7268
# perform DXC compile standard requirement test
7369
set(CMAKE_CXX_STANDARD_REQUIRED ON)

3rdparty/dxc/dxc

Submodule dxc updated 305 files

3rdparty/gli

Submodule gli updated 161 files

3rdparty/glm

Submodule glm updated 1525 files

CMakeLists.txt

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
# Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
22
# This file is part of the "Nabla Engine".
33
# For conditions of distribution and use, see copyright notice in nabla.h.in or nabla.h
4+
cmake_minimum_required(VERSION 3.31)
45

5-
cmake_minimum_required(VERSION 3.29)
6-
cmake_policy(SET CMP0112 NEW)
7-
cmake_policy(SET CMP0141 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0141.html#policy:CMP0141
8-
cmake_policy(SET CMP0118 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0118.html#policy:CMP0118
6+
# TODO: Yas - once we deploy 4.x we will fire `cmake_policy(VERSION <min>[...<max>])` instead of manually picking policies
7+
# https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html#policy-version
8+
# also we should update deps which throw warnings about < 3.10 compatibility
9+
10+
macro(NBL_POLICY P S)
11+
if(POLICY ${P})
12+
cmake_policy(SET ${P} ${S})
13+
set(CMAKE_POLICY_DEFAULT_${P} ${S})
14+
endif()
15+
endmacro()
16+
17+
NBL_POLICY(CMP0003 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0003.html#cmp0003
18+
NBL_POLICY(CMP0077 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0077.html#cmp0077
19+
NBL_POLICY(CMP0112 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0112.html#cmp0112
20+
NBL_POLICY(CMP0141 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0141.html#policy:CMP0141
21+
NBL_POLICY(CMP0118 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0118.html#policy:CMP0118
922

1023
set(NBL_BUILD_ANDROID OFF)
1124

@@ -21,28 +34,16 @@ if(MSVC)
2134
endif()
2235

2336
option(NBL_STATIC_BUILD "" OFF) # ON for static builds, OFF for shared
24-
option(NBL_DYNAMIC_MSVC_RUNTIME "" ON)
37+
option(NBL_COMPILER_DYNAMIC_RUNTIME "" ON)
2538
option(NBL_SANITIZE_ADDRESS OFF)
2639

27-
if(MSVC)
28-
if(NBL_SANITIZE_ADDRESS)
29-
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>")
30-
else()
31-
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug>:EditAndContinue>$<$<CONFIG:RelWithDebInfo>:ProgramDatabase>")
32-
endif()
33-
endif()
40+
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT $<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>) # ignored on non xMSVC-ABI targets
3441

3542
if(NBL_STATIC_BUILD)
3643
message(STATUS "Static Nabla build enabled!")
3744
else()
38-
if(MSVC)
39-
if(NBL_DYNAMIC_MSVC_RUNTIME)
40-
message(STATUS "Shared Nabla build enabled!")
41-
else()
42-
message(FATAL_ERROR "Turn NBL_DYNAMIC_MSVC_RUNTIME on! For dynamic Nabla builds dynamic MSVC runtime is mandatory!")
43-
endif()
44-
else()
45-
message(FATAL_ERROR "Nabla can't be built with shared libraries! Please make sure you are targetting Windows OS and MSVC compiler!")
45+
if(NOT NBL_COMPILER_DYNAMIC_RUNTIME)
46+
message(FATAL_ERROR "Turn NBL_COMPILER_DYNAMIC_RUNTIME on! For dynamic Nabla builds dynamic runtime is mandatory!")
4647
endif()
4748
endif()
4849

0 commit comments

Comments
 (0)