From e60a02941fa0329f4f7c30d6e0b9560b95570bb9 Mon Sep 17 00:00:00 2001 From: sethg Date: Thu, 31 Mar 2022 19:08:46 +0200 Subject: [PATCH 1/7] Update Windows CMake builds to use NuGet package for PCRE2 --- Doc/Manual/Windows.html | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html index 7a39e88f3..106319687 100644 --- a/Doc/Manual/Windows.html +++ b/Doc/Manual/Windows.html @@ -248,16 +248,9 @@ For fully working build steps always check the Continuous Integration (CI) setup and save to a folder e.g. C:\Tools\Bison
  • - Unfortunately, PCRE2 is not yet available on Nuget. Instead we will use CMake to build and install PCRE2 to C:\Tools\pcre2 using the following commands: -
    -cd C:\
    -SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;%PATH%
    -git clone https://github.com/PhilipHazel/pcre2.git
    -cd pcre2
    -cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:/Tools/pcre2 -S . -B build
    -cmake --build build --config Release --target install
    -        
    - Alternatively, set WITH_PCRE=OFF to disable PCRE2 support if you are sure you do not require it. + 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.
  • We will also need the SWIG source code. Either download a zipped archive from GitHub, or if git is installed clone the latest codebase @@ -271,10 +264,12 @@ cmake --build build --config Release --target install 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.

    -
    +    
  • + +
     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
    +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
    @@ -283,9 +278,8 @@ cmake --build build --config Release --target install
     REM to test the exe
     cd install2/bin
     swig.exe -help
    -    
    - - + +

    In addition to Release builds you can create a Debug build using:

    From dbebb2dac81499b34505e6bcd460c90622e4df29 Mon Sep 17 00:00:00 2001 From: sethg Date: Sat, 20 Aug 2022 15:54:27 +0200 Subject: [PATCH 2/7] Add GitHub Action to test Windows builds using Nuget as described in the docs --- .github/workflows/nuget.yml | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/nuget.yml diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 000000000..f42ee784a --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,47 @@ +name: Windows Nuget Build + +on: + push: + paths-ignore: + - 'CHANGES*' + - 'Doc/**' + - 'appveyor.yml' + pull_request: + branches: master + paths-ignore: + - 'CHANGES*' + - 'Doc/**' + - 'appveyor.yml' + +jobs: + build: + + runs-on: windows-2019 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Install Dependencies + 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 + 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 + cmake --build build --config Release --target install + + - name: Test + shell: cmd + working-directory: install2/bin + run: | + swig.exe -help From ae0e62dd1ad8e8f2054ceb1908b9fcceccbc64eb Mon Sep 17 00:00:00 2001 From: sethg Date: Sat, 20 Aug 2022 16:02:45 +0200 Subject: [PATCH 3/7] Test using version rather than help --- .github/workflows/nuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index f42ee784a..02100ab94 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -44,4 +44,4 @@ jobs: shell: cmd working-directory: install2/bin run: | - swig.exe -help + swig.exe -version From 95d255e16e1272fb6898ed9fe330f1d66c1f18da Mon Sep 17 00:00:00 2001 From: sethg Date: Tue, 27 Sep 2022 09:48:19 +0200 Subject: [PATCH 4/7] Switch Action and docs to use PowerShell --- .github/workflows/nuget.yml | 21 ++++++++++++++------- Doc/Manual/Windows.html | 32 +++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 18 deletions(-) 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
     

    From 730e49d379cad28dcbafe63c1d51b1a9bc68b9ee Mon Sep 17 00:00:00 2001 From: sethg Date: Tue, 27 Sep 2022 10:32:16 +0200 Subject: [PATCH 5/7] Move install to separate step --- .github/workflows/nuget.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index f664d306c..706344964 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -45,6 +45,10 @@ jobs: -DPCRE2_INCLUDE_DIR="$PCRE_ROOT/include" ` -DPCRE2_LIBRARY="$PCRE_ROOT/lib/pcre2-8-static.lib" ` -S . -B build + + - name: Install + shell: powershell + run: | cmake --build build --config Release --target install - name: Test From 1d47e11da960af502a09cd9d22a5832fa9413143 Mon Sep 17 00:00:00 2001 From: sethg Date: Tue, 27 Sep 2022 11:01:35 +0200 Subject: [PATCH 6/7] Build and Install are in the same command --- .github/workflows/nuget.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index 706344964..ca858b439 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -31,7 +31,7 @@ jobs: nuget install Bison -Version 3.7.4 -OutputDirectory C:\Tools\bison nuget install PCRE2 -Version 10.39 -OutputDirectory C:\Tools\pcre2 - - name: Build + - name: Build and Install shell: powershell run: | $env:PATH="C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;" + $env:PATH @@ -45,10 +45,6 @@ jobs: -DPCRE2_INCLUDE_DIR="$PCRE_ROOT/include" ` -DPCRE2_LIBRARY="$PCRE_ROOT/lib/pcre2-8-static.lib" ` -S . -B build - - - name: Install - shell: powershell - run: | cmake --build build --config Release --target install - name: Test From e45d8d0efd26ec5109229074fe5154b9dd47c927 Mon Sep 17 00:00:00 2001 From: sethg Date: Tue, 27 Sep 2022 15:02:58 +0200 Subject: [PATCH 7/7] Split build and install --- .github/workflows/nuget.yml | 9 +++++++-- Doc/Manual/Windows.html | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index ca858b439..7b8174a1e 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -31,7 +31,7 @@ jobs: nuget install Bison -Version 3.7.4 -OutputDirectory C:\Tools\bison nuget install PCRE2 -Version 10.39 -OutputDirectory C:\Tools\pcre2 - - name: Build and Install + - name: Build shell: powershell run: | $env:PATH="C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;" + $env:PATH @@ -45,7 +45,12 @@ jobs: -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 + cmake --build build --config Release + + - name: Install + shell: powershell + run: | + cmake --install build --config Release - name: Test shell: powershell diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html index 96518c464..c822d2ca3 100644 --- a/Doc/Manual/Windows.html +++ b/Doc/Manual/Windows.html @@ -282,7 +282,8 @@ cmake -G "Visual Studio 16 2019" -A "x64" ` -DPCRE2_LIBRARY="$PCRE_ROOT/lib/pcre2-8-static.lib" ` -S . -B build -cmake --build build --config Release --target install +cmake --build build --config Release +cmake --install build --config Release # to test the exe built correctly cd install2/bin