Skip to content

Commit 563de02

Browse files
author
devsh
committed
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla
2 parents dfdb909 + cceae56 commit 563de02

File tree

6 files changed

+59
-21
lines changed

6 files changed

+59
-21
lines changed

3rdparty/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ option(WITH_JAVA "libjpeg-turbo" OFF)
180180
set(CMAKE_INSTALL_DOCDIR "${CMAKE_CURRENT_BINARY_DIR}/libjpeg-turbo/install/docdir")
181181
set(CMAKE_INSTALL_MANDIR "${CMAKE_CURRENT_BINARY_DIR}/libjpeg-turbo/install/mandir")
182182
add_subdirectory(libjpeg-turbo libjpeg-turbo EXCLUDE_FROM_ALL)
183+
NBL_TARGET_FORCE_ASSEMBLER_EXECUTABLE(simd ASM_NASM libjpeg-turbo/simd/)
184+
183185
unset(CMAKE_INSTALL_DOCDIR)
184186
unset(CMAKE_INSTALL_MANDIR)
185187

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ include(ExternalProject)
1313
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchains/android/build.cmake)
1414

1515
project(Nabla LANGUAGES CXX C)
16-
enable_language(C CXX ASM)
16+
enable_language(C CXX ASM ASM_NASM)
17+
18+
if(MSVC)
19+
enable_language(ASM_MASM)
20+
endif()
1721

1822
option(NBL_STATIC_BUILD "" OFF) # ON for static builds, OFF for shared
1923
option(NBL_DYNAMIC_MSVC_RUNTIME "" ON)
@@ -30,7 +34,7 @@ endif()
3034
if(NBL_STATIC_BUILD)
3135
message(STATUS "Static Nabla build enabled!")
3236
else()
33-
if(WIN32 AND MSVC)
37+
if(MSVC)
3438
if(NBL_DYNAMIC_MSVC_RUNTIME)
3539
message(STATUS "Shared Nabla build enabled!")
3640
else()

CMakePresets.json

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"minor": 29,
66
"patch": 2
77
},
8-
98
"configurePresets": [
109
{
1110
"name": "ci-configure-base",
@@ -109,21 +108,27 @@
109108
"inherits": "ci-configure-static-windows-base",
110109
"displayName": "[CI]: Static library target, Ninja multi-config generator",
111110
"description": "Configure as static library with Ninja multi-config generator",
112-
"generator": "Ninja Multi-Config"
111+
"generator": "Ninja Multi-Config",
112+
"cacheVariables": {
113+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
114+
}
113115
},
114116
{
115117
"name": "ci-configure-dynamic-ninja-multi",
116118
"inherits": "ci-configure-dynamic-windows-base",
117119
"displayName": "[CI]: Dynamic library target, Ninja multi-config generator",
118120
"description": "Configure as dynamic library with Ninja multi-config generator",
119-
"generator": "Ninja Multi-Config"
121+
"generator": "Ninja Multi-Config",
122+
"cacheVariables": {
123+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
124+
}
120125
},
121126
{
122127
"name": "user-configure-base",
123128
"hidden": true,
124129
"cacheVariables": {
125130
"NBL_CI_MODE": "OFF",
126-
"NBL_UPDATE_GIT_SUBMODULE": "ON",
131+
"NBL_UPDATE_GIT_SUBMODULE": "OFF",
127132
"NBL_RUN_TESTS": "OFF",
128133
"NBL_CPACK_CI": "OFF"
129134
}
@@ -193,14 +198,20 @@
193198
"inherits": "user-configure-static-windows-base",
194199
"displayName": "[USER]: Static library target, Ninja multi-config generator",
195200
"description": "Configure as static library with Ninja multi-config generator",
196-
"generator": "Ninja Multi-Config"
201+
"generator": "Ninja Multi-Config",
202+
"cacheVariables": {
203+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
204+
}
197205
},
198206
{
199207
"name": "user-configure-dynamic-ninja-multi",
200208
"inherits": "user-configure-dynamic-windows-base",
201209
"displayName": "[USER]: Dynamic library target, Ninja multi-config generator",
202210
"description": "Configure as dynamic library with Ninja multi-config generator",
203-
"generator": "Ninja Multi-Config"
211+
"generator": "Ninja Multi-Config",
212+
"cacheVariables": {
213+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
214+
}
204215
},
205216
{
206217
"name": "user-configure-static-ninja-release",
@@ -209,7 +220,8 @@
209220
"description": "Configure as static Release library with Ninja single-config generator",
210221
"generator": "Ninja",
211222
"cacheVariables": {
212-
"CMAKE_BUILD_TYPE": "Release"
223+
"CMAKE_BUILD_TYPE": "Release",
224+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
213225
}
214226
},
215227
{
@@ -219,7 +231,8 @@
219231
"description": "Configure as dynamic Release library with Ninja single-config generator",
220232
"generator": "Ninja",
221233
"cacheVariables": {
222-
"CMAKE_BUILD_TYPE": "Release"
234+
"CMAKE_BUILD_TYPE": "Release",
235+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
223236
}
224237
},
225238
{
@@ -229,7 +242,8 @@
229242
"description": "Configure as static RelWithDebInfo library with Ninja single-config generator",
230243
"generator": "Ninja",
231244
"cacheVariables": {
232-
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
245+
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
246+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
233247
}
234248
},
235249
{
@@ -239,7 +253,8 @@
239253
"description": "Configure as dynamic RelWithDebInfo library with Ninja single-config generator",
240254
"generator": "Ninja",
241255
"cacheVariables": {
242-
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
256+
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
257+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
243258
}
244259
},
245260
{
@@ -249,7 +264,8 @@
249264
"description": "Configure as static Debug library with Ninja single-config generator",
250265
"generator": "Ninja",
251266
"cacheVariables": {
252-
"CMAKE_BUILD_TYPE": "Debug"
267+
"CMAKE_BUILD_TYPE": "Debug",
268+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
253269
}
254270
},
255271
{
@@ -259,7 +275,8 @@
259275
"description": "Configure as dynamic Debug library with Ninja single-config generator",
260276
"generator": "Ninja",
261277
"cacheVariables": {
262-
"CMAKE_BUILD_TYPE": "Debug"
278+
"CMAKE_BUILD_TYPE": "Debug",
279+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
263280
}
264281
}
265282
],
@@ -413,7 +430,6 @@
413430
"displayName": "[USER]: Dynamic Debug library target, Ninja single-config generator",
414431
"description": "Build Nabla as dynamic Debug library with Ninja single-config generator"
415432
}
416-
417433
],
418434
"packagePresets": [
419435
{

cmake/common.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,4 +1321,15 @@ function(NBL_IMPORT_VS_CONFIG)
13211321
message(FATAL_ERORR "Cannot request importing VS config, doesn't meet requirements!")
13221322
endif()
13231323

1324-
endfunction()
1324+
endfunction()
1325+
1326+
macro(NBL_TARGET_FORCE_ASSEMBLER_EXECUTABLE _NBL_TARGET_ _NBL_ASM_DIALECT_ _NBL_PREPEND_PATH_TRANSFORM_)
1327+
get_target_property(_NBL_TARGET_SOURCES_ "${_NBL_TARGET_}" SOURCES)
1328+
list(FILTER _NBL_TARGET_SOURCES_ INCLUDE REGEX "\\.asm$")
1329+
list(TRANSFORM _NBL_TARGET_SOURCES_ PREPEND "${_NBL_PREPEND_PATH_TRANSFORM_}")
1330+
1331+
set_source_files_properties(${_NBL_TARGET_SOURCES_}
1332+
TARGET_DIRECTORY "${_NBL_TARGET_}"
1333+
PROPERTIES LANGUAGE "${_NBL_ASM_DIALECT_}"
1334+
)
1335+
endmacro()

docs/build/WINDOWS.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,23 @@ You also have options `BUILD_EXAMPLES` and `BUILD_TOOLS` which do exactly what t
4646

4747
For Windows *MSVC* required, *MinGW* build system maintenance will be delegated to the community.
4848

49-
### Ninja Multi-Config generator
49+
### Ninja Multi-Config generator & MSVC
5050

51-
The target toolset is MSVC. Before invoking CMake you need to [initialize VS's environment](https://learn.microsoft.com/en-us/cpp/build/cmake-presets-vs?view=msvc-170#sourcing-the-environment-when-building-with-command-line-generators-on-windows) by calling
51+
#### Command line
52+
53+
Open command line, init MSVC [toolset environment](https://learn.microsoft.com/en-us/cpp/build/cmake-presets-vs?view=msvc-170#sourcing-the-environment-when-building-with-command-line-generators-on-windows) by calling
5254

5355
```cmd
5456
vcvarsall.bat <platform>
5557
```
5658

57-
in your cmd (eg. `vcvarsall.bat x64` call will initialize environment for amd64, for more info go [here](https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#vcvarsall-syntax)). Once initialization is done you can use Ninja CMake preset to build Nabla, eg.
59+
(eg. `vcvarsall.bat x64` call will initialize environment for amd64, for more info see [following](https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#vcvarsall-syntax)). Once initialized fire a ninja preset.
5860

5961
```cmd
62+
cmake --preset user-configure-dynamic-ninja-multi
6063
cmake --build --preset user-build-dynamic-ninja-multi --config Debug -- --quiet
6164
```
6265

63-
The build preset will pick configure preset associated with it and invoke configure then build. Pay attention that if you don't initialize VS's environment the following will fail to compile with MSVC toolset.
66+
#### With Visual Studio
67+
68+
Follow VS [tutorial](https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170).

0 commit comments

Comments
 (0)