Skip to content

Commit

Permalink
Add Build Samples Scripts (#291)
Browse files Browse the repository at this point in the history
* Add build samples script
  • Loading branch information
mwasplund authored Jan 8, 2025
1 parent 972e367 commit 20a517d
Show file tree
Hide file tree
Showing 13 changed files with 201 additions and 33 deletions.
42 changes: 22 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
run: soup build ./soup/samples/c++/windows-application/ -flavor ${{matrix.config}}
4 changes: 2 additions & 2 deletions samples/c++/module-dynamic-library/application/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <iostream>

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;
}
}
4 changes: 2 additions & 2 deletions samples/c++/module-dynamic-library/library/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module;
// Include all standard library headers in the global module
#include <string>

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
Expand All @@ -19,4 +19,4 @@ export namespace Samples::Cpp::DynamicLibrary::Library
return "Soup";
}
};
}
}
2 changes: 1 addition & 1 deletion scripts/linux/bootstrap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
echo "Linux Build Bootstrap!"
echo "Bootstrap!"

# Stop on first error
set -e
Expand Down
2 changes: 1 addition & 1 deletion scripts/linux/build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
echo "Linux Build: $1"
echo "Build: $1"

# Stop on first error
set -e
Expand Down
2 changes: 1 addition & 1 deletion scripts/linux/build-client
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
echo "Linux Build Client: $1"
echo "Build Client: $1"

# Stop on first error
set -e
Expand Down
2 changes: 1 addition & 1 deletion scripts/linux/build-packagemanager
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
echo "Linux Build PackageManager!"
echo "Build PackageManager!"

# Stop on first error
set -e
Expand Down
74 changes: 74 additions & 0 deletions scripts/linux/build-samples
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion scripts/linux/build-swhere
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
echo "Linux Build SWhere!"
echo "Build SWhere!"

# Stop on first error
set -e
Expand Down
2 changes: 1 addition & 1 deletion scripts/linux/build-tools
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
echo "Linux Build SoupView!"
echo "Build SoupView!"

# Stop on first error
set -e
Expand Down
2 changes: 1 addition & 1 deletion scripts/linux/build-view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
echo "Linux Build SoupView!"
echo "Build SoupView!"

# Stop on first error
set -e
Expand Down
6 changes: 4 additions & 2 deletions scripts/linux/release
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
# 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 .
90 changes: 90 additions & 0 deletions scripts/windows/build-samples.cmd
Original file line number Diff line number Diff line change
@@ -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%

0 comments on commit 20a517d

Please sign in to comment.