Skip to content

Commit 114c549

Browse files
committed
build: one liner ifs and some fixes
Signed-off-by: Ali Cheraghi <[email protected]>
1 parent 60e1e5b commit 114c549

File tree

6 files changed

+8
-34
lines changed

6 files changed

+8
-34
lines changed

3rdparty/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,7 @@ if(ENABLE_HLSL)
493493
endif()
494494

495495
foreach(trgt IN LISTS NBL_3RDPARTY_TARGETS)
496-
if(NBL_COMPILER_DYNAMIC_RUNTIME)
497-
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
498-
else()
499-
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
500-
endif()
496+
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${NBL_COMPILER_DYNAMIC_RUNTIME}>:DLL>")
501497

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

3rdparty/dxc/CMakeLists.txt

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

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

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

CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ option(NBL_STATIC_BUILD "" OFF) # ON for static builds, OFF for shared
2323
option(NBL_COMPILER_DYNAMIC_RUNTIME "" ON)
2424
option(NBL_SANITIZE_ADDRESS OFF)
2525

26-
if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
26+
if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
2727
if(NBL_SANITIZE_ADDRESS)
2828
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>")
2929
else()
@@ -34,14 +34,8 @@ endif()
3434
if(NBL_STATIC_BUILD)
3535
message(STATUS "Static Nabla build enabled!")
3636
else()
37-
if(MSVC)
38-
if(NBL_COMPILER_DYNAMIC_RUNTIME)
39-
message(STATUS "Shared Nabla build enabled!")
40-
else()
41-
message(FATAL_ERROR "Turn NBL_COMPILER_DYNAMIC_RUNTIME on! For dynamic Nabla builds dynamic MSVC runtime is mandatory!")
42-
endif()
43-
else()
44-
message(FATAL_ERROR "Nabla can't be built with shared libraries! Please make sure you are targetting Windows OS and MSVC compiler!")
37+
if(NOT NBL_COMPILER_DYNAMIC_RUNTIME)
38+
message(FATAL_ERROR "Turn NBL_COMPILER_DYNAMIC_RUNTIME on! For dynamic Nabla builds dynamic runtime is mandatory!")
4539
endif()
4640
endif()
4741

cmake/adjust/template/vendor/CXX_MSVC.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ if(NBL_SANITIZE_ADDRESS)
2121
list(APPEND NBL_CXX_DEBUG_COMPILE_OPTIONS /RTC1)
2222
endif()
2323

24-
set(NBL_DEBUG_CXX_COMPILE_OPTIONS
25-
$<$<COMPILE_LANGUAGE:CXX>:${NBL_CXX_DEBUG_COMPILE_OPTIONS}>
26-
)
27-
2824
# Release
2925
set(NBL_CXX_RELEASE_COMPILE_OPTIONS
3026
/Zc:__cplusplus /O2 /Ob2 /DNDEBUG /GL /MP${_NBL_JOBS_AMOUNT_} /Gy- /Zc:wchar_t /sdl- /GF /GS- /fp:fast

cmake/common.cmake

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ function(nbl_handle_runtime_lib_properties _TARGET_)
4343
message(FATAL_ERROR "Internal error, requsted \"${_TARGET_}\" is not defined!")
4444
endif()
4545

46-
if(MSVC)
47-
set_target_properties(${_TARGET_} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
48-
else()
49-
set_target_properties(${_TARGET_} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
50-
endif()
46+
set_target_properties(${_TARGET_} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${NBL_COMPILER_DYNAMIC_RUNTIME}>:DLL>")
5147
endfunction()
5248

5349
# Macro creating project for an executable

src/nbl/builtin/utils.cmake

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,8 @@ function(ADD_CUSTOM_BUILTIN_RESOURCES _TARGET_NAME_ _BUNDLE_NAME_ _BUNDLE_SEARCH
206206
"${_OUTPUT_HEADER_DIRECTORY_}"
207207
)
208208
set_target_properties(${_TARGET_NAME_} PROPERTIES CXX_STANDARD 20)
209-
210-
if(NBL_COMPILER_DYNAMIC_RUNTIME)
211-
set_property(TARGET ${_TARGET_NAME_} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
212-
else()
213-
set_property(TARGET ${_TARGET_NAME_} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
214-
endif()
209+
210+
set_property(TARGET ${_TARGET_NAME_} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${NBL_COMPILER_DYNAMIC_RUNTIME}>:DLL>")
215211

216212
set(NBL_BUILTIN_RESOURCES ${NBL_BUILTIN_RESOURCES}) # turn builtin resources paths list into variable
217213

0 commit comments

Comments
 (0)