build scripts

This commit is contained in:
Timerix22 2023-12-22 22:43:08 +06:00
parent f27939ee67
commit 713784e783
4 changed files with 46 additions and 12 deletions

View File

@ -1,10 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RollForward>LatestMajor</RollForward>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="out\MainClass.cs" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyName>FusionCalculator</AssemblyName>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
</Project>

View File

@ -6,12 +6,25 @@ BIN_FILE="bin/FusionCalculator.exe"
SRC_FILES="$(find src/ -name '*.fu')"
WARNINGS="-Wall -Wno-unused-value -Wno-unused-function -Wno-unused-variable -Wno-discarded-qualifiers"
INCLUDES="$(pkg-config --cflags glib-2.0)"
COMPILER_ARGS="-O0 -g"
if [[ $1 == '--debug' ]]; then
COMPILER_ARGS="-O0 -g"
else
COMPILER_ARGS="-O2"
fi
LINKER_ARGS="$(pkg-config --libs glib-2.0) -lm"
rm -rf out bin
mkdir out bin
fut -l c -D C -o "$OUT_FILE" $SRC_FILES
args="-l c -D C -o "$OUT_FILE" $SRC_FILES"
echo "------------[fut]------------"
echo fut $args
fut $args
gcc $WARNINGS $COMPILER_ARGS "$OUT_FILE" -o "$BIN_FILE" $INCLUDES $LINKER_ARGS
if [[ $1 != '--translate-only' ]]; then
echo "------------[gcc]------------"
args="$WARNINGS $COMPILER_ARGS "$OUT_FILE" -o "$BIN_FILE" $INCLUDES $LINKER_ARGS"
echo gcc $args
gcc $args
fi

View File

@ -13,9 +13,13 @@ for src_file in $SRC_FILES; do
echo "---------[$src_file]---------"
out_file="out/$(basename $src_file .fu).cs"
args="-l cs -D CS -n FusionCalculator $INCLUDES -o $out_file $src_file"
echo "fu $args"
echo fut $args
fut $args
done
echo "---------[FusionCalculator.csproj]---------"
dotnet build FusionCalculator.csproj -o bin
if [[ $1 != '--translate-only' ]]; then
echo "---------[FusionCalculator.csproj]---------"
args="build -c Release FusionCalculator.exe.csproj -o bin"
echo dotnet $args
dotnet $args
fi