Skip to content

Commit 3af47b3

Browse files
committed
Added option to install required VS components on project configuration
1 parent 739e9ec commit 3af47b3

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@ 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+
#import .vsconfig file with VS components required for Nabla
70+
if(WIN32 AND MSVC)
71+
option(NBL_IMPORT_VS_CONFIG "" ON)
72+
73+
if(NBL_IMPORT_VS_CONFIG)
74+
message(STATUS "NOTICE: Configuration will continue after Visual Studio Installer is closed.")
75+
message(STATUS "To disable VS config import uncheck the NBL_IMPORT_VS_CONFIG option.")
76+
set(DEVENV_ISOLATION_INI_PATH "${CMAKE_GENERATOR_INSTANCE}/Common7/IDE/devenv.isolation.ini")
77+
file(READ ${DEVENV_ISOLATION_INI_PATH} DEVENV_ISOLATION_INI_CONTENT)
78+
string(REGEX MATCH "SetupEngineFilePath=\"([^\"]*)\"" _match "${DEVENV_ISOLATION_INI_CONTENT}")
79+
string(REPLACE "/" "\\" NBL_VS_INSTALLATION_PATH ${CMAKE_GENERATOR_INSTANCE})
80+
set(VS_INSTALLER_PATH "${CMAKE_MATCH_1}")
81+
82+
execute_process(COMMAND "${VS_INSTALLER_PATH}" modify --installPath "${NBL_VS_INSTALLATION_PATH}" --config "${NBL_ROOT_PATH}/.vsconfig" --allowUnsignedExtensions)
83+
endif()
84+
endif()
85+
6986
# Configure CCache if available
7087
find_program(CCACHE_FOUND ccache)
7188
if(CCACHE_FOUND)

0 commit comments

Comments
 (0)