diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 922f9ef..78d1d19 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -59,3 +59,70 @@ jobs: draft: false files: | nasal-linux-x86_64.tar + + windows-x86_64-build-msvc: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Fetch Deps + run: | + choco install -y cmake + - name: Update Tag + run: | + git fetch --tags origin + git tag -f next_windows_x86_64_msvc + git push -f origin next_windows_x86_64_msvc + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + - name: Build + run: | + mkdir build + cd build + cmake .. -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022" + MSBuild.exe nasal.sln /p:Configuration=Release /p:Platform=x64 + - name: Package + run: | + python3 tools/msvc_move_file.py + python3 tools/pack.py msvc + - name: Release + uses: softprops/action-gh-release@v2.0.5 + with: + name: windows MSVC nightly build + tag_name: next_windows_x86_64_msvc + prerelease: true + draft: false + files: | + nasal-windows-x86_64-msvc.tar + + windows-x86_64-build-mingw: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Fetch Deps + run: | + choco install -y cmake + choco install -y mingw + - name: Update Tag + run: | + git fetch --tags origin + git tag -f next_windows_x86_64_mingw + git push -f origin next_windows_x86_64_mingw + - name: Build + run: | + mkdir build + cd build + cmake .. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ + mingw32-make.exe -j4 + - name: Package + run: | + python3 tools/mingw_move_file.py + python3 tools/pack.py mingw + - name: Release + uses: softprops/action-gh-release@v2.0.5 + with: + name: windows MSVC nightly build + tag_name: next_windows_x86_64_mingw + prerelease: true + draft: false + files: | + nasal-windows-x86_64-mingw.tar \ No newline at end of file diff --git a/src/repl/repl.cpp b/src/repl/repl.cpp index 53bf7a6..73cc73f 100644 --- a/src/repl/repl.cpp +++ b/src/repl/repl.cpp @@ -194,6 +194,9 @@ void repl::execute() { } // run program + if (source.back().back() != ';') { + source.back() += ";"; + } if (!run()) { source.pop_back(); } diff --git a/tools/mingw_move_file.py b/tools/mingw_move_file.py new file mode 100644 index 0000000..6cc5ef2 --- /dev/null +++ b/tools/mingw_move_file.py @@ -0,0 +1,13 @@ +import os +import shutil + +BUILD_DIR = "build" +if os.path.exists(f"{BUILD_DIR}\\nasal.exe"): + shutil.move(f"{BUILD_DIR}\\nasal.exe", ".\\nasal.exe") +if os.path.exists(f"{BUILD_DIR}\\nasal-format.exe"): + shutil.move(f"{BUILD_DIR}\\nasal-format.exe", ".\\nasal-format.exe") + +for root, dirs, files in os.walk(f"{BUILD_DIR}"): + for file in files: + if file.endswith(".dll"): + shutil.move(os.path.join(root, file), ".\\module\\" + file) \ No newline at end of file diff --git a/tools/msvc_move_file.py b/tools/msvc_move_file.py new file mode 100644 index 0000000..1be776a --- /dev/null +++ b/tools/msvc_move_file.py @@ -0,0 +1,13 @@ +import os +import shutil + +BUILD_DIR = "build" +if os.path.exists(f"{BUILD_DIR}\\Release\\nasal.exe"): + shutil.move(f"{BUILD_DIR}\\Release\\nasal.exe", ".\\nasal.exe") +if os.path.exists(f"{BUILD_DIR}\\Release\\nasal-format.exe"): + shutil.move(f"{BUILD_DIR}\\Release\\nasal-format.exe", ".\\nasal-format.exe") + +for root, dirs, files in os.walk(f"{BUILD_DIR}\\Release"): + for file in files: + if file.endswith(".dll"): + shutil.move(os.path.join(root, file), ".\\module\\lib" + file) \ No newline at end of file diff --git a/tools/pack.py b/tools/pack.py index 62bcd19..ebb7074 100644 --- a/tools/pack.py +++ b/tools/pack.py @@ -3,6 +3,7 @@ import pathlib import os import platform import shutil +import sys build_directory = pathlib.Path("build") if not os.path.exists(build_directory): @@ -10,7 +11,11 @@ if not os.path.exists(build_directory): exit(-1) nasal_executable = pathlib.Path("nasal") +if platform.system() == "Windows": + nasal_executable = pathlib.Path("nasal.exe") nasal_format_executable = pathlib.Path("nasal-format") +if platform.system() == "Windows": + nasal_format_executable = pathlib.Path("nasal-format.exe") nasal_standard_library = pathlib.Path("std") if not os.path.exists(nasal_executable): print("pack binaries failed: nasal executable not found") @@ -54,6 +59,10 @@ for m in ["libfib", "libkey", "libmat", "libnasock"]: tar_file_name = "nasal" if platform.system()=="Windows": tar_file_name += "-windows-x86_64" + if len(sys.argv) == 2 and sys.argv[1] == "msvc": + tar_file_name += "-msvc" + else: + tar_file_name += "-mingw" elif platform.system()=="Linux": tar_file_name += "-linux-x86_64" elif platform.system()=="Darwin":