Skip to content

Commit

Permalink
[unity]支持参数切换vs版本,fix #1837
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Sep 12, 2024
1 parent 543913c commit 75034c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions unity/cli/cmd.mts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ program
)
.option("--backend <backend>", "the JS backend will be used", "v8_9.4")
.option('-ws, --websocket <number>', 'with websocket support')
.option('-G, --generator <generator-name>', 'cmake generator name')
.action(function (quickcommand, options) {
let backend = options.backend;
let config = options.config;
Expand Down
9 changes: 6 additions & 3 deletions unity/cli/make.mts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ interface BuildOptions {
platform: 'osx' | 'win' | 'ios' | 'android' | 'linux' | 'ohos' | 'wasm',
arch: 'x64' | 'ia32' | 'armv7' | 'arm64' | 'wasm32' | 'auto',
backend: string,
websocket?: number
websocket?: number,
generator?: string
}

//// 脚本 scripts
Expand Down Expand Up @@ -153,7 +154,8 @@ const platformCompileConfig = {
outputPluginPath: 'x86_64',
hook: function (CMAKE_BUILD_PATH: string, options: BuildOptions, cmakeAddedLibraryName: string, cmakeDArgs: string) {
cd(CMAKE_BUILD_PATH);
assert.equal(0, exec(`cmake ${cmakeDArgs} -DJS_ENGINE=${options.backend} -DCMAKE_BUILD_TYPE=${options.config} -G "Visual Studio 16 2019" -A x64 ..`).code)
const generator = options.generator || 'Visual Studio 16 2019';
assert.equal(0, exec(`cmake ${cmakeDArgs} -DJS_ENGINE=${options.backend} -DCMAKE_BUILD_TYPE=${options.config} -G "${generator}" -A x64 ..`).code)
cd("..")
assert.equal(0, exec(`cmake --build ${CMAKE_BUILD_PATH} --config ${options.config}`).code)

Expand All @@ -164,7 +166,8 @@ const platformCompileConfig = {
outputPluginPath: 'x86',
hook: function (CMAKE_BUILD_PATH: string, options: BuildOptions, cmakeAddedLibraryName: string, cmakeDArgs: string) {
cd(CMAKE_BUILD_PATH);
assert.equal(0, exec(`cmake ${cmakeDArgs} -DJS_ENGINE=${options.backend} -DCMAKE_BUILD_TYPE=${options.config} -G "Visual Studio 16 2019" -A Win32 ..`).code)
const generator = options.generator || 'Visual Studio 16 2019';
assert.equal(0, exec(`cmake ${cmakeDArgs} -DJS_ENGINE=${options.backend} -DCMAKE_BUILD_TYPE=${options.config} -G "${generator}" -A Win32 ..`).code)
cd("..")
assert.equal(0, exec(`cmake --build ${CMAKE_BUILD_PATH} --config ${options.config}`).code)

Expand Down

0 comments on commit 75034c0

Please sign in to comment.