Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Universal CRT for Windows 10 or later #29

Merged
merged 3 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Create Release Draft
id: create-release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.check-tag.outputs.tag }}
name: ${{ steps.check-tag.outputs.tag }}
Expand Down Expand Up @@ -64,6 +64,11 @@ jobs:
zip_ext: zip
arch: ARM
arch_suffix: -arm64
- os: windows-2022
exe_ext: .exe
zip_ext: zip
arch: UCRT
arch_suffix: -x64-ucrt
- os: ubuntu-20.04
exe_ext: ""
zip_ext: tar.bz2
Expand Down Expand Up @@ -105,7 +110,6 @@ jobs:
- name: Build exe for Windows
if: runner.os == 'Windows'
run: batch_files/build.bat Release ${{ matrix.arch }}

- name: Build exe for Unix
if: runner.os != 'Windows'
run: bash shell_scripts/build.sh Release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
shell: bash

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: tests-windows-arm64
path: workspace
Expand All @@ -147,7 +147,7 @@ jobs:
needs: [lint, build_tests_windows_arm64]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: tests-windows-arm64
path: workspace
Expand Down
6 changes: 5 additions & 1 deletion batch_files/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ if /I "%~2"=="ARM" (
)
)

if /I "%~2"=="UCRT" (
set OPT="-Duse_ucrt=true"
)

echo Build type: %BUILD_TYPE%

@pushd %~dp0\..
meson setup build\%BUILD_TYPE%%~2 --backend=vs %PRESET%
meson setup build\%BUILD_TYPE%%~2 --backend=vs %PRESET% %OPT%
if %ERRORLEVEL% neq 0 goto :buildend
cd build\%BUILD_TYPE%%~2
meson compile -v
Expand Down
6 changes: 6 additions & 0 deletions batch_files/build_with_ucrt.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
REM Build with Universal CRT.
REM This option makes exe much smaller. But the built binary only supports Windows10 or later.

@pushd %~dp0
build.bat Release UCRT
popd
2 changes: 2 additions & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ver 0.6.4
- Added Universal CRT version for Windows 10 or later
- Fixed a bug that the execution button still says "processing" after getting errors.

ver 0.6.3
Expand Down
4 changes: 2 additions & 2 deletions include/tuw_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace tuw_constants {
" CLI tools\n";
constexpr char TOOL_NAME[] = "Tuw";
constexpr char AUTHOR[] = "matyalatte";
constexpr char VERSION[] = "0.6.3";
constexpr int VERSION_INT = 603;
constexpr char VERSION[] = "0.6.4";
constexpr int VERSION_INT = 604;

#ifdef _WIN32
constexpr char OS[] = "win";
Expand Down
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ if tuw_OS == 'windows'
'/INCREMENTAL:NO',
'/ENTRY:wmainCRTStartup'
]
if get_option('use_ucrt')
# These linker options make exe much smaller with UCRT,
# but the built binary only supports Windows10 or later.
tuw_link_args += ['/NODEFAULTLIB:libucrt.lib', '/DEFAULTLIB:ucrt.lib']
endif
if meson.version().version_compare('<1.4.0')
tuw_link_args += ['/MANIFEST:NO']
endif
Expand Down
2 changes: 2 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ option('build_exe', type : 'boolean', value : true, description : 'Build executa
option('build_test', type : 'boolean', value : false, description : 'Build tests')
option('macosx_version_min', type : 'string', value : '10.9',
description : 'Deployment target for macOS. This will affect to subprojects')
option('use_ucrt', type : 'boolean', value : false,
description : 'Use Universal CRT for Windows 10 or later')