Skip to content

Commit 322998d

Browse files
authored
Merge pull request #757 from Devsh-Graphics-Programming/vsconfig
Added .vsconfig
2 parents 439640a + 2cef40d commit 322998d

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

.vsconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"version": "1.0",
3+
"components": [
4+
"Microsoft.VisualStudio.Component.CoreEditor",
5+
"Microsoft.VisualStudio.Workload.CoreEditor",
6+
"Microsoft.Component.MSBuild",
7+
"Microsoft.VisualStudio.Component.VC.CoreIde",
8+
"Microsoft.VisualStudio.Component.Windows10SDK",
9+
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
10+
"Microsoft.VisualStudio.Component.Graphics.Tools",
11+
"Microsoft.VisualStudio.Component.VC.DiagnosticTools",
12+
"Microsoft.VisualStudio.Component.Windows11SDK.22621",
13+
"Microsoft.VisualStudio.Component.VC.ATL",
14+
"Microsoft.VisualStudio.Component.SecurityIssueAnalysis",
15+
"Microsoft.VisualStudio.Component.VC.ATLMFC",
16+
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
17+
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
18+
"Microsoft.VisualStudio.Component.VC.CMake.Project",
19+
"Microsoft.VisualStudio.Component.VC.ASAN",
20+
"Microsoft.VisualStudio.Workload.NativeDesktop",
21+
"Microsoft.Net.ComponentGroup.TargetingPacks.Common"
22+
],
23+
"extensions": []
24+
}

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ set(NBL_BUILTIN_RESOURCES_DIRECTORY_PATH "${NBL_ROOT_PATH}/include/nbl/builtin")
6666
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${NBL_ROOT_PATH}/cmake" CACHE PATH "")
6767
get_property(NBL_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
6868

69+
include(common)
70+
#import .vsconfig file with VS components required for Nabla
71+
if(WIN32 AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
72+
option(NBL_ENABLE_VS_CONFIG_IMPORT "" OFF)
73+
NBL_IMPORT_VS_CONFIG()
74+
endif()
75+
6976
# Configure CCache if available
7077
find_program(CCACHE_FOUND ccache)
7178
if(CCACHE_FOUND)
@@ -189,7 +196,6 @@ get_filename_component(NBL_MEDIA_DIRECTORY_ABS "${NBL_MEDIA_DIRECTORY}" ABSOLUTE
189196

190197
include(submodules/update)
191198
find_package(Python3 COMPONENTS Interpreter REQUIRED)
192-
include(common)
193199

194200
add_subdirectory(${THIRD_PARTY_SOURCE_DIR})
195201

cmake/common.cmake

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,4 +1298,25 @@ macro(NBL_GET_ALL_TARGETS_RECURSIVE NBL_TARGETS NBL_DIRECTORY)
12981298

12991299
get_property(NBL_GATHERED_TARGETS DIRECTORY ${NBL_DIRECTORY} PROPERTY BUILDSYSTEM_TARGETS)
13001300
list(APPEND ${NBL_TARGETS} ${NBL_GATHERED_TARGETS})
1301-
endmacro()
1301+
endmacro()
1302+
1303+
function(NBL_IMPORT_VS_CONFIG)
1304+
if(NBL_ENABLE_VS_CONFIG_IMPORT)
1305+
message(STATUS "NOTICE: Configuration will continue after Visual Studio Installer is closed.")
1306+
message(STATUS "To disable VS config import disable the NBL_IMPORT_VS_CONFIG option.")
1307+
set(NBL_DEVENV_ISOLATION_INI_PATH "${CMAKE_GENERATOR_INSTANCE}/Common7/IDE/devenv.isolation.ini")
1308+
file(READ ${NBL_DEVENV_ISOLATION_INI_PATH} NBL_DEVENV_ISOLATION_INI_CONTENT)
1309+
string(REPLACE "/" "\\" NBL_VS_INSTALLATION_PATH ${CMAKE_GENERATOR_INSTANCE})
1310+
string(REGEX MATCH "SetupEngineFilePath=\"([^\"]*)\"" _match "${NBL_DEVENV_ISOLATION_INI_CONTENT}")
1311+
set(NBL_VS_INSTALLER_PATH "${CMAKE_MATCH_1}")
1312+
1313+
execute_process(COMMAND "${NBL_VS_INSTALLER_PATH}" modify --installPath "${NBL_VS_INSTALLATION_PATH}" --config "${NBL_ROOT_PATH}/.vsconfig" --allowUnsignedExtensions
1314+
ERROR_VARIABLE vsconfig_error
1315+
RESULT_VARIABLE vsconfig_result)
1316+
1317+
if(NOT vsconfig_result EQUAL 0)
1318+
message(FATAL_ERROR "Visual Studio Installer error: ${vsconfig_error}")
1319+
endif()
1320+
1321+
endif()
1322+
endfunction()

0 commit comments

Comments
 (0)