Skip to content

Commit

Permalink
Maintenance.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny authored May 27, 2024
2 parents 73d346c + 40bb2dd commit ccc2305
Show file tree
Hide file tree
Showing 126 changed files with 2,816 additions and 1,179 deletions.
43 changes: 4 additions & 39 deletions .github/workflows/buildThirdPartyLibrary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,13 @@ jobs:
fail-fast: false
matrix:
include:
- name: 'Windows release (Intel)'
- name: 'Windows release'
os: windows-latest
arch: amd64
build_type: Release
- name: 'Windows debug (Intel)'
- name: 'Windows debug'
os: windows-latest
arch: amd64
build_type: Debug
- name: 'Windows release (ARM)'
os: windows-latest
arch: amd64_arm64
build_type: Release
- name: 'Windows debug (ARM)'
os: windows-latest
arch: amd64_arm64
build_type: Debug
- name: 'Linux (Intel)'
- name: 'Linux'
os: ubuntu-20.04
# Note: we must use ubuntu-20.04 rather than ubuntu-latest (i.e. ubuntu-22.04 at this stage). Indeed,
# Ubuntu 22.04's copy of glibc doesn't include libpthread anymore (see
Expand All @@ -44,11 +34,6 @@ jobs:
# of glibc with libpthread, hence getting various messages about __libc_single_threaded being
# undefined when trying to build our Python wheels using third-party libraries built on ubuntu-22.04.
build_type: Release
- name: 'Linux (ARM)'
os: ubuntu-latest
arch: arm
cmake_prereqs: CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++
build_type: Release
- name: 'macOS (Intel)'
os: macos-13
build_type: Release
Expand All @@ -63,40 +48,20 @@ jobs:
steps:
- name: Check out libOpenCOR
uses: actions/checkout@v4
- name: Install ARM compiler
if: ${{ matrix.arch == 'arm' }}
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
uses: mikehardy/buildcache-action@v2
with:
cache_key: libraries-${{ matrix.os }}-${{ matrix.shared_libs }}
- name: Configure MSVC (to build an Intel-based version of llvm-tblgen and clang-tblgen)
if: ${{ (runner.os == 'Windows') && (matrix.arch == 'amd64_arm64') }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Build llvm-tblgen and clang-tblgen
if: ${{ (((runner.os == 'Windows') && (matrix.arch == 'amd64_arm64')) || ((runner.os == 'Linux') && (matrix.arch == 'arm'))) }}
shell: bash
run: |
source src/3rdparty/LLVMClang/scripts/buildllvmclangtblgen ${{ runner.os == 'Windows' }}
echo "DLLVMCLANG_LLVM_TABLEGEN=$DLLVMCLANG_LLVM_TABLEGEN" >> $GITHUB_ENV
echo "DLLVMCLANG_CLANG_TABLEGEN=$DLLVMCLANG_CLANG_TABLEGEN" >> $GITHUB_ENV
- name: Configure MSVC
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Configure libOpenCOR
shell: bash
run: |
mkdir build
cd build
${{ matrix.cmake_prereqs }} cmake -G Ninja -DBUILD_TYPE=${{ matrix.build_type }} -DONLY_BUILD_THIRD_PARTY_LIBRARIES=ON -DPREBUILT_${{ inputs.third_party_library_name }}=OFF ${{ env.DLLVMCLANG_LLVM_TABLEGEN }} ${{ env.DLLVMCLANG_CLANG_TABLEGEN }} ..
${{ matrix.cmake_prereqs }} cmake -G Ninja -DBUILD_TYPE=${{ matrix.build_type }} -DONLY_BUILD_THIRD_PARTY_LIBRARIES=ON -DPREBUILT_${{ inputs.third_party_library_name }}=OFF ..
- name: Upload library artifact
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v4
Expand Down
37 changes: 5 additions & 32 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,18 @@ jobs:
fail-fast: false
matrix:
include:
- name: 'Windows static library (Intel)'
- name: 'Windows static library'
os: windows-latest
msvc_arch: amd64
shared_libs: OFF
- name: 'Windows shared library (Intel)'
- name: 'Windows shared library'
os: windows-latest
msvc_arch: amd64
shared_libs: ON
- name: 'Windows static library (ARM)'
os: windows-latest
msvc_arch: amd64_arm64
shared_libs: OFF
- name: 'Windows shared library (ARM)'
os: windows-latest
msvc_arch: amd64_arm64
shared_libs: ON
- name: 'Linux static library (Intel)'
os: ubuntu-latest
shared_libs: OFF
- name: 'Linux shared library (Intel)'
os: ubuntu-latest
shared_libs: ON
- name: 'Linux static library (ARM)'
- name: 'Linux static library'
os: ubuntu-latest
arch: arm
shared_libs: OFF
cmake_prereqs: CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++
- name: 'Linux shared library (ARM)'
- name: 'Linux shared library'
os: ubuntu-latest
arch: arm
shared_libs: ON
cmake_prereqs: CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++
- name: 'macOS static library (Intel)'
os: macos-13
shared_libs: OFF
Expand All @@ -67,11 +47,6 @@ jobs:
steps:
- name: Check out libOpenCOR
uses: actions/checkout@v4
- name: Install ARM compiler
if: ${{ matrix.arch == 'arm' }}
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
Expand All @@ -81,13 +56,11 @@ jobs:
- name: Configure MSVC
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.msvc_arch }}
- name: Configure libOpenCOR
run: |
mkdir build
cd build
${{ matrix.cmake_prereqs }} cmake -G Ninja -DBUILD_TYPE=Release -DCODE_ANALYSIS=OFF -DCODE_COVERAGE=OFF -DDOCUMENTATION=OFF -DJAVASCRIPT_BINDINGS=OFF -DMEMORY_CHECKS=OFF -DPYTHON_BINDINGS=OFF -DPYTHON_UNIT_TESTING=OFF -DSHARED_LIBS=${{ matrix.shared_libs }} -DUNIT_TESTING=OFF ..
cmake -G Ninja -DBUILD_TYPE=Release -DCODE_ANALYSIS=OFF -DCODE_COVERAGE=OFF -DDOCUMENTATION=OFF -DJAVASCRIPT_BINDINGS=OFF -DMEMORY_CHECKS=OFF -DPYTHON_BINDINGS=OFF -DPYTHON_UNIT_TESTING=OFF -DSHARED_LIBS=${{ matrix.shared_libs }} -DUNIT_TESTING=OFF ..
- name: Build libOpenCOR
run: |
cd build
Expand Down
83 changes: 65 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,37 @@ jobs:
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
- name: 'macOS static library'
- name: 'macOS static library (Intel)'
os: macos-13
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_bindings: OFF
javascript_unit_testing: OFF
memory_checks: OFF
python_bindings: OFF
python_unit_testing: OFF
shared_libs: OFF
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
- name: 'macOS shared library (Intel)'
os: macos-13
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_bindings: OFF
javascript_unit_testing: OFF
memory_checks: OFF
python_bindings: OFF
python_unit_testing: OFF
shared_libs: ON
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
- name: 'macOS static library (ARM)'
os: macos-latest
build_type: Release
code_analysis: OFF
Expand All @@ -88,7 +118,7 @@ jobs:
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
- name: 'macOS shared library'
- name: 'macOS shared library (ARM)'
os: macos-latest
build_type: Release
code_analysis: OFF
Expand Down Expand Up @@ -147,7 +177,24 @@ jobs:
unit_testing: OFF
target: python_unit_testing
pip_install_test_and_uninstall: ON
- name: 'macOS Python bindings'
- name: 'macOS Python bindings (Intel)'
os: macos-13
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_bindings: OFF
javascript_unit_testing: OFF
memory_checks: OFF
python_bindings: ON
python_unit_testing: ON
shared_libs: OFF
unit_testing: OFF
context: PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
target: python_unit_testing
pip_install_prerequisites: sudo pip3 install cmake scikit-build
pip_install_test_and_uninstall: ON
- name: 'macOS Python bindings (ARM)'
os: macos-latest
build_type: Release
code_analysis: OFF
Expand Down Expand Up @@ -221,7 +268,7 @@ jobs:
shared_libs: OFF
unit_testing: ON
context: PATH=$GITHUB_WORKSPACE:$PATH CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++
- name: 'Coverage'
- name: 'Code coverage'
os: macos-latest
build_type: Release
code_analysis: OFF
Expand Down Expand Up @@ -270,7 +317,7 @@ jobs:
BUILDCACHE_DEBUG: -1
BUILDCACHE_LOG_FILE: ""
DOXYGEN_VERSION: 1.9.3
LLVMCLANG_VERSION: 17.0.6
LLVMCLANG_VERSION: 18.1.6
steps:
- name: Check out libOpenCOR
uses: actions/checkout@v4
Expand All @@ -288,12 +335,12 @@ jobs:
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
- name: Install LLVM
if: ${{ matrix.target == 'code_coverage' }}
if: ${{ matrix.code_coverage == 'ON' }}
run: |
brew install --overwrite llvm
brew info llvm
- name: Install Clang
if: ${{ matrix.name == 'Code analysis' }}
if: ${{ matrix.code_analysis == 'ON' }}
run: |
wget https://github.com/opencor/gha/releases/download/ci/clang.$LLVMCLANG_VERSION.linux.tar.gz -O - | tar -xz
sudo mv clang /usr/local/bin
Expand All @@ -311,7 +358,7 @@ jobs:
wget https://github.com/opencor/gha/releases/download/ci/clang-tidy.$LLVMCLANG_VERSION.linux.tar.gz -O - | tar -xz
sudo mv clang-tidy /usr/local/bin
- name: Install Emscripten
if: ${{ matrix.target == 'javascript_unit_testing' }}
if: ${{ matrix.javascript_unit_testing == 'ON' }}
run: brew install --overwrite emscripten
- name: Install Prettier
if: ${{ matrix.target == 'javascript_check_code_formatting' }}
Expand All @@ -325,7 +372,7 @@ jobs:
sudo apt update
sudo apt install valgrind
- name: Install pytest and pytest-html
if: ${{ matrix.target == 'python_unit_testing' }}
if: ${{ matrix.python_unit_testing == 'ON' }}
run: pip3 install pytest pytest-html
- name: Install Sphinx and some Sphinx packages
if: ${{ matrix.documentation == 'ON' }}
Expand All @@ -341,27 +388,27 @@ jobs:
cd build
${{ matrix.context }} cmake -G Ninja -DBUILD_TYPE=${{ matrix.build_type }} -DCODE_ANALYSIS=${{ matrix.code_analysis }} -DCODE_COVERAGE=${{ matrix.code_coverage }} -DDOCUMENTATION=${{ matrix.documentation }} -DINSTALL_PREFIX=${{ github.workspace }}/install -DJAVASCRIPT_BINDINGS=${{ matrix.javascript_bindings }} -DJAVASCRIPT_UNIT_TESTING=${{ matrix.javascript_unit_testing }} -DMEMORY_CHECKS=${{ matrix.memory_checks }} -DPYTHON_BINDINGS=${{ matrix.python_bindings }} -DPYTHON_UNIT_TESTING=${{ matrix.python_unit_testing }} -DSHARED_LIBS=${{ matrix.shared_libs }} -DUNIT_TESTING=${{ matrix.unit_testing }} ..
- name: Build libOpenCOR
if: ${{ (matrix.target == 'unit_testing') || (matrix.target == 'javascript_unit_testing') }}
if: ${{ (matrix.unit_testing == 'ON') || (matrix.javascript_unit_testing == 'ON') }}
run: |
cd build
ninja
- name: Unit testing
if: ${{ matrix.target == 'unit_testing' }}
if: ${{ matrix.unit_testing == 'ON' }}
run: |
cd build
ninja ${{ matrix.target }}
- name: JavaScript unit testing
if: ${{ matrix.target == 'javascript_unit_testing' }}
if: ${{ matrix.javascript_unit_testing == 'ON' }}
run: |
cd build
ninja ${{ matrix.target }}
- name: Python unit testing
if: ${{ matrix.target == 'python_unit_testing' }}
if: ${{ matrix.python_unit_testing == 'ON' }}
run: |
cd build
ninja ${{ matrix.target }}
- name: Python unit testing report
if: ${{ matrix.target == 'python_unit_testing' }}
if: ${{ matrix.python_unit_testing == 'ON' }}
run: |
cd build
ninja ${{ matrix.target }}_report
Expand All @@ -386,23 +433,23 @@ jobs:
cd build
ninja
- name: Coverage
if: ${{ matrix.target == 'code_coverage' }}
if: ${{ matrix.code_coverage == 'ON' }}
run: |
cd build
ninja ${{ matrix.target }}
if [ `ninja ${{ matrix.target }} | grep TOTAL | sed 's/ /\n/g' | grep "100.00%" | wc -l | sed 's/ //g'` -eq 4 ]; then exit 0; else exit 1; fi
- name: Coverage report
if: ${{ matrix.target == 'code_coverage' }}
if: ${{ matrix.code_coverage == 'ON' }}
run: |
cd build
ninja ${{ matrix.target }}_report
- name: Memory checks
if: ${{ matrix.target == 'memory_checks' }}
if: ${{ matrix.memory_checks == 'ON' }}
run: |
cd build
ninja ${{ matrix.target }}
- name: Documentation
if: ${{ matrix.target == 'documentation' }}
if: ${{ matrix.documentation == 'ON' }}
run: |
cd build
ninja ${{ matrix.target }}
Expand Down
19 changes: 18 additions & 1 deletion cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ function(configure_target TARGET)
endif()
endif()

# Make it possible to use LLVM+Clang 18+ when building using MSVC (see
# https://github.com/llvm/llvm-project/issues/86028).

if(BUILDING_USING_MSVC)
target_compile_options(${TARGET} PRIVATE /Zc:preprocessor)
endif()

# Analyse the code.

if(LIBOPENCOR_CODE_ANALYSIS)
Expand Down Expand Up @@ -202,6 +209,16 @@ function(configure_target TARGET)
BUILDING_ON_LINUX)
endif()

# Let the target know which architecture we are using.

if(INTEL_MODE)
target_compile_definitions(${TARGET} PRIVATE
BUILDING_ON_INTEL)
else()
target_compile_definitions(${TARGET} PRIVATE
BUILDING_ON_ARM)
endif()

# Let the target know which compiler we are using.

if(BUILDING_USING_MSVC)
Expand Down Expand Up @@ -347,7 +364,7 @@ endfunction()
macro(add_target TARGET)
add_custom_target(${TARGET} ${ARGN})

set(TARGETS "${TARGETS};${TARGET}")
list(APPEND TARGETS ${TARGET})

list(SORT TARGETS)

Expand Down
Loading

0 comments on commit ccc2305

Please sign in to comment.