diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index 02100ab94..f664d306c 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -25,23 +25,30 @@ jobs: submodules: recursive - name: Install Dependencies + shell: powershell run: | nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake nuget install Bison -Version 3.7.4 -OutputDirectory C:\Tools\bison nuget install PCRE2 -Version 10.39 -OutputDirectory C:\Tools\pcre2 - name: Build - shell: cmd + shell: powershell run: | - SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;%PATH% - SET PCRE_ROOT=C:\Tools\pcre2\PCRE2.10.39.0 - SET PCRE_PLATFORM=x64 - cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="%CD:\=/%/install2" -DCMAKE_C_FLAGS="/DPCRE2_STATIC" ^ - -DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" -DPCRE2_INCLUDE_DIR=%PCRE_ROOT%/include -DPCRE2_LIBRARY=%PCRE_ROOT%/lib/pcre2-8-static.lib -S . -B build + $env:PATH="C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;" + $env:PATH + $PCRE_ROOT="C:\Tools\pcre2\PCRE2.10.39.0" + $PCRE_PLATFORM="x64" + $WORKING_DIR=(Get-Location).ToString() -replace "\\","/" + cmake -G "Visual Studio 16 2019" -A "x64" ` + -DCMAKE_INSTALL_PREFIX="$WORKING_DIR/install2" ` + -DCMAKE_C_FLAGS="/DPCRE2_STATIC" ` + -DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" ` + -DPCRE2_INCLUDE_DIR="$PCRE_ROOT/include" ` + -DPCRE2_LIBRARY="$PCRE_ROOT/lib/pcre2-8-static.lib" ` + -S . -B build cmake --build build --config Release --target install - name: Test - shell: cmd + shell: powershell working-directory: install2/bin run: | swig.exe -version diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html index 106319687..96518c464 100644 --- a/Doc/Manual/Windows.html +++ b/Doc/Manual/Windows.html @@ -230,7 +230,7 @@ SWIG can also be compiled and run using MSYS2 SWIG can be built using CMake and Visual Studio rather than autotools. As with the other approaches to building SWIG the dependencies need to be installed. The steps below are one of a number of ways of installing the dependencies without requiring Cygwin or MinGW. -For fully working build steps always check the Continuous Integration (CI) setups currently detailed in the Appveyor YAML file. +For fully working build steps always check the Continuous Integration (CI) setups currently detailed in the GitHub Actions YAML file.

    @@ -240,6 +240,7 @@ For fully working build steps always check the Continuous Integration (CI) setup
  1. Install CMake-win64 Nuget package using the following command:
    C:\Tools\nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake
    + Using PowerShell the equivalent syntax is:
    &"C:\Tools\nuget" install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake
    Alternatively you can download CMake from https://cmake.org/download/.
  2. @@ -248,18 +249,18 @@ For fully working build steps always check the Continuous Integration (CI) setup and save to a folder e.g. C:\Tools\Bison
  3. - Install the PCRE2 Nuget package using the following command:
    C:\Tools\nuget install PCRE2 -Version 10.39 -OutputDirectory C:\Tools\pcre2
    . + Install the PCRE2 Nuget package using the following command:
    C:\Tools\nuget install PCRE2 -Version 10.39 -OutputDirectory C:\Tools\pcre2
    Note this is a x64 build, if this is not suitable PCRE2 can be built from source using https://github.com/PhilipHazel/pcre2/. Alternatively, set WITH_PCRE=OFF to disable PCRE2 support if you are sure you do not require it.
  4. We will also need the SWIG source code. Either download a zipped archive from GitHub, or if git is installed clone the latest codebase - using
    git clone https://github.com/swig/swig.git
    + using:
    git clone https://github.com/swig/swig.git
    In this example we are assuming the source code is available at C:\swig
  5. - Now we have all the required dependencies we can build SWIG using the commands below. We are assuming Visual Studio 2019 is installed. For other versions of Visual Studio change "Visual Studio 16 2019 -A x64" to the relevant + Now we have all the required dependencies we can build SWIG using PowerShell and the commands below. We are assuming Visual Studio 2019 is installed. For other versions of Visual Studio change "Visual Studio 16 2019 -A x64" to the relevant Visual Studio Generator and architecture. We add the required build tools to the system PATH, and then build a Release version of SWIG. If all runs successfully a new swig.exe should be generated in the C:/swig/install2/bin folder. @@ -268,16 +269,25 @@ For fully working build steps always check the Continuous Integration (CI) setup

 cd C:\swig
-SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;%PATH%
-SET PCRE_ROOT=C:\Tools\pcre2\PCRE2.10.39.0
-SET PCRE_PLATFORM=x64
-cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="%CD:\=/%/install2" -DCMAKE_C_FLAGS="/DPCRE2_STATIC" ^
--DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" -DPCRE2_INCLUDE_DIR=%PCRE_ROOT%/include -DPCRE2_LIBRARY=%PCRE_ROOT%/lib/pcre2-8-static.lib -S . -B build
+
+$env:PATH="C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;" + $env:PATH
+$PCRE_ROOT="C:\Tools\pcre2\PCRE2.10.39.0"
+$PCRE_PLATFORM="x64"
+
+cmake -G "Visual Studio 16 2019" -A "x64" `
+-DCMAKE_INSTALL_PREFIX="C:/swig/install2" `
+-DCMAKE_C_FLAGS="/DPCRE2_STATIC" `
+-DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" `
+-DPCRE2_INCLUDE_DIR="$PCRE_ROOT/include" `
+-DPCRE2_LIBRARY="$PCRE_ROOT/lib/pcre2-8-static.lib" `
+-S . -B build
+
 cmake --build build --config Release --target install
 
-REM to test the exe
+# to test the exe built correctly
 cd install2/bin
-swig.exe -help
+./swig.exe -version
+./swig.exe -help