From c1582bc4be9cd4da9958d20e6ce8f5bf1b17f0ea Mon Sep 17 00:00:00 2001 From: flysand7 Date: Sun, 25 Jun 2023 03:24:55 +1100 Subject: [PATCH] Change scripts to powershell --- .gitignore | 1 + build.cmd | 13 ------------- build.ps1 | 13 +++++++++++++ test.bat | 5 ----- test.ps1 | 19 +++++++++++++++++++ {test => tests}/crt.c | 0 {test => tests}/windows_utf8.c | 0 {test => tests}/winmain.c | 0 8 files changed, 33 insertions(+), 18 deletions(-) delete mode 100644 build.cmd create mode 100644 build.ps1 delete mode 100644 test.bat create mode 100644 test.ps1 rename {test => tests}/crt.c (100%) rename {test => tests}/windows_utf8.c (100%) rename {test => tests}/winmain.c (100%) diff --git a/.gitignore b/.gitignore index 2145860..b1a0cf4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ a.out *.o *.4coder *.rdbg +test/ test_folder/ \ No newline at end of file diff --git a/build.cmd b/build.cmd deleted file mode 100644 index 30dccb8..0000000 --- a/build.cmd +++ /dev/null @@ -1,13 +0,0 @@ - -:: Compile UTF-8 resource into .obj file -:: this .obj file has to be linked to the executable using it, NOT archived -:: together with ciabatta.lib. -windres -o utf8.obj utf8.rc - -:: Compile chkstk -nasm src\os_win\chkstk.asm -ochkstk.o -fwin64 - -:: Compile the rest of the party -clang -Wall src\ciabatta.c -o ciabatta.obj -c -DCIABATTA_WIN -I src -I include -nodefaultlibs -g -mfma -rem cuik src\ciabatta.c -o ciabatta.obj -c -DCIABATTA_WIN -I src -I inc -nostdlib -lib /nologo /out:ciabatta.lib chkstk.o utf8.obj ciabatta.obj diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..e6dc962 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,13 @@ + +# Generate the resources for UTF8 +windres -o utf8.obj utf8.rc + +# Compile chkstk +nasm src\os_win\chkstk.asm -o chkstk.o -fwin64 + +# Compile the rest of the party +clang -Wall src\ciabatta.c -o ciabatta.obj -c -DCIABATTA_WIN -I src -I include -nodefaultlibs -g -mfma +# rem cuik src\ciabatta.c -o ciabatta.obj -c -DCIABATTA_WIN -I src -I inc -nostdlib + +# Package up the .lib file +lib /nologo /out:ciabatta.lib chkstk.o utf8.obj ciabatta.obj diff --git a/test.bat b/test.bat deleted file mode 100644 index 0f9abcc..0000000 --- a/test.bat +++ /dev/null @@ -1,5 +0,0 @@ - -clang -g test\%1.c -I include utf8.obj -nostdlib -mfma -lciabatta.lib -if %errorlevel%==0 ( - "./a.exe" -) diff --git a/test.ps1 b/test.ps1 new file mode 100644 index 0000000..a296472 --- /dev/null +++ b/test.ps1 @@ -0,0 +1,19 @@ + + +$FILENAME = $("tests/" + $args + ".c") + +if(-not $(Test-Path -Path test_folder)) { + New-Item -ItemType Directory test_folder +} + +if(-not $(Test-Path -Path test)) { + New-Item -ItemType Directory test +} + +# Compile the test suite +clang -g $FILENAME -I include utf8.obj -nostdlib -mfma -l ciabatta.lib + +# If succeeded run the test suite +if($?) { + ./a.exe +} diff --git a/test/crt.c b/tests/crt.c similarity index 100% rename from test/crt.c rename to tests/crt.c diff --git a/test/windows_utf8.c b/tests/windows_utf8.c similarity index 100% rename from test/windows_utf8.c rename to tests/windows_utf8.c diff --git a/test/winmain.c b/tests/winmain.c similarity index 100% rename from test/winmain.c rename to tests/winmain.c