plusui-native 0.2.69 → 0.2.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plusui-native",
3
- "version": "0.2.69",
3
+ "version": "0.2.72",
4
4
  "description": "PlusUI CLI - Build C++ desktop apps modern UI ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -27,11 +27,11 @@
27
27
  "semver": "^7.6.0",
28
28
  "which": "^4.0.0",
29
29
  "execa": "^8.0.1",
30
- "plusui-native-builder": "^0.1.68",
31
- "plusui-native-connect": "^0.1.68"
30
+ "plusui-native-builder": "^0.1.71",
31
+ "plusui-native-connect": "^0.1.71"
32
32
  },
33
33
  "peerDependencies": {
34
- "plusui-native-connect": "^0.1.68"
34
+ "plusui-native-connect": "^0.1.71"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
package/src/index.js CHANGED
@@ -211,8 +211,56 @@ function getCMakePath() {
211
211
  return 'cmake';
212
212
  }
213
213
 
214
+ // Find vcvarsall.bat for Windows builds (needed for Ninja generator)
215
+ let _vcvarsallCache = undefined;
216
+ function findVcvarsall() {
217
+ if (_vcvarsallCache !== undefined) return _vcvarsallCache;
218
+
219
+ const vswherePath = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe';
220
+ if (existsSync(vswherePath)) {
221
+ try {
222
+ const installPath = execSync(
223
+ `"${vswherePath}" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`,
224
+ { stdio: ['pipe', 'pipe', 'pipe'], encoding: 'utf8', timeout: 10000 }
225
+ ).trim();
226
+ if (installPath) {
227
+ const vcvars = join(installPath, 'VC', 'Auxiliary', 'Build', 'vcvarsall.bat');
228
+ if (existsSync(vcvars)) {
229
+ _vcvarsallCache = vcvars;
230
+ return vcvars;
231
+ }
232
+ }
233
+ } catch { }
234
+ }
235
+
236
+ // Fallback: scan known paths
237
+ const vsYears = ['2026', '2025', '2024', '2023', '2022', '2019'];
238
+ const vsEditions = ['Community', 'Professional', 'Enterprise', 'BuildTools'];
239
+ for (const year of vsYears) {
240
+ for (const edition of vsEditions) {
241
+ const vcvars = `C:\\Program Files\\Microsoft Visual Studio\\${year}\\${edition}\\VC\\Auxiliary\\Build\\vcvarsall.bat`;
242
+ if (existsSync(vcvars)) {
243
+ _vcvarsallCache = vcvars;
244
+ return vcvars;
245
+ }
246
+ }
247
+ }
248
+
249
+ _vcvarsallCache = null;
250
+ return null;
251
+ }
252
+
214
253
  function runCMake(args, options = {}) {
215
254
  const cmake = getCMakePath();
255
+
256
+ // On Windows, wrap cmake in vcvarsall to ensure cl.exe is in PATH (needed for Ninja)
257
+ if (process.platform === 'win32') {
258
+ const vcvarsall = findVcvarsall();
259
+ if (vcvarsall) {
260
+ return execSync(`cmd /c ""${vcvarsall}" x64 >nul 2>&1 && "${cmake}" ${args}"`, { stdio: 'inherit', shell: true, ...options });
261
+ }
262
+ }
263
+
216
264
  return execSync(`"${cmake}" ${args}`, { stdio: 'inherit', ...options });
217
265
  }
218
266
 
@@ -598,6 +646,10 @@ function buildBackend(platform = null, devMode = false) {
598
646
 
599
647
  if (platformConfig.generator) {
600
648
  cmakeArgs += ` -G "${platformConfig.generator}"`;
649
+ } else if (process.platform === 'win32') {
650
+ // Use Ninja on Windows to avoid VS generator compatibility issues
651
+ // Use embedded debug info (/Z7) to avoid VS 2026 PDB creation bug (C1041)
652
+ cmakeArgs += ' -G Ninja -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded';
601
653
  }
602
654
 
603
655
  log(`Configuring CMake...`, 'blue');
@@ -789,9 +841,31 @@ async function startBackend() {
789
841
 
790
842
  const buildDir = getDevBuildDir();
791
843
 
844
+ // On Windows, use Ninja generator to avoid VS generator compatibility issues
845
+ // Also use embedded debug info (/Z7) to avoid VS 2026 PDB creation bug (C1041)
846
+ let generatorArgs = '';
847
+ if (process.platform === 'win32') {
848
+ generatorArgs = ' -G Ninja -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded';
849
+ }
850
+
851
+ // Auto-clean build dir if generator changed (e.g. VS → Ninja)
852
+ const cacheFile = join(buildDir, 'CMakeCache.txt');
853
+ if (existsSync(cacheFile)) {
854
+ try {
855
+ const cacheContent = execSync(`type "${cacheFile}"`, { encoding: 'utf8', shell: true, stdio: ['pipe', 'pipe', 'ignore'] });
856
+ const generatorMatch = cacheContent.match(/CMAKE_GENERATOR:INTERNAL=(.*)/);
857
+ const cachedGenerator = generatorMatch ? generatorMatch[1].trim() : '';
858
+ const wantNinja = generatorArgs.includes('Ninja');
859
+ if ((wantNinja && cachedGenerator !== 'Ninja') || (!wantNinja && cachedGenerator === 'Ninja')) {
860
+ log(`Generator changed (${cachedGenerator} → ${wantNinja ? 'Ninja' : 'default'}), cleaning build dir...`, 'yellow');
861
+ execSync(process.platform === 'win32' ? `rmdir /s /q "${buildDir}"` : `rm -rf "${buildDir}"`, { stdio: 'ignore', shell: true });
862
+ }
863
+ } catch { }
864
+ }
865
+
792
866
  // Always configure with dev mode to ensure PLUSUI_DEV_MODE is set correctly
793
867
  log('Configuring CMake...', 'blue');
794
- runCMake(`-S . -B "${buildDir}" -DPLUSUI_DEV_MODE=ON`);
868
+ runCMake(`-S . -B "${buildDir}" -DPLUSUI_DEV_MODE=ON${generatorArgs}`);
795
869
 
796
870
  log('Compiling...', 'blue');
797
871
  runCMake(`--build "${buildDir}"`);
@@ -799,16 +873,17 @@ async function startBackend() {
799
873
  // Find executable
800
874
  let exePath;
801
875
  if (process.platform === 'win32') {
802
- // Visual Studio puts exe in build/dev/<projectname>/Debug/<projectname>.exe
803
- exePath = join(buildDir, projectName, 'Debug', `${projectName}.exe`);
876
+ // Ninja puts exe directly in build dir
877
+ exePath = join(buildDir, `${projectName}.exe`);
804
878
  if (!existsSync(exePath)) {
805
- exePath = join(buildDir, 'Debug', `${projectName}.exe`);
879
+ exePath = join(buildDir, 'bin', `${projectName}.exe`);
806
880
  }
881
+ // Fallback for VS generator (Debug subfolder)
807
882
  if (!existsSync(exePath)) {
808
- exePath = join(buildDir, 'bin', `${projectName}.exe`);
883
+ exePath = join(buildDir, projectName, 'Debug', `${projectName}.exe`);
809
884
  }
810
885
  if (!existsSync(exePath)) {
811
- exePath = join(buildDir, `${projectName}.exe`);
886
+ exePath = join(buildDir, 'Debug', `${projectName}.exe`);
812
887
  }
813
888
  } else {
814
889
  exePath = join(buildDir, projectName);
@@ -1,4 +1,10 @@
1
1
  cmake_minimum_required(VERSION 3.16)
2
+
3
+ # Enable modern MSVC debug information format (needed for /Z7 embedded debug)
4
+ if(POLICY CMP0141)
5
+ cmake_policy(SET CMP0141 NEW)
6
+ endif()
7
+
2
8
  project({{PROJECT_NAME}} VERSION {{PROJECT_VERSION}} LANGUAGES CXX)
3
9
 
4
10
  set(CMAKE_CXX_STANDARD 20)
@@ -1,4 +1,10 @@
1
1
  cmake_minimum_required(VERSION 3.16)
2
+
3
+ # Enable modern MSVC debug information format (needed for /Z7 embedded debug)
4
+ if(POLICY CMP0141)
5
+ cmake_policy(SET CMP0141 NEW)
6
+ endif()
7
+
2
8
  project({{PROJECT_NAME}} VERSION {{PROJECT_VERSION}} LANGUAGES CXX)
3
9
 
4
10
  set(CMAKE_CXX_STANDARD 20)