From 6eb0b188c432008afabecaf8d2f0b925c2ecd87f Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Sat, 24 Jun 2023 10:23:15 +0530 Subject: [PATCH 1/3] add c to windows test workflow --- .github/workflows/windows-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-test.yml b/.github/workflows/windows-test.yml index ce2382cfb..169a3cc0b 100644 --- a/.github/workflows/windows-test.yml +++ b/.github/workflows/windows-test.yml @@ -37,7 +37,7 @@ jobs: - name: Set up the environment run: cmd.exe /c "powershell .\tools\metacall-environment.ps1 $Env:METACALL_INSTALL_OPTIONS" env: - METACALL_INSTALL_OPTIONS: python nodejs java ruby typescript wasm # netcore5 file rpc java c cobol rust rapidjson funchook swig pack # clangformat v8rep51 coverage + METACALL_INSTALL_OPTIONS: python nodejs c java ruby typescript wasm # netcore5 file rpc java c cobol rust rapidjson funchook swig pack # clangformat v8rep51 coverage - name: Configure run: | @@ -46,7 +46,7 @@ jobs: cd "$METACALL_PATH\build" cmd.exe /c "powershell ..\tools\metacall-configure.ps1 $Env:METACALL_BUILD_OPTIONS" env: - METACALL_BUILD_OPTIONS: ${{ matrix.options.buildtype }} ${{ matrix.options.sanitizer }} scripts ports tests python nodejs java ruby typescript wasm # netcore5 file rpc java c cobol rust examples install pack benchmarks # v8 coverage + METACALL_BUILD_OPTIONS: ${{ matrix.options.buildtype }} ${{ matrix.options.sanitizer }} scripts ports tests python nodejs java ruby typescript wasm # netcore5 file rpc java c cobol rust examples install pack benchmarks # v8 coverage - name: Build working-directory: ./build From c6fd502135e4ad038b6ec227546116f31b4c0473 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Sat, 24 Jun 2023 10:44:52 +0530 Subject: [PATCH 2/3] add c to windows test workflow --- .github/workflows/windows-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-test.yml b/.github/workflows/windows-test.yml index 169a3cc0b..a21d16f03 100644 --- a/.github/workflows/windows-test.yml +++ b/.github/workflows/windows-test.yml @@ -46,7 +46,7 @@ jobs: cd "$METACALL_PATH\build" cmd.exe /c "powershell ..\tools\metacall-configure.ps1 $Env:METACALL_BUILD_OPTIONS" env: - METACALL_BUILD_OPTIONS: ${{ matrix.options.buildtype }} ${{ matrix.options.sanitizer }} scripts ports tests python nodejs java ruby typescript wasm # netcore5 file rpc java c cobol rust examples install pack benchmarks # v8 coverage + METACALL_BUILD_OPTIONS: ${{ matrix.options.buildtype }} ${{ matrix.options.sanitizer }} scripts ports tests python nodejs c java ruby typescript wasm # netcore5 file rpc java c cobol rust examples install pack benchmarks # v8 coverage - name: Build working-directory: ./build From 607d09e9ebac1237cb401ecd121b0d40937bf962 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Sun, 30 Jul 2023 17:51:07 +0530 Subject: [PATCH 3/3] setup libffi build and llvm in metacall-environemnt.ps1 --- tools/metacall-environment.ps1 | 87 ++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/tools/metacall-environment.ps1 b/tools/metacall-environment.ps1 index 9304c9e66..e9a90f78a 100755 --- a/tools/metacall-environment.ps1 +++ b/tools/metacall-environment.ps1 @@ -160,6 +160,76 @@ function Set-Ruby { Write-Output "-DRuby_LIBRARY=""$RubyDir/lib/x64-vcruntime140-ruby310.lib""" >> $Env_Opts } +function Set-C { + Write-Output "Install C depenendencies" + + Set-Location $ROOT_DIR + + $DepsDir = "$ROOT_DIR\dependencies" + $repositoryUrl = "https://github.com/newlawrence/Libffi.git" + $destinationPath = "$DepsDir\libffi" + Clone-GitRepository -repositoryUrl $repositoryUrl -destinationPath $destinationPath + + + mkdir "$destinationPath\build" + Set-Location "$destinationPath\build" + + cmake .. -G"Visual Studio 16 2019" + + cmake --build . --target ffi + + Set-Choco + + # choco install llvm -y + choco install llvm -y + + + $Env_Opts = "$ROOT_DIR\build\CMakeConfig.txt" + + $LLVM_Dir1 = "$env:ProgramW6432/LLVM".Replace('\', '/') + # find a way to pass multiple locations to cmake + # $LLVM_Dir2 = "$env:ProgramFiles/LLVM".Replace('\', '/') + $LibFFI_Dir = $destinationPath.Replace('\','/') + + Write-Output "-DLIBFFI_LIBRARY=""$LibFFI_Dir/build/lib/libffi.lib""" >> $Env_Opts + Write-Output "-DLIBFFI_INCLUDE_DIR=""$LibFFI_Dir/build/include/""" >> $Env_Opts + Write-Output "-DLibClang_INCLUDE_DIR=""$LLVM_Dir1/include/clang""" >> $Env_Opts + +} + + +function Clone-GitRepository { + param ( + [string]$repositoryUrl, + [string]$destinationPath + ) + + # Check if Git is installed + if (-not (Get-Command git -ErrorAction SilentlyContinue)) { + Write-Error "Git is not installed. Please install Git and try again." + return + } + + # Check if the destination path already exists + if (Test-Path $destinationPath) { + Write-Error "Destination path already exists. Please provide a different path." + return + } + + # Clone the repository using Git + & git clone $repositoryUrl $destinationPath + + # Check if the cloning was successful + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to clone the repository." + return + } + + Write-Output "Repository cloned successfully." +} + + + function Add-to-Path { $GivenPath = $args[0] @@ -203,6 +273,22 @@ function Set-TypeScript { npm i react-dom@latest -g } +function Set-Choco { + # Set directory for installation - Chocolatey does not lock + # down the directory if not the default + $InstallDir='C:\ProgramData\chocoportable' + $env:ChocolateyInstall="$InstallDir" + + # If your PowerShell Execution policy is restrictive, you may + # not be able to get around that. Try setting your session to + # Bypass. + Set-ExecutionPolicy Bypass -Scope Process -Force; + + # All install options - offline, proxy, etc at + # https://chocolatey.org/install + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +} + # Configure function Configure { # Create option variables file @@ -275,6 +361,7 @@ function Configure { } if ( "$var" -eq 'c' ) { Write-Output "c selected" + Set-C } if ( "$var" -eq 'cobol' ) { Write-Output "cobol selected"