diff --git a/1k/1kiss.ps1 b/1k/1kiss.ps1 index f6455c4..bd879e7 100644 --- a/1k/1kiss.ps1 +++ b/1k/1kiss.ps1 @@ -236,6 +236,7 @@ $options = @{ dll = $false u = $false # whether delete 1kdist cross-platform prebuilt folder: path/to/_x dm = $false # dump compiler preprocessors + i = $false # perform install } $optName = $null @@ -1837,16 +1838,23 @@ if (!$setupOnly) { # step4. build # apply additional build options - $BUILD_ALL_OPTIONS += "--parallel" - $BUILD_ALL_OPTIONS += "$($options.j)" + $BUILD_ALL_OPTIONS += "--parallel", "$($options.j)" + if (!$cmake_target) { $cmake_target = $options.t } + if ($cmake_target) { $BUILD_ALL_OPTIONS += '--target', $cmake_target } + $1k.println("BUILD_ALL_OPTIONS=$BUILD_ALL_OPTIONS, Count={0}" -f $BUILD_ALL_OPTIONS.Count) + + # forward non-cmake args to underlaying build toolchain, must at last if (($cmake_generator -eq 'Xcode') -and !$BUILD_ALL_OPTIONS.Contains('--verbose')) { $BUILD_ALL_OPTIONS += '--', '-quiet' } - $1k.println("BUILD_ALL_OPTIONS=$BUILD_ALL_OPTIONS, Count={0}" -f $BUILD_ALL_OPTIONS.Count) - $1k.println("cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS") cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS | Out-Host + + if ($options.i) { + $install_args = @($BUILD_DIR, '--config', $optimize_flag) + cmake --install $install_args | Out-Host + } } } else { diff --git a/build.ps1 b/build.ps1 index 6c88737..0236d2e 100644 --- a/build.ps1 +++ b/build.ps1 @@ -19,6 +19,10 @@ function mkdirs($path) { } } +function sremove($path) { + if (Test-Path $path) { Remove-Item $path -Recurse -Force } +} + # determine build lib list if (!$libs) { $libs = @( @@ -209,6 +213,9 @@ Foreach ($lib_name in $libs) { &$patch_script $lib_src } + $install_script = Join-Path $_1k_root "src/$lib_name/install1.ps1" + $has_custom_install = (Test-Path $install_script) + # build Push-Location $lib_src $install_dir = Join-Path $install_root $lib_name @@ -225,14 +232,19 @@ Foreach ($lib_name in $libs) { } $_config_options += "-DCMAKE_INSTALL_PREFIX=$install_dir" - - if ($compiler_dumped) { - &$1k_script -p $target_os -a $target_cpu -xc $_config_options -xb '--target', 'install' @forward_args + $evaluated_args = @() + if ($build_conf.cb_target) { + $evaluated_args += '-t', $build_conf.cb_target + } + if (!$has_custom_install) { + $evaluated_args += '-i' } - else { - &$1k_script -p $target_os -a $target_cpu -xc $_config_options -xb '--target', 'install' @forward_args -dm + if (!$compiler_dumped) { + $evaluated_args += '-dm' $compiler_dumped = $true } + + &$1k_script -p $target_os -a $target_cpu -xc $_config_options @forward_args @evaluated_args } elseif ($is_gn) { &$1k_script -p $target_os -a $target_cpu -xc $_config_options -xt 'gn' -t "$($build_conf.cb_target)" @forward_args @@ -248,8 +260,7 @@ Foreach ($lib_name in $libs) { Pop-Location # custom install step - $install_script = Join-Path $_1k_root "src/$lib_name/install1.ps1" - if (Test-Path $install_script) { + if ($has_custom_install) { &$install_script $install_dir $lib_src } # clean unnecessary files diff --git a/src/angle/install1.ps1 b/src/angle/install1.ps1 index 64fd0fc..6deb203 100644 --- a/src/angle/install1.ps1 +++ b/src/angle/install1.ps1 @@ -1,5 +1,5 @@ $install_dir = $args[0] -$buildsrc_dir = $args[1] +$libsrc_dir = $args[1] $buildout = Join-Path $Global:BUILD_DIR '/' @@ -14,7 +14,7 @@ if ($Global:is_win_family) { # copy includes $inst_inc_dir = Join-Path $install_dir 'include' mkdirs $inst_inc_dir - Copy-Item -Path $(Join-Path $buildsrc_dir 'include/*') -Destination $inst_inc_dir -Recurse -Force + Copy-Item -Path $(Join-Path $libsrc_dir 'include/*') -Destination $inst_inc_dir -Recurse -Force # copy .lib Copy-Item "${buildout}libGLESv2.dll.lib" "${inst_lib_dir}libGLESv2.dll.lib" -Force diff --git a/src/cares/clean1.ps1 b/src/cares/clean1.ps1 index a123062..75c43a2 100644 --- a/src/cares/clean1.ps1 +++ b/src/cares/clean1.ps1 @@ -3,9 +3,7 @@ $install_dir = $args[0] if ((Test-Path $install_dir -PathType Container)) { Write-Output "Cleaning ${install_dir}..." # Delete files what we don't want - Remove-Item "$install_dir/lib/cmake" -Recurse -Force - Remove-Item "$install_dir/lib/pkgconfig" -Recurse -Force - if (Test-Path "$install_dir/share" -PathType Container) { - Remove-Item "$install_dir/share" -Recurse -Force - } + sremove "$install_dir/lib/cmake" + sremove "$install_dir/lib/pkgconfig" + sremove "$install_dir/share" } diff --git a/src/curl/clean1.ps1 b/src/curl/clean1.ps1 index f0b9c0a..6552e0b 100644 --- a/src/curl/clean1.ps1 +++ b/src/curl/clean1.ps1 @@ -4,10 +4,10 @@ if ((Test-Path $install_dir -PathType Container)) { Write-Output "Cleaning ${install_dir}..." # Delete files what we don't want if($IsWindows) { - Remove-Item "$install_dir\bin\curl-config" + sremove "$install_dir\bin\curl-config" } else { - Remove-Item "$install_dir\bin" -Recurse -Force + sremove "$install_dir\bin" } - Remove-Item "$install_dir\lib\cmake" -Recurse -Force - Remove-Item "$install_dir\lib\pkgconfig" -Recurse -Force + sremove "$install_dir\lib\cmake" + sremove "$install_dir\lib\pkgconfig" } diff --git a/src/jpeg-turbo/clean1.ps1 b/src/jpeg-turbo/clean1.ps1 index 9e5f44a..ae7895f 100644 --- a/src/jpeg-turbo/clean1.ps1 +++ b/src/jpeg-turbo/clean1.ps1 @@ -4,8 +4,8 @@ if ((Test-Path $install_dir -PathType Container)) { Write-Output "Cleaning ${install_dir}..." # Delete files what we don't want # Remove-Item "$install_dir\bin" -recurse - Remove-Item "$install_dir\share" -recurse - Remove-Item "$install_dir\lib\cmake" -recurse - Remove-Item "$install_dir\lib\pkgconfig" -recurse + sremove "$install_dir\share" + sremove "$install_dir\lib\cmake" + sremove "$install_dir\lib\pkgconfig" ls -R "$install_dir" } diff --git a/src/llvm/build.yml b/src/llvm/build.yml index b2ead41..806f7d5 100644 --- a/src/llvm/build.yml +++ b/src/llvm/build.yml @@ -1,11 +1,11 @@ repo: https://github.com/llvm/llvm-project.git -ver: 16.0.6 +ver: 15.0.7 tag_prefix: llvmorg- tag_dot2ul: false cb_tool: cmake cb_target: libclang targets: win32,linux,osx archs: x64,arm64 -options: -S llvm -DLLVM_ENABLE_PROJECTS=clang +options: -S llvm -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_CXX_STANDARD=17 options_unix: -DCMAKE_BUILD_TYPE=Release -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=1 -options_msw: -Thost=x64 +options_msw: -Thost=x64 -DCMAKE_C_FLAGS=/source-charset:utf-8 -DCMAKE_CXX_FLAGS=/source-charset:utf-8 diff --git a/src/llvm/clean1.ps1 b/src/llvm/clean1.ps1 index e81069e..5c8b394 100644 --- a/src/llvm/clean1.ps1 +++ b/src/llvm/clean1.ps1 @@ -2,5 +2,9 @@ $install_dir = $args[0] if ((Test-Path $install_dir -PathType Container)) { echo "[windows] Cleaning ${install_dir}..." + sremove (Join-Path $install_dir 'include') + sremove (Join-Path $install_dir 'lib/*.lib') + sremove (Join-Path $install_dir 'lib/*.a') + sremove (Join-Path $install_dir 'bin/*.exe') ls -R "$install_dir" } diff --git a/src/llvm/install1.ps1 b/src/llvm/install1.ps1 new file mode 100644 index 0000000..81ed3a5 --- /dev/null +++ b/src/llvm/install1.ps1 @@ -0,0 +1,7 @@ +$install_dir = $args[0] +# $libsrc_dir = $args[1] + +$artifact_path = @('Release\bin\libclang.dll', 'lib\libclang.so', 'Release\lib\libclang.dylib')[$HOST_OS] +$install_dest = (Join-Path $install_dir (@('lib', 'bin')[$IsWin])) +mkdirs $install_dest +Copy-Item (Join-Path $BUILD_DIR "$artifact_path") $install_dest \ No newline at end of file diff --git a/src/luajit/install1.ps1 b/src/luajit/install1.ps1 index db8736f..853a604 100644 --- a/src/luajit/install1.ps1 +++ b/src/luajit/install1.ps1 @@ -1,5 +1,5 @@ $install_dir = $args[0] -$buildsrc_dir = $args[1] +$libsrc_dir = $args[1] if ($IsWindows) { # copy prebuilt luajit manually @@ -8,17 +8,17 @@ if ($IsWindows) { mkdir "$install_dir\bin" -Force mkdir "$install_dir\bin\jit" -Force - Copy-Item "$buildsrc_dir\src\lua51.lib" "$install_dir\lib\lua51.lib" -Force - Copy-Item "$buildsrc_dir\src\lua51.dll" "$install_dir\bin\lua51.dll" -Force - Copy-Item "$buildsrc_dir\src\luajit.exe" "$install_dir\bin\luajit.exe" -Force - Copy-Item -Path "$buildsrc_dir\src\jit\*.lua" -Destination "$install_dir\bin\jit" -Recurse -Force + Copy-Item "$libsrc_dir\src\lua51.lib" "$install_dir\lib\lua51.lib" -Force + Copy-Item "$libsrc_dir\src\lua51.dll" "$install_dir\bin\lua51.dll" -Force + Copy-Item "$libsrc_dir\src\luajit.exe" "$install_dir\bin\luajit.exe" -Force + Copy-Item -Path "$libsrc_dir\src\jit\*.lua" -Destination "$install_dir\bin\jit" -Recurse -Force - Copy-Item "$buildsrc_dir\src\lauxlib.h" "$install_dir\include\lauxlib.h" -Force - Copy-Item "$buildsrc_dir\src\lua.h" "$install_dir\include\lua.h" -Force - Copy-Item "$buildsrc_dir\src\lua.hpp" "$install_dir\include\lua.hpp" -Force - Copy-Item "$buildsrc_dir\src\luaconf.h" "$install_dir\include\luaconf.h" -Force - Copy-Item "$buildsrc_dir\src\luajit.h" "$install_dir\include\luajit.h" -Force - Copy-Item "$buildsrc_dir\src\lualib.h" "$install_dir\include\lualib.h" -Force + Copy-Item "$libsrc_dir\src\lauxlib.h" "$install_dir\include\lauxlib.h" -Force + Copy-Item "$libsrc_dir\src\lua.h" "$install_dir\include\lua.h" -Force + Copy-Item "$libsrc_dir\src\lua.hpp" "$install_dir\include\lua.hpp" -Force + Copy-Item "$libsrc_dir\src\luaconf.h" "$install_dir\include\luaconf.h" -Force + Copy-Item "$libsrc_dir\src\luajit.h" "$install_dir\include\luajit.h" -Force + Copy-Item "$libsrc_dir\src\lualib.h" "$install_dir\include\lualib.h" -Force echo "[windows] list ${install_dir}..." ls -R "$install_dir" @@ -27,14 +27,14 @@ if ($IsWindows) { mkdir "$install_dir/include" mkdir "$install_dir/lib" - cp "$buildsrc_dir/src/libluajit.a" "$install_dir/lib/libluajit.a" + cp "$libsrc_dir/src/libluajit.a" "$install_dir/lib/libluajit.a" - cp "$buildsrc_dir/src/lauxlib.h" "$install_dir/include/lauxlib.h" - cp "$buildsrc_dir/src/lua.h" "$install_dir/include/lua.h" - cp "$buildsrc_dir/src/lua.hpp" "$install_dir/include/lua.hpp" - cp "$buildsrc_dir/src/luaconf.h" "$install_dir/include/luaconf.h" - cp "$buildsrc_dir/src/luajit.h" "$install_dir/include/luajit.h" - cp "$buildsrc_dir/src/lualib.h" "$install_dir/include/lualib.h" + cp "$libsrc_dir/src/lauxlib.h" "$install_dir/include/lauxlib.h" + cp "$libsrc_dir/src/lua.h" "$install_dir/include/lua.h" + cp "$libsrc_dir/src/lua.hpp" "$install_dir/include/lua.hpp" + cp "$libsrc_dir/src/luaconf.h" "$install_dir/include/luaconf.h" + cp "$libsrc_dir/src/luajit.h" "$install_dir/include/luajit.h" + cp "$libsrc_dir/src/lualib.h" "$install_dir/include/lualib.h" echo "[unix] list ${install_dir}..." } diff --git a/src/zlib/clean1.ps1 b/src/zlib/clean1.ps1 index 7d25912..b115c9a 100644 --- a/src/zlib/clean1.ps1 +++ b/src/zlib/clean1.ps1 @@ -3,5 +3,5 @@ $install_dir = $args[0] if ((Test-Path $install_dir -PathType Container)) { Write-Output "Cleaning ${install_dir}..." # Delete files what we don't want - Remove-Item "$install_dir/share" -Recurse -Force + sremove "$install_dir/share" }