Skip to content

Commit c8d9952

Browse files
committed
Make nsc compile with DLL setup, introduce nbl_handle_dll_definitions and nbl_handle_runtime_lib_properties implementation CMake helpers, remove old ndt directory
1 parent 6e9e4f9 commit c8d9952

File tree

7 files changed

+42
-149
lines changed

7 files changed

+42
-149
lines changed

cmake/common.cmake

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,44 @@
1010
# distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
13-
# limitations under the License.
13+
# limitations under the License
1414

1515
include(ProcessorCount)
1616
set(_NBL_CPACK_PACKAGE_RELATIVE_ENTRY_ "$<$<NOT:$<STREQUAL:$<CONFIG>,Release>>:$<LOWER_CASE:$<CONFIG>>>" CACHE INTERNAL "")
1717

18-
# TODO: REDO THIS WHOLE THING AS FUNCTIONS
19-
# https://github.com/buildaworldnet/IrrlichtBAW/issues/311 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
18+
function(nbl_handle_dll_definitions _TARGET_ _SCOPE_)
19+
if(NOT TARGET Nabla)
20+
message(FATAL_ERROR "Internal error, Nabla target must be defined!")
21+
endif()
22+
23+
if(NOT TARGET ${_TARGET_})
24+
message(FATAL_ERROR "Internal error, requsted \"${_TARGET_}\" is not defined!")
25+
endif()
26+
27+
if(NBL_DYNAMIC_MSVC_RUNTIME)
28+
set(_NABLA_OUTPUT_DIR_ "${NBL_ROOT_PATH_BINARY}/src/nbl/$<CONFIG>/devshgraphicsprogramming.nabla")
29+
30+
target_compile_definitions(${_TARGET_} ${_SCOPE_}
31+
_NABLA_DLL_NAME_="$<TARGET_FILE_NAME:Nabla>";_NABLA_OUTPUT_DIR_="${_NABLA_OUTPUT_DIR_}";_NABLA_INSTALL_DIR_="${CMAKE_INSTALL_PREFIX}"
32+
)
33+
endif()
34+
35+
target_compile_definitions(${_TARGET_} ${_SCOPE_}
36+
_DXC_DLL_="${DXC_DLL}"
37+
)
38+
endfunction()
39+
40+
function(nbl_handle_runtime_lib_properties _TARGET_)
41+
if(NOT TARGET ${_TARGET_})
42+
message(FATAL_ERROR "Internal error, requsted \"${_TARGET_}\" is not defined!")
43+
endif()
44+
45+
if(NBL_DYNAMIC_MSVC_RUNTIME)
46+
set_target_properties(${_TARGET_} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
47+
else()
48+
set_target_properties(${_TARGET_} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
49+
endif()
50+
endfunction()
2051

2152
# Macro creating project for an executable
2253
# Project and target get its name from directory when this macro gets executed (truncating number in the beginning of the name and making all lower case)
@@ -40,27 +71,18 @@ macro(nbl_create_executable_project _EXTRA_SOURCES _EXTRA_OPTIONS _EXTRA_INCLUDE
4071
)
4172

4273
add_executable(${EXECUTABLE_NAME} ${NBL_EXECUTABLE_SOURCES})
74+
nbl_handle_runtime_lib_properties(${EXECUTABLE_NAME})
4375

44-
if(NBL_DYNAMIC_MSVC_RUNTIME)
45-
set_property(TARGET ${EXECUTABLE_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
46-
47-
if(WIN32 AND MSVC)
76+
if(WIN32 AND MSVC)
77+
if(NBL_DYNAMIC_MSVC_RUNTIME)
4878
target_link_options(${EXECUTABLE_NAME} PUBLIC "/DELAYLOAD:$<TARGET_FILE_NAME:Nabla>")
4979
endif()
50-
else()
51-
set_property(TARGET ${EXECUTABLE_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
52-
endif()
53-
54-
if(WIN32 AND MSVC)
80+
5581
target_link_options(${EXECUTABLE_NAME} PUBLIC "/DELAYLOAD:dxcompiler.dll")
5682
endif()
5783
endif()
5884

59-
if(WIN32 AND MSVC)
60-
target_compile_definitions(${EXECUTABLE_NAME} PUBLIC
61-
_DXC_DLL_="${DXC_DLL}"
62-
)
63-
endif()
85+
nbl_handle_dll_definitions(${EXECUTABLE_NAME} PUBLIC)
6486

6587
target_compile_definitions(${EXECUTABLE_NAME} PUBLIC _NBL_APP_NAME_="${EXECUTABLE_NAME}")
6688

@@ -255,31 +277,13 @@ macro(nbl_create_ext_library_project EXT_NAME LIB_HEADERS LIB_SOURCES LIB_INCLUD
255277
)
256278
endif()
257279

258-
if(NBL_DYNAMIC_MSVC_RUNTIME)
259-
if(WIN32 AND MSVC)
260-
set(_NABLA_OUTPUT_DIR_ "${NBL_ROOT_PATH_BINARY}/src/nbl/$<CONFIG>/devshgraphicsprogramming.nabla")
261-
262-
target_compile_definitions(${LIB_NAME} PUBLIC
263-
_NABLA_DLL_NAME_="$<TARGET_FILE_NAME:Nabla>";_NABLA_OUTPUT_DIR_="${_NABLA_OUTPUT_DIR_}";_NABLA_INSTALL_DIR_="${CMAKE_INSTALL_PREFIX}"
264-
)
265-
endif()
266-
endif()
267-
268-
if(WIN32 AND MSVC)
269-
target_compile_definitions(${LIB_NAME} PUBLIC
270-
_DXC_DLL_="${DXC_DLL}"
271-
)
272-
endif()
273-
274280
add_dependencies(${LIB_NAME} Nabla)
275281
target_link_libraries(${LIB_NAME} PUBLIC Nabla)
276282
target_compile_options(${LIB_NAME} PUBLIC ${LIB_OPTIONS})
277283
target_compile_definitions(${LIB_NAME} PUBLIC ${DEF_OPTIONS})
278-
if(NBL_DYNAMIC_MSVC_RUNTIME)
279-
set_target_properties(${LIB_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
280-
else()
281-
set_target_properties(${LIB_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
282-
endif()
284+
285+
nbl_handle_dll_definitions(${LIB_NAME} PUBLIC)
286+
nbl_handle_runtime_lib_properties(${LIB_NAME})
283287

284288
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
285289
add_compile_options(

tools/ndt/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

tools/ndt/__init__.py

Whitespace-only changes.

tools/ndt/config.json.template

Lines changed: 0 additions & 24 deletions
This file was deleted.

tools/ndt/main.cpp

Lines changed: 0 additions & 60 deletions
This file was deleted.

tools/ndt/test/config/release.json.template

Lines changed: 0 additions & 11 deletions
This file was deleted.

tools/ndt/test/test.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)