From 20a517dabe1b3fbb6f44c6cb3b5cae529c333745 Mon Sep 17 00:00:00 2001 From: Matthew Asplund Date: Wed, 8 Jan 2025 12:30:35 -0600 Subject: [PATCH] Add Build Samples Scripts (#291) * Add build samples script --- .github/workflows/main.yml | 42 ++++----- .../application/Main.cpp | 4 +- .../module-dynamic-library/library/Module.cpp | 4 +- scripts/linux/bootstrap | 2 +- scripts/linux/build | 2 +- scripts/linux/build-client | 2 +- scripts/linux/build-packagemanager | 2 +- scripts/linux/build-samples | 74 +++++++++++++++ scripts/linux/build-swhere | 2 +- scripts/linux/build-tools | 2 +- scripts/linux/build-view | 2 +- scripts/linux/release | 6 +- scripts/windows/build-samples.cmd | 90 +++++++++++++++++++ 13 files changed, 201 insertions(+), 33 deletions(-) create mode 100755 scripts/linux/build-samples create mode 100644 scripts/windows/build-samples.cmd diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4b3a4a3e..83e1186c2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,34 +94,36 @@ jobs: if: matrix.os == 'windows-2022' run: soup build ./soup/samples/c/windows-application/ -flavor ${{matrix.config}} - - name: Soup Restore Cpp BuildExtension + - name: Soup Restore C# BuildExtension + run: soup restore ./soup/samples/c#/build-extension/executable/ + - name: Soup Build C# BuildExtension + run: soup build ./soup/samples/c#/build-extension/executable/ -flavor ${{matrix.config}} + - name: Soup Build C# ConsoleApplication + run: soup build ./soup/samples/c#/console-application/ -flavor ${{matrix.config}} + - name: Soup Build C# Library + run: soup build ./soup/samples/c#/library/application/ -flavor ${{matrix.config}} + + - name: Soup Restore C++ BuildExtension run: soup restore ./soup/samples/c++/build-extension/executable/ - - name: Soup Build Cpp BuildExtension + - name: Soup Build C++ BuildExtension run: soup build ./soup/samples/c++/build-extension/executable/ -flavor ${{matrix.config}} - - name: Soup Build Cpp ConsoleApplication + - name: Soup Build C++ ConsoleApplication run: soup build ./soup/samples/c++/console-application/ -flavor ${{matrix.config}} - - name: Soup Build Cpp DirectX + - name: Soup Build C++ DirectX if: matrix.os == 'windows-2022' run: soup build ./soup/samples/c++/directx/ -flavor ${{matrix.config}} - - name: Soup Build Cpp DynamicLibrary + - name: Soup Build C++ DynamicLibrary run: soup build ./soup/samples/c++/dynamic-library/application/ -flavor ${{matrix.config}} - - name: Soup Build Cpp ModuleInterface + - name: Soup Build C++ ModuleDynamicLibrary + run: soup build ./soup/samples/c++/module-dynamic-library/application/ -flavor ${{matrix.config}} + - name: Soup Build C++ ModuleInterface run: soup build ./soup/samples/c++/module-interface/ -flavor ${{matrix.config}} - - name: Soup Restore Cpp ParseJson + - name: Soup Restore C++ ParseJson run: soup restore ./soup/samples/c++/parse-json/ - - name: Soup Build Cpp ParseJson + - name: Soup Build C++ ParseJson run: soup build ./soup/samples/c++/parse-json/ -flavor ${{matrix.config}} - - name: Soup Build Cpp StaticLibrary + - name: Soup Build C++ StaticLibrary run: soup build ./soup/samples/c++/static-library/application/ -flavor ${{matrix.config}} - - name: Soup Build Cpp WindowsApplication + - name: Soup Build C++ WindowsApplication if: matrix.os == 'windows-2022' - run: soup build ./soup/samples/c++/windows-application/ -flavor ${{matrix.config}} - - - name: Soup Restore CSharp BuildExtension - run: soup restore ./soup/samples/c#/build-extension/executable/ - - name: Soup Build CSharp BuildExtension - run: soup build ./soup/samples/c#/build-extension/executable/ -flavor ${{matrix.config}} - - name: Soup Build CSharp ConsoleApplication - run: soup build ./soup/samples/c#/console-application/ -flavor ${{matrix.config}} - - name: Soup Build CSharp Library - run: soup build ./soup/samples/c#/library/application/ -flavor ${{matrix.config}} \ No newline at end of file + run: soup build ./soup/samples/c++/windows-application/ -flavor ${{matrix.config}} \ No newline at end of file diff --git a/samples/c++/module-dynamic-library/application/Main.cpp b/samples/c++/module-dynamic-library/application/Main.cpp index 7c5ed374a..8f5702c21 100644 --- a/samples/c++/module-dynamic-library/application/Main.cpp +++ b/samples/c++/module-dynamic-library/application/Main.cpp @@ -1,10 +1,10 @@ #include -import Samples.Cpp.DynamicLibrary.Library; +import Samples.Cpp.ModuleDynamicLibrary.Library; using namespace Samples::Cpp::DynamicLibrary::Library; int main() { std::cout << "Hello World, " << Helper::GetName() << " Style!" << std::endl; return 0; -} +} \ No newline at end of file diff --git a/samples/c++/module-dynamic-library/library/Module.cpp b/samples/c++/module-dynamic-library/library/Module.cpp index 5423a0476..fff6505f3 100644 --- a/samples/c++/module-dynamic-library/library/Module.cpp +++ b/samples/c++/module-dynamic-library/library/Module.cpp @@ -3,7 +3,7 @@ module; // Include all standard library headers in the global module #include -export module Samples.Cpp.DynamicLibrary.Library; +export module Samples.Cpp.ModuleDynamicLibrary.Library; // Note: The namespace does not have to match the module name export namespace Samples::Cpp::DynamicLibrary::Library @@ -19,4 +19,4 @@ export namespace Samples::Cpp::DynamicLibrary::Library return "Soup"; } }; -} +} \ No newline at end of file diff --git a/scripts/linux/bootstrap b/scripts/linux/bootstrap index 32e2debea..08541a464 100755 --- a/scripts/linux/bootstrap +++ b/scripts/linux/bootstrap @@ -1,5 +1,5 @@ #!/bin/bash -echo "Linux Build Bootstrap!" +echo "Bootstrap!" # Stop on first error set -e diff --git a/scripts/linux/build b/scripts/linux/build index 7e94bd09a..eb14befb0 100755 --- a/scripts/linux/build +++ b/scripts/linux/build @@ -1,5 +1,5 @@ #!/bin/bash -echo "Linux Build: $1" +echo "Build: $1" # Stop on first error set -e diff --git a/scripts/linux/build-client b/scripts/linux/build-client index f769b09ec..a43dd4b09 100755 --- a/scripts/linux/build-client +++ b/scripts/linux/build-client @@ -1,5 +1,5 @@ #!/bin/bash -echo "Linux Build Client: $1" +echo "Build Client: $1" # Stop on first error set -e diff --git a/scripts/linux/build-packagemanager b/scripts/linux/build-packagemanager index 23c84beaf..d9f7d185b 100755 --- a/scripts/linux/build-packagemanager +++ b/scripts/linux/build-packagemanager @@ -1,5 +1,5 @@ #!/bin/bash -echo "Linux Build PackageManager!" +echo "Build PackageManager!" # Stop on first error set -e diff --git a/scripts/linux/build-samples b/scripts/linux/build-samples new file mode 100755 index 000000000..5e11a804d --- /dev/null +++ b/scripts/linux/build-samples @@ -0,0 +1,74 @@ +#!/bin/bash +echo "Build Samples: $1" + +# Stop on first error +set -e + +FLAVOR="$1" +SCRIPTS_DIR=$(dirname "$0") + +ROOT_DIR=$SCRIPTS_DIR/../.. +SAMPLES_DIR=$ROOT_DIR/samples + +######################################## +## C Samples +######################################## + +echo soup build $SAMPLES_DIR/c/build-extension/executable/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c/build-extension/executable/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c/console-application/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c/console-application/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c/dynamic-library/application/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c/dynamic-library/application/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c/static-library/application/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c/static-library/application/ -flavor $FLAVOR + +echo SKIP: soup build $SAMPLES_DIR/c/windows-application/ -flavor $FLAVOR + +######################################## +## C# Samples +######################################## + +echo soup build $SAMPLES_DIR/c#/build-extension/executable/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c#/build-extension/executable/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c#/console-application/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c#/console-application/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c#/library/application/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c#/library/application/ -flavor $FLAVOR + +######################################## +## C++ Samples +######################################## + +echo soup build $SAMPLES_DIR/c++/build-extension/executable/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c++/build-extension/executable/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c++/console-application/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c++/console-application/ -flavor $FLAVOR + +echo SKIP: soup build $SAMPLES_DIR/c++/directx/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c++/dynamic-library/application/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c++/dynamic-library/application/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c++/header-library/application/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c++/header-library/application/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c++/module-dynamic-library/application/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c++/module-dynamic-library/application/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c++/module-interface/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c++/module-interface/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c++/parse-json/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c++/parse-json/ -flavor $FLAVOR + +echo soup build $SAMPLES_DIR/c++/static-library/application/ -flavor $FLAVOR +eval soup build $SAMPLES_DIR/c++/static-library/application/ -flavor $FLAVOR + +echo SKIP: soup build $SAMPLES_DIR/c++/windows-application/ -flavor $FLAVOR \ No newline at end of file diff --git a/scripts/linux/build-swhere b/scripts/linux/build-swhere index bd46105b3..6fafc1d7c 100755 --- a/scripts/linux/build-swhere +++ b/scripts/linux/build-swhere @@ -1,5 +1,5 @@ #!/bin/bash -echo "Linux Build SWhere!" +echo "Build SWhere!" # Stop on first error set -e diff --git a/scripts/linux/build-tools b/scripts/linux/build-tools index 797352983..d254dde57 100755 --- a/scripts/linux/build-tools +++ b/scripts/linux/build-tools @@ -1,5 +1,5 @@ #!/bin/bash -echo "Linux Build SoupView!" +echo "Build SoupView!" # Stop on first error set -e diff --git a/scripts/linux/build-view b/scripts/linux/build-view index c02c017fc..feb9de4f4 100755 --- a/scripts/linux/build-view +++ b/scripts/linux/build-view @@ -1,5 +1,5 @@ #!/bin/bash -echo "Linux Build SoupView!" +echo "Build SoupView!" # Stop on first error set -e diff --git a/scripts/linux/release b/scripts/linux/release index adddbfd4b..a024154fe 100755 --- a/scripts/linux/release +++ b/scripts/linux/release @@ -7,6 +7,8 @@ SCRIPTS_DIR=$(dirname "$0") ROOT_DIR=$SCRIPTS_DIR/../.. OUT_DIR=$ROOT_DIR/out RUN_DIR=$OUT_DIR/run +RELEASE_DIR=$OUT_DIR/release -# Cleanup previous runs -tar -a -cf $OUT_DIR/soup-build-0.41.3-linux-x64.tar.gz -C $RUN_DIR . \ No newline at end of file +# Pack the release tarbal +mkdir -p $RELEASE_DIR +tar -a -cf $RELEASE_DIR/soup-build-0.41.3-linux-x64.tar.gz -C $RUN_DIR . \ No newline at end of file diff --git a/scripts/windows/build-samples.cmd b/scripts/windows/build-samples.cmd new file mode 100644 index 000000000..cf6508db0 --- /dev/null +++ b/scripts/windows/build-samples.cmd @@ -0,0 +1,90 @@ +@echo off +SETLOCAL +SET Flavor=%1 +SET ScriptsDir=%~dp0 +SET RootDir=%ScriptsDir%../.. +SET SamplesDir=%RootDir%/samples + +REM - ######################################## +REM - ## C Samples +REM - ######################################## + +echo soup build %SamplesDir%/c/build-extension/executable/ -flavor %Flavor% +call soup build %SamplesDir%/c/build-extension/executable/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c/console-application/ -flavor %Flavor% +call soup build %SamplesDir%/c/console-application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c/dynamic-library/application/ -flavor %Flavor% +call soup build %SamplesDir%/c/dynamic-library/application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c/static-library/application/ -flavor %Flavor% +call soup build %SamplesDir%/c/static-library/application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c/windows-application/ -flavor %Flavor% +call soup build %SamplesDir%/c/windows-application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +REM - ######################################## +REM - ## C# Samples +REM - ######################################## + +echo soup build %SamplesDir%/c#/build-extension/executable/ -flavor %Flavor% +call soup build %SamplesDir%/c#/build-extension/executable/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c#/console-application/ -flavor %Flavor% +call soup build %SamplesDir%/c#/console-application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c#/library/application/ -flavor %Flavor% +call soup build %SamplesDir%/c#/library/application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +REM - ######################################## +REM - ## C++ Samples +REM - ######################################## + +echo soup build %SamplesDir%/c++/build-extension/executable/ -flavor %Flavor% +call soup build %SamplesDir%/c++/build-extension/executable/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c++/console-application/ -flavor %Flavor% +call soup build %SamplesDir%/c++/console-application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c++/directx/ -flavor %Flavor% +call soup build %SamplesDir%/c++/directx/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c++/dynamic-library/application/ -flavor %Flavor% +call soup build %SamplesDir%/c++/dynamic-library/application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c++/header-library/application/ -flavor %Flavor% +call soup build %SamplesDir%/c++/header-library/application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c++/module-dynamic-library/application/ -flavor %Flavor% +call soup build %SamplesDir%/c++/module-dynamic-library/application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c++/module-interface/ -flavor %Flavor% +call soup build %SamplesDir%/c++/module-interface/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c++/parse-json/ -flavor %Flavor% +call soup build %SamplesDir%/c++/parse-json/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c++/static-library/application/ -flavor %Flavor% +call soup build %SamplesDir%/c++/static-library/application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% + +echo soup build %SamplesDir%/c++/windows-application/ -flavor %Flavor% +call soup build %SamplesDir%/c++/windows-application/ -flavor %Flavor% +if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% \ No newline at end of file