Skip to content

Commit 104b939

Browse files
committed
Merge branch 'master' into erfan_device_features
# Conflicts: # include/nbl/video/utilities/IUtilities.h
2 parents 912ab00 + 518ef10 commit 104b939

File tree

402 files changed

+2715
-1379
lines changed

Some content is hidden

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

402 files changed

+2715
-1379
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ doctemp/*
2626
source/obj
2727
source/Irrlicht/libIrrlichtServer.a
2828
# stuff output by examples
29-
examples_tests/*/bin/*
29+
examples_tests/*
3030
examples_tests/tmp/*
3131
android-sample/bin/*

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,6 @@
8787
path = 3rdparty/Vulkan-Headers
8888
url = [email protected]:KhronosGroup/Vulkan-Headers.git
8989
branch = main
90+
[submodule "examples_tests"]
91+
path = examples_tests
92+
url = [email protected]:Devsh-Graphics-Programming/Nabla-Examples-and-Tests.git

3rdparty/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ set(NBL_3RDPARTY_TARGETS
342342
shaderc_util
343343
shaderc
344344
jpeg-static
345-
bzip2
345+
bzip2
346+
simdjson
346347
glslang
347348
OGLCompiler
348349
OSDependent
@@ -379,8 +380,11 @@ if(ENABLE_HLSL)
379380
endif()
380381

381382
foreach(trgt IN LISTS NBL_3RDPARTY_TARGETS)
382-
set_property(TARGET ${trgt} PROPERTY
383-
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
383+
if(NBL_DYNAMIC_MSVC_RUNTIME)
384+
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
385+
else()
386+
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
387+
endif()
384388
endforeach()
385389

386390
set(_NBL_3RDPARTY_TARGETS_ ${NBL_3RDPARTY_TARGETS} PARENT_SCOPE)

CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchains/android/build.cmake)
1515

1616
project(Nabla LANGUAGES CXX C)
1717

18+
option(NBL_STATIC_BUILD "" ON) # ON for static builds, OFF for shared
19+
option(NBL_DYNAMIC_MSVC_RUNTIME "" OFF)
20+
21+
if(NBL_STATIC_BUILD)
22+
message(STATUS "Static Nabla build enabled!")
23+
else()
24+
if(WIN32 AND MSVC)
25+
if(NBL_DYNAMIC_MSVC_RUNTIME)
26+
message(STATUS "Shared Nabla build enabled!")
27+
else()
28+
message(FATAL_ERROR "Turn NBL_DYNAMIC_MSVC_RUNTIME on! For dynamic Nabla builds dynamic MSVC runtime is mandatory!")
29+
endif()
30+
else()
31+
message(FATAL_ERROR "Nabla can't be built with shared libraries! Please make sure you are targetting Windows OS and MSVC compiler!")
32+
endif()
33+
endif()
34+
1835
if(NBL_BUILD_ANDROID)
1936
enable_language(ASM)
2037
endif()
@@ -232,6 +249,12 @@ elseif(UNIX)
232249
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
233250
endif()
234251

252+
if(NBL_STATIC_BUILD)
253+
unset(_NBL_SHARED_BUILD_ CACHE)
254+
else()
255+
set(_NBL_SHARED_BUILD_ ON CACHE INTERNAL "")
256+
endif()
257+
235258
#uncomment in the future
236259
#option(NBL_TARGET_ARCH_ARM "Build for ARM?" OFF)
237260

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,22 @@ Contact `[email protected]` with inquires into contracting.
177177

178178
- [ ] **iOS**
179179

180+
## Build summary
181+
182+
| ![][BUILD_STATUS] | Release | RWDI | Debug |
183+
| :----------------------: | :----------: | :----------: | :----------: |
184+
| **Windows MSVC x64** | ![][MSVC_1] | ![][MSVC_2] | ![][MSVC_3] |
185+
| **Android Clang x86_64** | ![][CLANG_1] | ![][CLANG_2] | ![][CLANG_3] |
186+
| **Linux GCC x64** | ![][NA] | ![][NA] | ![][NA] |
187+
188+
[MSVC_1]: https://ci.devsh.eu/buildStatus/icon?job=BuildNabla%2FDEVSH_CONFIGURATIONS%3DRelease%2CDEVSH_NODES%3Dpredator15%2CDEVSH_OS%3DWindows
189+
[MSVC_2]: https://ci.devsh.eu/buildStatus/icon?job=BuildNabla%2FDEVSH_CONFIGURATIONS%3DRelWithDebInfo%2CDEVSH_NODES%3Dpredator15%2CDEVSH_OS%3DWindows
190+
[MSVC_3]: https://ci.devsh.eu/buildStatus/icon?job=BuildNabla%2FDEVSH_CONFIGURATIONS%3DDebug%2CDEVSH_NODES%3Dpredator15%2CDEVSH_OS%3DWindows
191+
[CLANG_1]: https://ci.devsh.eu/buildStatus/icon?job=BuildNabla%2FDEVSH_CONFIGURATIONS%3DRelease%2CDEVSH_NODES%3Dnode1%2CDEVSH_OS%3DAndroid
192+
[CLANG_2]: https://ci.devsh.eu/buildStatus/icon?job=BuildNabla%2FDEVSH_CONFIGURATIONS%3DRelWithDebInfo%2CDEVSH_NODES%3Dnode1%2CDEVSH_OS%3DAndroid
193+
[CLANG_3]: https://ci.devsh.eu/buildStatus/icon?job=BuildNabla%2FDEVSH_CONFIGURATIONS%3DDebug%2CDEVSH_NODES%3Dnode1%2CDEVSH_OS%3DAndroid
194+
[NA]: https://img.shields.io/badge/free%20slot-n%2Fa-red
195+
[BUILD_STATUS]: https://img.shields.io/badge/build-status-blueviolet
180196

181197
## Required Build Tools and SDK's
182198

cmake/common.cmake

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,41 @@ macro(nbl_create_executable_project _EXTRA_SOURCES _EXTRA_OPTIONS _EXTRA_INCLUDE
3939
if(ANDROID)
4040
add_library(${EXECUTABLE_NAME} SHARED main.cpp ${_EXTRA_SOURCES})
4141
else()
42-
add_executable(${EXECUTABLE_NAME} main.cpp ${_EXTRA_SOURCES})
43-
endif()
42+
if(NOT NBL_STATIC_BUILD)
43+
set(NBL_CONFIG_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
44+
set(NBL_CONFIG_OUTPUT_FILE ${NBL_CONFIG_OUTPUT_DIRECTORY}/${EXECUTABLE_NAME}$<IF:$<CONFIG:Release>,,$<IF:$<CONFIG:Debug>,_d,_rwdi>>.exe.config)
45+
46+
add_custom_command(OUTPUT "${NBL_CONFIG_OUTPUT_FILE}"
47+
COMMAND ${CMAKE_COMMAND} -DNBL_ROOT_PATH:PATH=${NBL_ROOT_PATH} -DNBL_GEN_DIRECTORY:PATH=${NBL_CONFIG_OUTPUT_DIRECTORY} -DNBL_DLL_PATH:FILEPATH=$<TARGET_FILE:Nabla> -DNBL_TARGET_PATH:FILEPATH=$<TARGET_FILE:${EXECUTABLE_NAME}> -P ${NBL_ROOT_PATH}/cmake/scripts/nbl/applicationMSVCConfig.cmake
48+
COMMENT "Launching ${EXECUTABLE_NAME}.exe.config generation script!"
49+
VERBATIM
50+
)
51+
52+
add_custom_target(${EXECUTABLE_NAME}_with_config ALL DEPENDS ${NBL_CONFIG_OUTPUT_FILE} ${NBL_ROOT_PATH}/cmake/scripts/nbl/applicationMSVCConfig.cmake)
53+
endif()
4454

45-
set_property(TARGET ${EXECUTABLE_NAME} PROPERTY
46-
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
55+
set(NBL_EXECUTABLE_SOURCES
56+
main.cpp
57+
${_EXTRA_SOURCES}
58+
)
59+
60+
add_executable(${EXECUTABLE_NAME} ${NBL_EXECUTABLE_SOURCES})
61+
62+
if(NBL_DYNAMIC_MSVC_RUNTIME)
63+
set_property(TARGET ${EXECUTABLE_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
64+
else()
65+
set_property(TARGET ${EXECUTABLE_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
66+
endif()
67+
endif()
4768

4869
# EXTRA_SOURCES is var containing non-common names of sources (if any such sources, then EXTRA_SOURCES must be set before including this cmake code)
49-
add_dependencies(${EXECUTABLE_NAME} Nabla)
70+
if(NBL_STATIC_BUILD)
71+
add_dependencies(${EXECUTABLE_NAME} Nabla)
72+
else()
73+
add_dependencies(${EXECUTABLE_NAME}_with_config Nabla_with_manifest)
74+
#target_link_options(${EXECUTABLE_NAME} PRIVATE "/manifestdependency:\"type='win32' name='devshgraphicsprogramming.nabla' version='1.2.3.4' processorArchitecture='x86' language='*'\"")
75+
endif()
76+
5077
get_target_property(NBL_EGL_INCLUDE_DIRECORIES egl INCLUDE_DIRECTORIES)
5178

5279
target_include_directories(${EXECUTABLE_NAME}
@@ -582,13 +609,17 @@ macro(glue_source_definitions NBL_TARGET NBL_REFERENCE_RETURN_VARIABLE)
582609
foreach(_NBL_DEF_ IN LISTS ${NBL_REFERENCE_RETURN_VARIABLE})
583610
string(FIND "${_NBL_DEF_}" "=" _NBL_POSITION_ REVERSE)
584611

612+
# put target compile definitions without any value into wrapper file
585613
if(_NBL_POSITION_ STREQUAL -1)
586-
string(APPEND WRAPPER_CODE
587-
"#ifndef ${_NBL_DEF_}\n"
588-
"#define ${_NBL_DEF_}\n"
589-
"#endif // ${_NBL_DEF_}\n\n"
590-
)
614+
if(NOT ${_NBL_DEF_} STREQUAL "__NBL_BUILDING_NABLA__")
615+
string(APPEND WRAPPER_CODE
616+
"#ifndef ${_NBL_DEF_}\n"
617+
"#define ${_NBL_DEF_}\n"
618+
"#endif // ${_NBL_DEF_}\n\n"
619+
)
620+
endif()
591621
else()
622+
# put target compile definitions with an assigned value into wrapper file
592623
string(SUBSTRING "${_NBL_DEF_}" 0 ${_NBL_POSITION_} _NBL_CLEANED_DEF_)
593624

594625
string(LENGTH "${_NBL_DEF_}" _NBL_DEF_LENGTH_)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<configuration>
2+
<windows>
3+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
4+
<probing privatePath="@NBL_ASSEMLBY_RELATIVE_PATH@"/>
5+
</assemblyBinding>
6+
</windows>
7+
</configuration>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
2+
<assemblyIdentity name="devshgraphicsprogramming.nabla" version="1.2.3.4" processorArchitecture="x86" type="win32"/>
3+
<file name="@NABLA_DLL@"/>
4+
</assembly>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (c) 2022 DevSH Graphics Programming Sp. z O.O.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# CMake script for generating msvc manifest during build time
16+
17+
if(DEFINED NBL_ROOT_PATH)
18+
if(NOT EXISTS ${NBL_ROOT_PATH})
19+
message(FATAL_ERROR "NBL_ROOT_PATH as '${NBL_ROOT_PATH}' is invalid!")
20+
endif()
21+
else()
22+
message(FATAL_ERROR "NBL_ROOT_PATH variable must be specified for this script!")
23+
endif()
24+
25+
if(NOT DEFINED NBL_GEN_DIRECTORY)
26+
message(FATAL_ERROR "NBL_GEN_DIRECTORY variable must be specified for this script!")
27+
endif()
28+
29+
if(NOT DEFINED NBL_DLL_PATH)
30+
message(FATAL_ERROR "NABLA_DLL_PATH variable must be specified for this script!")
31+
endif()
32+
33+
if(NOT DEFINED NBL_TARGET_PATH)
34+
message(FATAL_ERROR "NBL_TARGET_PATH variable must be specified for this script!")
35+
endif()
36+
37+
cmake_path(GET NBL_TARGET_PATH FILENAME NBL_TARGET_NAME)
38+
39+
set(NBL_INPUT_MSVC_CONFIG_FILE ${NBL_ROOT_PATH}/cmake/config/msvc/application.exe.config)
40+
41+
file(RELATIVE_PATH NBL_DLL_RELATIVE_PATH "${NBL_GEN_DIRECTORY}" "${NBL_DLL_PATH}")
42+
cmake_path(GET NBL_DLL_RELATIVE_PATH PARENT_PATH NBL_ASSEMLBY_RELATIVE_PATH)
43+
cmake_path(GET NBL_ASSEMLBY_RELATIVE_PATH PARENT_PATH NBL_ASSEMLBY_RELATIVE_PATH)
44+
45+
message(STATUS "Generating ${NBL_GEN_DIRECTORY}/${NBL_TARGET_NAME}.config")
46+
configure_file("${NBL_INPUT_MSVC_CONFIG_FILE}" "${NBL_GEN_DIRECTORY}/${NBL_TARGET_NAME}.config")
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (c) 2022 DevSH Graphics Programming Sp. z O.O.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# CMake script for generating msvc manifest during build time
16+
17+
if(DEFINED NBL_ROOT_PATH)
18+
if(NOT EXISTS ${NBL_ROOT_PATH})
19+
message(FATAL_ERROR "NBL_ROOT_PATH as '${NBL_ROOT_PATH}' is invalid!")
20+
endif()
21+
else()
22+
message(FATAL_ERROR "NBL_ROOT_PATH variable must be specified for this script!")
23+
endif()
24+
25+
if(NOT DEFINED NBL_GEN_DIRECTORY)
26+
message(FATAL_ERROR "NBL_GEN_DIRECTORY variable must be specified for this script!")
27+
endif()
28+
29+
if(NOT DEFINED NABLA_DLL_PATH)
30+
message(FATAL_ERROR "NABLA_DLL_PATH variable must be specified for this script!")
31+
endif()
32+
33+
cmake_path(GET NABLA_DLL_PATH FILENAME NABLA_DLL)
34+
35+
set(NBL_INPUT_MSVC_MANIFEST_FILE ${NBL_ROOT_PATH}/cmake/manifest/msvc/devshgraphicsprogramming.nabla.manifest)
36+
37+
message(STATUS "Generating ${NBL_GEN_DIRECTORY}/devshgraphicsprogramming.nabla.manifest")
38+
configure_file("${NBL_INPUT_MSVC_MANIFEST_FILE}" "${NBL_GEN_DIRECTORY}")

0 commit comments

Comments
 (0)