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
  • Loading branch information
mcbarton committed Jan 28, 2024
1 parent e61e7ca commit c776a4e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 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,7 +195,6 @@ 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
Expand Down Expand Up @@ -362,7 +361,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 +708,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 c776a4e

Please sign in to comment.