diff --git a/FusionCalculator.csproj b/FusionCalculator.csproj index eddfd19..1d12d36 100644 --- a/FusionCalculator.csproj +++ b/FusionCalculator.csproj @@ -1,10 +1,15 @@ - - Exe - net8.0 - LatestMajor - false - + + Library + netstandard2.0 + latest + disable + disable + + + + + \ No newline at end of file diff --git a/FusionCalculator.exe.csproj b/FusionCalculator.exe.csproj new file mode 100644 index 0000000..2ffecb1 --- /dev/null +++ b/FusionCalculator.exe.csproj @@ -0,0 +1,12 @@ + + + + Exe + FusionCalculator + net8.0 + latest + disable + disable + + + \ No newline at end of file diff --git a/build_c.sh b/build_c.sh index d0ae125..79a1aa4 100644 --- a/build_c.sh +++ b/build_c.sh @@ -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 diff --git a/build_cs.sh b/build_cs.sh index b1bab72..ecdaa4e 100644 --- a/build_cs.sh +++ b/build_cs.sh @@ -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