Skip to content

Commit

Permalink
Add ability to compile CppInterOp and tests on Windows with different…
Browse files Browse the repository at this point in the history
… compiler (#195)
  • Loading branch information
mcbarton authored Feb 2, 2024
1 parent e61e7ca commit 5953058
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 72 deletions.
132 changes: 65 additions & 67 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,14 @@ jobs:
# cling-version: '1.0'
# cppyy: On
# xeus-clang-repl: On
#FIXME: Windows CppInterOp tests expected to fail
#until https://github.com/compiler-research/CppInterOp/issues/188 is solved
- name: win2022-msvc-clang-repl-17
os: windows-2022
compiler: msvc
clang-runtime: '17'
cling: Off
cppyy: Off
#Commented out until rest of ci for Windows tested
#- name: win2022-msvc-clang-repl-17-cppyy
# os: windows-2022
# compiler: msvc
Expand All @@ -181,7 +182,6 @@ jobs:
clang-runtime: '16'
cling: Off
cppyy: Off
#Commented out until rest of ci for Windows tested
#- name: win2022-msvc-clang-repl-16-cppyy
# os: windows-2022
# compiler: msvc
Expand All @@ -195,14 +195,73 @@ jobs:
cling: On
cling-version: '1.0'
cppyy: Off
#Commented out until rest of ci for Windows tested
#- name: win2022-msvc-cling-cppyy
# os: windows-2022
# compiler: msvc
# clang-runtime: '13'
# cling: On
# cling-version: '1.0'
# cppyy: On
- name: osx14-arm-clang-clang-repl-17
os: macos-14
compiler: clang
clang-runtime: '17'
cling: Off
cppyy: Off
- name: osx14-arm-clang-clang-repl-17-cppyy
os: macos-14
compiler: clang
clang-runtime: '17'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang-repl-17-xeus-clang-repl
os: macos-14
compiler: clang
clang-runtime: '17'
cling: Off
cppyy: On
xeus-clang-repl: On
- name: osx14-arm-clang-clang-repl-16
os: macos-14
compiler: clang
clang-runtime: '16'
cling: Off
cppyy: Off
- name: osx14-arm-clang-clang-repl-16-cppyy
os: macos-14
compiler: clang
clang-runtime: '16'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang-repl-16-xeus-clang-repl
os: macos-14
compiler: clang
clang-runtime: '16'
cling: Off
cppyy: On
xeus-clang-repl: On
- name: osx14-arm-clang-clang13-cling
os: macos-14
compiler: clang
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: Off
- name: osx14-arm-clang-clang13-cling-cppyy
os: macos-14
compiler: clang
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: On
- name: osx14-arm-clang-clang13-cling-xeus-clang-repl
os: macos-14
compiler: clang
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: On
xeus-clang-repl: On
- name: osx13-x86-clang-clang-repl-17
os: macos-13
compiler: clang
Expand Down Expand Up @@ -263,69 +322,6 @@ jobs:
cling-version: '1.0'
cppyy: On
xeus-clang-repl: On
#Block commented out until free tier for m1
#exists (expected sometime 2024) and key for os
#can be replaced
#- name: osx13-arm64-clang-clang-repl-17
# os: macos-13-arm64
# compiler: clang
# clang-runtime: '17'
# cling: Off
# cppyy: Off
#- name: osx13-arm64-clang-clang-repl-17-cppyy
# os: macos-13-arm64
# compiler: clang
# clang-runtime: '17'
# cling: Off
# cppyy: On
#- name: osx13-arm64-clang-clang-repl-17-xeus-clang-repl
# os: macos-13-arm64
# compiler: clang
# clang-runtime: '17'
# cling: Off
# cppyy: On
# xeus-clang-repl: On
#- name: osx13-arm64-clang-clang-repl-16
# os: macos-13-arm64
# compiler: clang
# clang-runtime: '16'
# cling: Off
# cppyy: Off
#- name: osx13-arm64-clang-clang-repl-16-cppyy
# os: macos-13-arm64
# compiler: clang
# clang-runtime: '16'
# cling: Off
# cppyy: On
#- name: osx13-arm64-clang-clang-repl-16-xeus-clang-repl
# os: macos-13-arm64
# compiler: clang
# clang-runtime: '16'
# cling: Off
# cppyy: On
# xeus-clang-repl: On
#- name: osx13-arm64-clang-clang13-cling
# os: macos-13-arm64
# compiler: clang
# clang-runtime: '13'
# cling: On
# cling-version: '1.0'
# cppyy: Off
#- name: osx13-arm64-clang-clang13-cling-cppyy
# os: macos-13-arm64
# compiler: clang
# clang-runtime: '13'
# cling: On
# cling-version: '1.0'
# cppyy: On
#- name: osx13-arm64-clang-clang13-cling-xeus-clang-repl
# os: macos-13-arm64
# compiler: clang
# clang-runtime: '13'
# cling: On
# cling-version: '1.0'
# cppyy: On
# xeus-clang-repl: On

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -362,7 +358,6 @@ jobs:
- name: Save PR Info on Windows systems
if: ${{ runner.os == 'windows' }}
run: |
#FIXME: CLING AND LLVM HASH currently hardcoded until windows equivalent of unix commands
#can be found
mkdir ./pr
echo "${{ github.event.number }}" > ./pr/NR
Expand Down Expand Up @@ -710,8 +705,11 @@ jobs:
echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
- name: Build and Test/Install CppInterOp on Windows systems
continue-on-error: true
if: ${{ runner.os == 'windows' }}
run: |
#FIXME: Windows CppInterOp tests expected to fail
#until https://github.com/compiler-research/CppInterOp/issues/188 is solved
$env:PWD_DIR= $PWD.Path
$env:LLVM_DIR="$env:PWD_DIR\llvm-project"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ cmake --build . --target install --parallel $(nproc --all)
```
and
```
cmake -DUSE_CLING=Off -DUSE_REPL=ON -DLLVM_DIR=$LLVM_DIR\build\lib\cmake\llvm -DClang_DIR=$LLVM_DIR\build\lib\cmake\clang -DCMAKE_INSTALL_PREFIX=$env:CPPINTEROP_DIR ..
cmake -DUSE_CLING=Off -DUSE_REPL=ON -DLLVM_DIR=$env:LLVM_DIR\build\lib\cmake\llvm -DClang_DIR=$env:LLVM_DIR\build\lib\cmake\clang -DCMAKE_INSTALL_PREFIX=$env:CPPINTEROP_DIR ..
cmake --build . --target install --parallel $env:ncpus
```
on Windows. If alternatively you would like to install CppInterOp with Cling then execute the following commands on Linux and MacOS
Expand All @@ -254,7 +254,7 @@ cmake --build . --target install --parallel $(nproc --all)
```
and
```
cmake -DUSE_CLING=ON -DUSE_REPL=Off -DCling_DIR=$LLVM_DIR\build\tools\cling -DLLVM_DIR=$LLVM_DIR\build\lib\cmake\llvm -DClang_DIR=$LLVM_DIR\build\lib\cmake\clang -DCMAKE_INSTALL_PREFIX=$env:CPPINTEROP_DIR ..
cmake -DUSE_CLING=ON -DUSE_REPL=Off -DCling_DIR=$env:LLVM_DIR\build\tools\cling -DLLVM_DIR=$env:LLVM_DIR\build\lib\cmake\llvm -DClang_DIR=$env:LLVM_DIR\build\lib\cmake\clang -DCMAKE_INSTALL_PREFIX=$env:CPPINTEROP_DIR ..
cmake --build . --target install --parallel $env:ncpus
```

Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/GoogleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(_gtest_byproducts
${_gtest_byproduct_binary_dir}/lib/libgmock_main.a
)

if(MSVC)
if(WIN32)
set(EXTRA_GTEST_OPTS
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=${_gtest_byproduct_binary_dir}/lib/
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL:PATH=${_gtest_byproduct_binary_dir}/lib/
Expand Down
2 changes: 1 addition & 1 deletion lib/Interpreter/CppInterOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <string>

// Stream redirect.
#ifdef WIN32
#ifdef _WIN32
#include <io.h>
#ifndef STDOUT_FILENO
#define STDOUT_FILENO 1
Expand Down
2 changes: 1 addition & 1 deletion unittests/CppInterOp/TestSharedLib/TestSharedLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define UNITTESTS_CPPINTEROP_TESTSHAREDLIB_TESTSHAREDLIB_H

// Avoid having to mangle/demangle the symbol name in tests
#ifdef WIN32
#ifdef _WIN32
extern "C" __declspec(dllexport) int ret_zero();
#else
extern "C" int ret_zero();
Expand Down

0 comments on commit 5953058

Please sign in to comment.