1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

ci: add tcc32 CI on windows (#8922)

This commit is contained in:
Ruofan XU 2021-02-25 19:52:12 +08:00 committed by GitHub
parent c762d150c6
commit 1a8e502e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 61 additions and 15 deletions

View File

@ -725,7 +725,7 @@ jobs:
- name: v2 self compilation
run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
windows-tcc:
windows-tcc64:
runs-on: windows-2019
timeout-minutes: 30
env:
@ -767,6 +767,48 @@ jobs:
- name: v2 self compilation
run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
windows-tcc32:
runs-on: windows-2019
timeout-minutes: 30
env:
VFLAGS: -cc tcc -no-retry-compilation
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Build with make.bat -tcc32
run: |
.\make.bat -tcc32
- name: Test new v.c
run: .\v.exe -o v.c cmd/v && .\thirdparty\tcc\tcc.exe -Werror -w -ladvapi32 -bt10 v.c
- name: Install dependencies
run: |
.\v.exe setup-freetype
.\.github\workflows\windows-install-sqlite.bat
## .\.github\workflows\windows-install-sdl.bat
- name: v doctor
run: |
./v doctor
- name: Verify `v test` works
run: |
.\v.exe cmd/tools/test_if_v_test_system_works.v
.\cmd\tools\test_if_v_test_system_works.exe
- name: Self tests
run: |
.\v.exe -silent test-self
# - name: Test
# run: |
# .\v.exe -silent test-all
- name: Test v->js
run: ./v -o hi.js examples/hello_v_js.v && node hi.js
- name: Test v binaries
run: ./v build-vbinaries
- name: Build examples
run: ./v build-examples
- name: v2 self compilation
run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
compilable-v-c-and-v-win-c:
runs-on: ubuntu-20.04
timeout-minutes: 30

View File

@ -43,7 +43,9 @@ if !shift_counter! LSS 1 (
)
REM Compiler option
for %%g in (-gcc -msvc -tcc -clang) do (
for %%g in (-gcc -msvc -tcc -tcc32 -clang) do (
if "%PROCESSOR_ARCHITECTURE%" == "x86" set "tcc_branch=thirdparty-windows-i386"
if "%~1" == "-tcc32" set "tcc_branch=thirdparty-windows-i386"
if "%~1" == "%%g" set compiler=%~1& set compiler=!compiler:~1!& shift& set /a shift_counter+=1& goto :verifyopt
)
@ -282,6 +284,7 @@ if %ERRORLEVEL% NEQ 0 goto :compile_error
goto :success
:tcc_strap
:tcc32_strap
if [!compiler!] == [] set /a invalid_cc=1
echo ^> Attempting to build v_win.c with TCC
if !flag_verbose! EQU 1 (
@ -362,18 +365,19 @@ echo Usage:
echo make.bat [target] [compiler] [options]
echo.
echo Compiler:
echo -msvc ^| -gcc ^| -tcc ^| -clang Set C compiler
echo -msvc ^| -gcc ^| -tcc ^| -tcc32 ^| -clang Set C compiler
echo.
echo Target:
echo build[default] Compiles V using the given C compiler
echo clean Clean build artifacts and debugging symbols
echo clean-all Cleanup entire ALL build artifacts and vc repository
echo help Display usage help for the given target
echo build[default] Compiles V using the given C compiler
echo clean Clean build artifacts and debugging symbols
echo clean-all Cleanup entire ALL build artifacts and vc repository
echo help Display usage help for the given target
echo.
echo Examples:
echo make.bat -msvc
echo make.bat -gcc --local --logpath output.log
echo make.bat build -fresh-tcc --local
echo make.bat build -tcc --local
echo make.bat -tcc32
echo make.bat help clean
echo.
echo Use "make help <target>" for more information about a target, for instance: "make help clean"
@ -412,7 +416,7 @@ echo Usage:
echo make.bat build [compiler] [options]
echo.
echo Compiler:
echo -msvc ^| -gcc ^| -[fresh-]tcc ^| -clang Set C compiler
echo -msvc ^| -gcc ^| -tcc ^| -tcc32 ^| -clang Set C compiler
echo.
echo Options:
echo --local Use the local vc repository without

View File

@ -191,10 +191,10 @@ fn test_vec4() {
assert v + m4.Vec4{ e: [f32(5), 6, 7, 8]! } == m4.Vec4{ e: [f32(6), 8, 10, 12]! }
assert v - m4.Vec4{ e: [f32(1), 2, 3, 4]! } == m4.Vec4{ e: [f32(0), 0, 0, 0]! }
assert v.mul_vec4(m4.Vec4{ e: [f32(2), 2, 2, 2]! }) == m4.Vec4{ e: [f32(2), 4, 6, 8]! }
assert v.normalize().mod() == 1
assert m4.abs(v.normalize().mod() - 1) < m4.precision
v = m4.Vec4{[f32(1), 2, 3, 0]!}
assert v.normalize3().mod3() - 1 < m4.precision
assert v.normalize3().mod() - 1 < m4.precision
assert m4.abs(v.normalize3().mod3() - 1) < m4.precision
assert m4.abs(v.normalize3().mod() - 1) < m4.precision
// x y z
// 1 2 3 ==> -3 6 -3 0
// 4 5 6

View File

@ -27,7 +27,7 @@ pub const precision = f32(10e-7)
* Utility
*
*********************************************************************/
fn abs(a f32) f32 {
pub fn abs(a f32) f32 {
if a >= f32(0.0) {
return a
} else {

View File

@ -366,7 +366,7 @@ pub fn (mut ch Channel) try_pop(dest voidptr) ChanState {
}
fn (mut ch Channel) try_pop_priv(dest voidptr, no_block bool) ChanState {
spinloops_sem_, spinloops_ := if no_block { 1, 1 } else { spinloops, spinloops_sem }
spinloops_sem_, spinloops_ := if no_block { 1, 1 } else { spinloops, spinloops_sem }
mut have_swapped := false
mut write_in_progress := false
for {

View File

@ -35,7 +35,7 @@ fn (mut g Gen) profile_fn(fn_decl ast.FnDecl) {
pub fn (mut g Gen) gen_vprint_profile_stats() {
g.pcs_declarations.writeln('void vprint_profile_stats(){')
fstring := '"%14lu %14.3fms %14.0fns %s \\n"'
fstring := '"%14llu %14.3fms %14.0fns %s \\n"'
if g.pref.profile_file == '-' {
for pc_meta in g.pcs {
g.pcs_declarations.writeln('\tif ($pc_meta.vpc_calls) printf($fstring, $pc_meta.vpc_calls, $pc_meta.vpc_name/1000000.0, $pc_meta.vpc_name/$pc_meta.vpc_calls, "$pc_meta.fn_name" );')