From 7ef14ab77676d2c544675aec67b30febc307e6a6 Mon Sep 17 00:00:00 2001 From: Philippe Gras Date: Wed, 22 Jan 2025 14:19:36 +0100 Subject: [PATCH] Change OS of CI to previous releases as latest one does not provide clang-13 --- .github/workflows/test-linux.yml | 5 +++-- .github/workflows/test-macos.yml | 28 ++++++++++++++++++++-------- CMakeLists.txt | 14 ++++++++++++-- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 8e6da72..99e77b8 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -20,7 +20,8 @@ jobs: - '1.10' - 'nightly' os: - - ubuntu-latest +# - ubuntu-latest + - ubuntu-22.04 # - macOS-latest arch: - x64 @@ -28,7 +29,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Install liclang + - name: Install libclang run: | if [ "$RUNNER_OS" = Linux ]; then sudo apt-get install clang-13 libclang-13-dev diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 62525fa..d0e466b 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -21,19 +21,24 @@ jobs: - 'nightly' os: # - ubuntu-latest - - macOS-latest +# - macOS-latest + - macos-13 arch: - x64 steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Install liclang + - name: Install libclang run: | if [ "$RUNNER_OS" = Linux ]; then sudo apt-get install clang-13 libclang-13-dev else #MacOS - brew install llvm@13 + #brew install llvm@13 #llvm@13 no more supported by brew + wget "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz" + tar xJf clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz + rm clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz + ln -s clang+llvm-13.0.0-x86_64-apple-darwin clang-13 fi - uses: julia-actions/setup-julia@latest with: @@ -51,11 +56,18 @@ jobs: if [ "$RUNNER_OS" = Linux ]; then cmake -DClang_DIR=/usr/lib/llvm-13/lib/cmake/clang -B build -S . else #MacOS - #cmake -DClang_DIR=/usr/local/Cellar/llvm@13/13.0.1_2/lib/cmake/clang/ -B build -S . - echo ls /opt/homebrew/opt/llvm@13/lib/cmake/clang - ls /opt/homebrew/opt/llvm@13/lib/cmake/clang - cmake -DClang_DIR=/opt/homebrew/opt/llvm@13/lib/cmake/clang -B build -S . + #echo "ls clang-13/" + #ls clang-13/ + #echo "ls clang-13/lib" + #ls clang-13/lib + #echo "ls clang-13/lib/cmake" + #ls clang-13/lib/cmake + #echo "ls clang-13/lib/cmake/clang" + #ls clang-13/lib/cmake/clang + #cmake -DClang_DIR=`pwd`/clang-13/lib/cmake/clang -DLLVM_DIR=`pwd`/clang-13/lib/cmake/llvm -B build -S . + cmake -DClang_DIR=`pwd`/clang-13/lib/cmake/clang -B build -S . fi - cmake --build build --verbose -j `nproc` + cmake --build build --verbose -j `sysctl -n hw.logicalcpu` PATH="`pwd`/build:$PATH" + export SDKROOT="$(xcrun --sdk macosx --show-sdk-path) cd test && ./runtests.jl diff --git a/CMakeLists.txt b/CMakeLists.txt index 644df79..044320b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,9 +74,19 @@ else() # Using Clang_jll set(SHARED_LIBS libclang clang-cpp LLVM) foreach(shared_lib IN LISTS SHARED_LIBS) - add_library(${shared_lib} SHARED IMPORTED) set(lib_path "${CLANG_PREFIX}/lib/lib${shared_lib}${CMAKE_SHARED_LIBRARY_SUFFIX}") string(REPLACE liblib lib lib_path ${lib_path}) + if(EXISTS "${lib_path}") + add_library(${shared_lib} SHARED IMPORTED) + else() + set(lib_path "${CLANG_PREFIX}/lib/lib${shared_lib}${CMAKE_STATIC_LIBRARY_SUFFIX}") + string(REPLACE liblib lib lib_path ${lib_path}) + if(EXISTS "${lib_path}") + add_library(${shared_lib} STATIC IMPORTED) + else() + message(FATAL_ERROR "${shared_lib} libraray was not found in ${CLANG_PREFIX}/lib") + endif() + endif() set_property(TARGET ${shared_lib} PROPERTY IMPORTED_LOCATION ${lib_path}) endforeach() @@ -129,7 +139,7 @@ add_executable(wrapit add_dependencies(wrapit version) -target_link_libraries(wrapit PRIVATE libclang clang-cpp LLVM cxxopts dl +target_link_libraries(wrapit PRIVATE libclang clang-cpp cxxopts dl OpenSSL::Crypto) set_target_properties(wrapit PROPERTIES CXX_STANDARD 17