diff --git a/CMakeLists.txt b/CMakeLists.txt index f5192de..e34f510 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,9 +13,12 @@ project(boilerplate) set(APP_NAME "boilerplate") # The main executable. -file(GLOB SRC_FILES "src/*.h" "src/*.cc" "src/*.rc" "src/*.xml" "src/*.ico") +file(GLOB SRC_FILES "src/*.h" "src/*.cc") add_executable(${APP_NAME} ${SRC_FILES} "${CMAKE_CURRENT_BINARY_DIR}/encryption_key.h") +if(WIN32) + target_sources(${APP_NAME} PRIVATE "src/exe.rc" "src/exe.manifest") +endif() # Link with Yue. add_subdirectory(libyue) diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js index 5fa3bbb..dc61c26 100755 --- a/scripts/bootstrap.js +++ b/scripts/bootstrap.js @@ -2,24 +2,26 @@ const path = require('path') -const {targetCpu, cmake, mkdir, spawnSync} = require('./common') +const {targetCpu, mkdir, spawnSync} = require('./common') + +const cmake = path.resolve('node_modules', '@yogalayout', 'cmake-bin', 'bin', 'cmake') mkdir('out') if (process.platform == 'win32') { - process.exit(spawnSync(cmake, - ['-S', '.', '-B', 'out', - '-G', 'Visual Studio 19 2022', + process.exit(spawnSync(process.execPath, + [cmake, '-S', '.', '-B', 'out', + '-G', 'Visual Studio 17 2022', '-A', targetCpu == 'x64' ? 'x64' : 'Win32']).status) } else { mkdir('out/Release') - let code = spawnSync(cmake, - ['-D', `CMAKE_BUILD_TYPE=Release`, '../..'], + let code = spawnSync(process.execPath, + [cmake, '-D', `CMAKE_BUILD_TYPE=Release`, '../..'], {cwd: 'out/Release'}).status if (code != 0) process.exit(code) mkdir('out/Debug') - process.exit(spawnSync(cmake, - ['-D', `CMAKE_BUILD_TYPE=Debug`, '../..'], + process.exit(spawnSync(process.execPath, + [cmake, '-D', `CMAKE_BUILD_TYPE=Debug`, '../..'], {cwd: 'out/Debug'}).status) } diff --git a/scripts/build.js b/scripts/build.js index 2d0beed..bafd98f 100755 --- a/scripts/build.js +++ b/scripts/build.js @@ -10,8 +10,8 @@ const config = process.argv[2] ? process.argv[2] : 'Debug' if (process.platform == 'win32') { const vsPaths = [ - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin', - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\Enterprise\\MSBuild\\Current\\Bin', + 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin', + 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\MSBuild\\Current\\Bin', process.env.PATH ] const env = Object.assign(process.env, {PATH: vsPaths.join(path.delimiter)}) diff --git a/scripts/common.js b/scripts/common.js index ec577ce..4a8a074 100644 --- a/scripts/common.js +++ b/scripts/common.js @@ -16,11 +16,6 @@ const targetCpu = { arm64: 'arm64', }[narch] -// Find the path of cmake. -let cmake = path.resolve('node_modules', '@yogalayout', 'cmake-bin', 'bin', 'cmake') -if (process.platform == 'win') - cmake += '.exe' - // Make dir and ignore error. function mkdir(dir) { if (fs.existsSync(dir)) return @@ -52,7 +47,6 @@ const spawnSyncWrapper = (exec, args, options = {}) => { // Export public APIs. module.exports = { targetCpu, - cmake, mkdir, execSync: execSyncWrapper, spawnSync: spawnSyncWrapper, diff --git a/src/exe_manifest.xml b/src/exe.manifest similarity index 100% rename from src/exe_manifest.xml rename to src/exe.manifest diff --git a/src/exe.rc b/src/exe.rc index 862893a..81b2ccb 100644 --- a/src/exe.rc +++ b/src/exe.rc @@ -21,10 +21,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Yue" - VALUE "ProductName", "Muban" + VALUE "ProductName", "Boilerplate" VALUE "FileDescription", "Build cross-platform desktop apps" - VALUE "OriginalFilename", "muban.exe" - VALUE "InternalName", "muban" + VALUE "OriginalFilename", "boilerplate.exe" + VALUE "InternalName", "boilerplate" VALUE "LegalCopyright", "Public domain" END END