Description
When using the
--run-cmake
flag with VS2017 the generator selected will always be
Visual Studio 14 2015
this is because the check [here](
https://github.com/appcelerator/titanium_mobile_windows/blob/18d58eb3a3b123ac916017661b83635a28e8caec/templates/module/default/template/windows/plugins/hooks/windows.js#L41) needs to be data.windowsInfo.selectedVisualStudio
Below is the working code
function selectVisualStudio(data) {
if (data.windowsInfo && data.windowsInfo.selectedVisualStudio) {
var version = data.windowsInfo.selectedVisualStudio.version;
if (version == '12.0') {
return 'Visual Studio 12 2013';
} else if (version == '14.0') {
return 'Visual Studio 14 2015';
} else if (/^Visual Studio \w+ 2017/.test(version)) {
return 'Visual Studio 15 2017';
}
}
return 'Visual Studio 14 2015';
}
Steps to reproduce
You need VS2017 to test this
1. Grab
https://github.com/appcelerator-archive/ti.paint
2. Overwrite ti.paint/windows/plugins/hooks/windows.js with the hook [here](
https://github.com/appcelerator/titanium_mobile_windows/blob/18d58eb3a3b123ac916017661b83635a28e8caec/templates/module/default/template/windows/plugins/hooks/windows.js)
3. Make sure the path at ti.paint/blob/master/windows/CMakeLists.txt#L24, matches your selected
4. Build the module using
appc run -p windows --build-only --run-cmake
Actual
Errors out with
[DEBUG] Run CMake on C:\Users\ewan\Documents\git\ti.paint\windows\Windows10.Win32
[WARN] CMake Error at CMakeLists.txt:20 (project):
A Windows Store component with CMake requires both the Windows Desktop SDK
as well as the Windows Store '10.0' SDK. Please make sure that you have
both installed
[INFO] -- Configuring incomplete, errors occurred!
See also "C:/Users/ewan/Documents/git/ti.paint/windows/Windows10.Win32/CMakeFiles/CMakeOutput.log".
Checking ti.paint\windows\Windows10.Win32\CMakeCache.txt shows CMAKE_GENERATOR:INTERNAL is Visual Studio 14 2015
Expected
Should select VS2017 generator and build successfully (note that you might still see a failure due to it attempting to build 8.1)
FYI Hyperloop had similar issue (TIMOB-25077) and here's the fix: https://github.com/appcelerator/hyperloop.next/pull/200/files
This issue is addressed in the [PR for TIMOB-24189](https://github.com/appcelerator/titanium_mobile_windows/pull/959/commits/02e554618b29d2a88a44252a4ac5d6ce1a81d475).
Verified changes in 6.2.0.v20170821203442