Skip to content

build: Add ClangCL profiles #791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
60e1e5b
build: Add ClangCL profiles
alichraghi Nov 21, 2024
114c549
build: one liner ifs and some fixes
alichraghi Nov 21, 2024
ff5513b
update dxc submodule
alichraghi Nov 21, 2024
44acfcf
build: simplify if
alichraghi Nov 22, 2024
dbff78d
Merge branch 'ali_clang' of github.com:Devsh-Graphics-Programming/Nabla
AnastaZIuk Apr 4, 2025
616f7d7
fixing CLang build, save work
AnastaZIuk Apr 8, 2025
aad8bb1
make Nabla Clang build work
AnastaZIuk Apr 8, 2025
7b8cb61
bad typo
AnastaZIuk Apr 8, 2025
062b5ba
update profiles & flags check handle, take care of Clang profile; ent…
AnastaZIuk Apr 11, 2025
39bb3e1
update dxc submodule with fixed clang 19.1.1 build, upgrade & correct…
AnastaZIuk Apr 11, 2025
cbb4db1
update GLI (use custom location for GLM + fix with templates) and GLM…
AnastaZIuk Apr 11, 2025
c1cc48b
explicitly set limits for Clang toolset, correct some of backend opti…
AnastaZIuk Apr 13, 2025
16088b9
Reduce device_capabilities_traits_jit.h instructions & use std::ostri…
AnastaZIuk Apr 14, 2025
8f454a9
update bzip2 submodule to latest *official* revision, adjust build sy…
AnastaZIuk Apr 14, 2025
b4e722a
remove `-Xclang=-fincremental-extensions` which causes funny compile …
AnastaZIuk Apr 14, 2025
eda05ee
adjust MSVC profile + correct incremental link options, update NBL_RE…
AnastaZIuk Apr 15, 2025
25e0120
get rid of MSVC Release linker fallback with /LTCG due to /GL - manua…
AnastaZIuk Apr 16, 2025
b5d6795
Create vendor/template/frontend/MSVC.cmake, update profiles, respect …
AnastaZIuk Apr 17, 2025
d1bb5c6
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk Apr 18, 2025
a1b9b99
ah DXC needs to point to devshFixes_clang_19_1_1
AnastaZIuk Apr 18, 2025
77ed416
keep designated initializers for ISwapchain's SSharedCreationParams, …
AnastaZIuk Apr 18, 2025
a2a7e72
for my sanity - add -DNDEBUG to Clang profile (Unix)
AnastaZIuk Apr 18, 2025
cde9e79
correct CMAKE_MSVC_DEBUG_INFORMATION_FORMAT logic hence make it work …
AnastaZIuk Apr 18, 2025
8246891
pull master & resolve conflicts
AnastaZIuk Apr 22, 2025
6e4392e
add more NEW policies, leave TODO comment for `cmake_policy`
AnastaZIuk Apr 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
path = 3rdparty/libexpat
url = git@github.com:Devsh-Graphics-Programming/libexpat.git
branch = master
[submodule "3rdparty/glm"]
path = 3rdparty/glm
url = git@github.com:AnastaZIuk/glm.git
[submodule "3rdparty/freetype2"]
path = 3rdparty/freetype2
url = git@github.com:Devsh-Graphics-Programming/freetype.git
Expand Down Expand Up @@ -117,3 +114,6 @@
[submodule "docker/compiler-explorer"]
path = docker/compiler-explorer
url = git@github.com:Devsh-Graphics-Programming/Compiler-Explorer-Docker.git
[submodule "3rdparty/glm"]
path = 3rdparty/glm
url = git@github.com:Devsh-Graphics-Programming/glm.git
38 changes: 14 additions & 24 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ if(_NBL_COMPILE_WITH_OPEN_EXR_)
endif()


#gli
# gli
option(_NBL_COMPILE_WITH_GLI_ "Build with GLI library" ON)
if(_NBL_COMPILE_WITH_GLI_)
set(_OLD_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
Expand All @@ -240,12 +240,23 @@ if(_NBL_COMPILE_WITH_GLI_)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_STATIC_LIBS OFF)
set(BUILD_TESTING OFF)
set(GLI_GLM_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/glm")
add_subdirectory(gli gli EXCLUDE_FROM_ALL)
set(BUILD_SHARED_LIBS ${_OLD_BUILD_SHARED_LIBS})
set(BUILD_STATIC_LIBS ${_OLD_BUILD_STATIC_LIBS})
set(BUILD_TESTING ${_OLD_BUILD_TESTING})
endif()

set(ENABLE_STATIC_LIB ON)
set(ENABLE_SHARED_LIB OFF)
set(ENABLE_EXAMPLES OFF)
set(ENABLE_DOCS OFF)
set(ENABLE_APP OFF)
set(ENABLE_LIB_ONLY ON)
set(ENABLE_TESTS OFF)
set(ENABLE_SUMMARY OFF)
add_subdirectory(bzip2 bzip2 EXCLUDE_FROM_ALL)

add_library(lzma OBJECT
lzma/C/Alloc.c
lzma/C/LzFind.c
Expand All @@ -262,17 +273,6 @@ add_library(lz4 OBJECT
lz4/lib/xxhash.c
)


add_library(bzip2 OBJECT
bzip2/blocksort.c
bzip2/bzlib.c
bzip2/compress.c
bzip2/crctable.c
bzip2/decompress.c
bzip2/huffman.c
bzip2/randtable.c
)

add_library(spirv_cross OBJECT
nbl_spirv_cross/spirv_cfg.cpp
nbl_spirv_cross/spirv_cross.cpp
Expand Down Expand Up @@ -419,12 +419,6 @@ add_library(aesGladman OBJECT

add_subdirectory(argparse argparse EXCLUDE_FROM_ALL)

option(GLM_TEST_ENABLE_SIMD_SSE4_2 "Enable SSE 4.2 optimizations" ON)
option(GLM_TEST_ENABLE "Build unit tests" OFF)
#add_subdirectory(glm EXCLUDE_FROM_ALL)
set(BUILD_SHARED_LIBS ${_OLD_BUILD_SHARED_LIBS})
set(BUILD_STATIC_LIBS ${_OLD_BUILD_STATIC_LIBS})

if (NBL_BUILD_MITSUBA_LOADER)
option(BUILD_tools "EXPAT: build the xmlwf tool for expat library" OFF)
option(BUILD_examples "EXPAT: build the examples for expat library" OFF)
Expand Down Expand Up @@ -465,7 +459,7 @@ set(NBL_3RDPARTY_TARGETS
shaderc_util
shaderc
jpeg-static
bzip2
bz2_static
simdjson
nlohmann_json
glslang
Expand Down Expand Up @@ -496,11 +490,7 @@ if (NBL_BUILD_IMGUI)
endif()

foreach(trgt IN LISTS NBL_3RDPARTY_TARGETS)
if(NBL_DYNAMIC_MSVC_RUNTIME)
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
else()
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${NBL_COMPILER_DYNAMIC_RUNTIME}>:DLL>")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK in Clang and GCC there are options about static linking of libstd-c++

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes there are and this property has effect only if MSVC ABI is the target


if(MSVC AND NBL_SANITIZE_ADDRESS)
set_property(TARGET ${trgt} PROPERTY COMPILE_OPTIONS /fsanitize=address)
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/bzip2
Submodule bzip2 updated 94 files
+83 −0 .appveyor.yml
+16 −0 .gitattributes
+32 −0 .gitignore
+204 −0 .gitlab-ci.yml
+3 −0 .gitmodules
+19 −0 AUTHORS
+463 −144 CMakeLists.txt
+27 −0 CMakeOptions.txt
+281 −0 COMPILING.md
+7 −7 COPYING
+0 −217 Makefile
+0 −59 Makefile-libbz2_so
+325 −184 NEWS.md
+0 −215 README
+0 −58 README.COMPILATION.PROBLEMS
+5 −5 README.XML.STUFF
+112 −22 README.md
+0 −25 appveyor.yml
+72 −72 blocksort.c
+1 −0 bz_version.h.in
+8 −8 bzdiff
+18 −8 bzgrep
+0 −23 bzip2-config.cmake.in
+220 −225 bzip2.c
+28 −0 bzip2.doap
+11 −0 bzip2.pc.in
+3 −4 bzip2.txt
+58 −28 bzip2recover.c
+132 −124 bzlib.c
+90 −89 bzlib.h
+14 −16 bzlib_private.h
+18 −0 cmake/ExtractValidFlags.cmake
+40 −0 cmake/FindCUnit.cmake
+36 −0 cmake/FindValgrind.cmake
+26 −0 cmake/SymLink.cmake
+11 −0 cmake/Version.cmake
+0 −19 cmake/runtest.cmake
+74 −0 code-of-conduct.md
+50 −51 compress.c
+3 −3 crctable.c
+34 −28 decompress.c
+0 −93 dlltest.dsp
+21 −0 docs/CMakeLists.txt
+14 −0 docs/RELEASING.md
+0 −0 docs/bz-common.xsl
+0 −0 docs/bz-fo.xsl
+7 −4 docs/bz-html.xsl
+0 −0 docs/bzip.css
+2 −2 docs/entities.xml
+5 −5 docs/format.pl
+54 −89 docs/manual.xml
+17 −0 docs/meson.build
+6 −6 docs/xmlproc.sh
+7 −7 huffman.c
+41 −0 install_links.py
+1 −1 libbz2.def
+0 −130 libbz2.dsp
+0 −63 makefile.msc
+8 −0 man/CMakeLists.txt
+0 −0 man/bzdiff.1
+8 −8 man/bzgrep.1
+94 −73 man/bzip2.1
+5 −5 man/bzip2.1.preformatted
+0 −0 man/bzmore.1
+19 −0 man/meson.build
+0 −2,540 manual.html
+ manual.pdf
+ manual.ps
+177 −0 meson.build
+5 −0 meson_options.txt
+3 −3 mk251.c
+7 −0 patches-not-included.txt
+55 −55 randtable.c
+5 −5 spewG.c
+75 −0 tests/CMakeLists.txt
+69 −0 tests/README.md
+1 −0 tests/input/bzip2-testfiles
+ tests/input/quick/sample1.bz2
+ tests/input/quick/sample1.ref
+ tests/input/quick/sample2.bz2
+ tests/input/quick/sample2.ref
+ tests/input/quick/sample3.bz2
+0 −0 tests/input/quick/sample3.ref
+134 −0 tests/large_test.py
+46 −0 tests/meson.build
+131 −0 tests/quick_test.py
+215 −0 tests/testcase.py
+8 −8 unzcrash.c
+48 −0 version.rc
+54 −0 version.rc.in
+0 −9 words0
+0 −4 words1
+0 −5 words2
+0 −30 words3
6 changes: 1 addition & 5 deletions 3rdparty/dxc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ if(WIN32)
endif()
endif()

if(NBL_DYNAMIC_MSVC_RUNTIME)
list(APPEND NBL_DXC_CMAKE_OPTIONS "-DCMAKE_MSVC_RUNTIME_LIBRARY:STATIC=MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
else()
list(APPEND NBL_DXC_CMAKE_OPTIONS "-DCMAKE_MSVC_RUNTIME_LIBRARY:STATIC=MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
list(APPEND NBL_DXC_CMAKE_OPTIONS "-DCMAKE_MSVC_RUNTIME_LIBRARY:STATIC=MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${NBL_COMPILER_DYNAMIC_RUNTIME}>:DLL>")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as with the general nabla comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# perform DXC compile standard requirement test
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/gli
Submodule gli updated 161 files
2 changes: 1 addition & 1 deletion 3rdparty/glm
Submodule glm updated 1525 files
29 changes: 11 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
# This file is part of the "Nabla Engine".
# For conditions of distribution and use, see copyright notice in nabla.h.in or nabla.h

cmake_minimum_required(VERSION 3.29)
cmake_policy(SET CMP0112 NEW)
cmake_minimum_required(VERSION 3.31)
# TODO: Yas - once we deploy 4.x we will fire `cmake_policy` instead of manually picking policies
# https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html#policy-version
# also we should update deps which throw warnings about < 3.10 compatibility
cmake_policy(SET CMP0003 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0077.html#cmp0077
cmake_policy(SET CMP0077 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0077.html#cmp0077
cmake_policy(SET CMP0112 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0112.html#cmp0112
cmake_policy(SET CMP0141 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0141.html#policy:CMP0141
cmake_policy(SET CMP0118 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0118.html#policy:CMP0118

Expand All @@ -21,28 +26,16 @@ if(MSVC)
endif()

option(NBL_STATIC_BUILD "" OFF) # ON for static builds, OFF for shared
option(NBL_DYNAMIC_MSVC_RUNTIME "" ON)
option(NBL_COMPILER_DYNAMIC_RUNTIME "" ON)
option(NBL_SANITIZE_ADDRESS OFF)

if(MSVC)
if(NBL_SANITIZE_ADDRESS)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>")
else()
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug>:EditAndContinue>$<$<CONFIG:RelWithDebInfo>:ProgramDatabase>")
endif()
endif()
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT $<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>) # ignored on non xMSVC-ABI targets

if(NBL_STATIC_BUILD)
message(STATUS "Static Nabla build enabled!")
else()
if(MSVC)
if(NBL_DYNAMIC_MSVC_RUNTIME)
message(STATUS "Shared Nabla build enabled!")
else()
message(FATAL_ERROR "Turn NBL_DYNAMIC_MSVC_RUNTIME on! For dynamic Nabla builds dynamic MSVC runtime is mandatory!")
endif()
else()
message(FATAL_ERROR "Nabla can't be built with shared libraries! Please make sure you are targetting Windows OS and MSVC compiler!")
if(NOT NBL_COMPILER_DYNAMIC_RUNTIME)
message(FATAL_ERROR "Turn NBL_COMPILER_DYNAMIC_RUNTIME on! For dynamic Nabla builds dynamic runtime is mandatory!")
endif()
Comment on lines +37 to 39

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aah ok so we want to ban compiling with static-libstdc++

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we agreed it must match

endif()

Expand Down
24 changes: 20 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"hidden": true,
"inherits": "ci-configure-static-base",
"cacheVariables": {
"NBL_DYNAMIC_MSVC_RUNTIME": "OFF"
"NBL_COMPILER_DYNAMIC_RUNTIME": "OFF"
},
"condition": {
"type": "allOf",
Expand All @@ -69,7 +69,7 @@
"hidden": true,
"inherits": "ci-configure-dynamic-base",
"cacheVariables": {
"NBL_DYNAMIC_MSVC_RUNTIME": "ON"
"NBL_COMPILER_DYNAMIC_RUNTIME": "ON"
},
"condition": {
"type": "allOf",
Expand Down Expand Up @@ -156,7 +156,7 @@
"hidden": true,
"inherits": "user-configure-static-base",
"cacheVariables": {
"NBL_DYNAMIC_MSVC_RUNTIME": "OFF"
"NBL_COMPILER_DYNAMIC_RUNTIME": "OFF"
},
"condition": {
"type": "equals",
Expand All @@ -169,7 +169,7 @@
"hidden": true,
"inherits": "user-configure-dynamic-base",
"cacheVariables": {
"NBL_DYNAMIC_MSVC_RUNTIME": "ON"
"NBL_COMPILER_DYNAMIC_RUNTIME": "ON"
},
"condition": {
"type": "equals",
Expand All @@ -193,6 +193,22 @@
"generator": "Visual Studio 17 2022",
"toolset": "v143"
},
{
"name": "user-configure-static-clangcl",
"inherits": "user-configure-static-windows-base",
"displayName": "[USER]: Static library target, Visual Studio 17 2022 generator, ClangCL toolset",
"description": "Configure as static library with Visual Studio 17 2022 generator and ClangCL toolset",
"generator": "Visual Studio 17 2022",
"toolset": "ClangCL"
},
{
"name": "user-configure-dynamic-clangcl",
"inherits": "user-configure-dynamic-windows-base",
"displayName": "[USER]: Dynamic library target, Visual Studio 17 2022 generator, ClangCL toolset",
"description": "Configure as dynamic library with Visual Studio 17 2022 generator and ClangCL toolset",
"generator": "Visual Studio 17 2022",
"toolset": "ClangCL"
},
{
"name": "user-configure-static-ninja-multi",
"inherits": "user-configure-static-windows-base",
Expand Down
Loading