Skip to content

Commit

Permalink
Update CONFIG=apple and add CI test on macOS-11 (#47)
Browse files Browse the repository at this point in the history
* test on macos

* update

* update

* update

* update

* update

* update

* update

* update
  • Loading branch information
yomichi committed Aug 25, 2023
1 parent a3ffa6a commit 01f1c7f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,27 @@ on: [push]

jobs:
ctest:
runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: ["ubuntu-22.04", "macos-11", "ubuntu-20.04"]
fail-fast: false

steps:
- uses: actions/checkout@v3

- name: apt
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt update
sudo apt install liblapack-dev openmpi-bin libopenmpi-dev libscalapack-openmpi-dev
- name: brew
if: ${{ runner.os == 'macOS' }}
run: |
brew install openmpi scalapack libomp
- name: pip
run: |
python -m pip install numpy
Expand All @@ -26,7 +37,13 @@ jobs:
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE
if [ ${{ runner.os }} = "macOS" ] ; then
# CONFIG=apple requires gfortran but macOS runner has not, but gfortran-11, 12, ...
ln -s `which gfortran-11` gfortran
env PATH=`pwd`:$PATH HOMEBREW_PREFIX=/usr/local cmake -DCONFIG=apple -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE
else
cmake -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE
fi
- name: build
working-directory: ${{runner.workspace}}/build
Expand Down
10 changes: 7 additions & 3 deletions config/apple.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# for Apple clang compiler
# additional libomp and gfortran installation required
# mac computers are suggested to use this configuration for better performance

if(NOT $ENV{HOMEBREW_PREFIX})
message(FATAL "Homebrew is not installed. Please install Homebrew first.")
endif()

set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall -Wformat -Werror=format-security")
Expand All @@ -9,8 +14,7 @@ set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE)
add_definitions(-DF77_COMPLEX_RET_INTEL)

# OpenMP with libomp
set(CMAKE_EXE_LINKER_FLAGS "-L/usr/local/lib -lomp")
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS "-L$ENV{HOMEBREW_PREFIX}/opt/libomp/lib -lomp")
set(OpenMP_C_FLAGS "-I$ENV{HOMEBREW_PREFIX}/opt/libomp/include -Xpreprocessor -fopenmp" CACHE STRING "" FORCE)
set(OpenMP_C_LIB_NAMES "")
set(CMAKE_OSX_SYSROOT "")

0 comments on commit 01f1c7f

Please sign in to comment.