Skip to content

Visual C++

Visual C++ #123

Workflow file for this run

name: Visual C++
on:
workflow_dispatch:
inputs:
tcl-tags: # User input for selecting Tcl tag
description: 'Tcl version'
required: true
type: choice
options:
- '["main"]'
- '["core-8-6-13"]'
- '["core-8-6-13", "main"]'
default: '["core-8-6-13", "main"]'
runners: # User input for selecting OS
description: 'OS version'
required: true
type: choice
options:
- '["windows-latest"]'
- '["windows-2022"]'
- '["windows-2019"]'
- '["windows-2019", "windows-2022"]'
default: '["windows-2019", "windows-2022"]'
target-architectures:
description: 'x86 and/or x64'
required: false
type: choice
options:
- '["x64"]'
- '["x86"]'
- '["x64", "x86"]'
default: '["x64", "x86"]'
run-tests: # Whether tests should be run
description: 'Run tests as well'
required: false
default: true
type: boolean
with-dyncall: # Build with dyncall
description: 'Build dyncall version'
required: false
default: true
type: boolean
with-libffi: # Build with libffi
description: 'Build libffi version'
required: false
default: true
type: boolean
jobs:
build:
strategy:
matrix:
runner-os: ${{ fromJSON(github.event.inputs.runners) }}
tcl-tag: ${{ fromJSON(github.event.inputs.tcl-tags) }}
target-arch: ${{ fromJSON(github.event.inputs.target-architectures) }}
runs-on: ${{ matrix.runner-os }}
steps:
# Note msvc defaults to 64-bit
- name: Init MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.target-arch }}
- name: Setup Tcl
id: tcl-setup-step
uses: apnadkarni/tcl-setup@action-debug
with:
tcl-tag: ${{ matrix.tcl-tag }}
target-arch: ${{ matrix.target-arch }}
toolchain: 'vc'
- name: Install libffi
if: inputs.with-libffi
shell: cmd
run: |
%VCPKG_INSTALLATION_ROOT%\vcpkg install libffi:${{ matrix.target-arch }}-windows-static-md
- name: Cache dyncall
if: inputs.with-dyncall
id: dyncall-msvc-cache
uses: actions/cache@v4
with:
path: C:/dyncall/msvc/${{ matrix.target-arch }}
key: ${{ runner.os }}-${{ matrix.os}}-dyncall-msvc-${{ matrix.target-arch }}
- name: Install dyncall
if: inputs.with-dyncall && steps.dyncall-msvc-cache.outputs.cache-hit != 'true'
shell: cmd
run: |
curl https://dyncall.org/r1.4/dyncall-1.4.zip --output dyncall-1.4.zip
7z x dyncall-1.4.zip
cd dyncall-1.4
mkdir build-msvc-${{ matrix.target-arch }}
cd build-msvc-${{ matrix.target-arch }}
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:\dyncall\msvc\${{ matrix.target-arch }} -G"NMake Makefiles" ..
cd ..
cmake --build build-msvc-${{ matrix.target-arch }} --config Release
cmake --build build-msvc-${{ matrix.target-arch }} --config Release --target install
- name: Make with libffi
if: inputs.with-libffi
uses: apnadkarni/tcl-build-extension@build-opts
with:
run-tests: ${{ inputs.run-tests }}
make-opts: "INSTALLDIR=${{ env.TCLDIR }} EXTDIR=%VCPKG_INSTALLATION_ROOT%\\installed\\${{ matrix.target-arch }}-windows-static-md"
test-opts: "INSTALLDIR=${{ env.TCLDIR }} EXTDIR=%VCPKG_INSTALLATION_ROOT%\\installed\\${{ matrix.target-arch }}-windows-static-md"
- name: Make with dyncall
if: inputs.with-dyncall
uses: apnadkarni/tcl-build-extension@build-opts
with:
run-tests: ${{ inputs.run-tests }}
make-opts: "OPTS=dyncall INSTALLDIR=${{ env.TCLDIR }} EXTDIR=c:\\dyncall\\msvc\\${{ matrix.target-arch }}"
test-opts: "OPTS=dyncall INSTALLDIR=${{ env.TCLDIR }} EXTDIR=c:\\dyncall\\msvc\\${{ matrix.target-arch }}"