Skip to content

Commit

Permalink
Merge pull request #18 from K20shores/mac_build
Browse files Browse the repository at this point in the history
Mac build
  • Loading branch information
lizziel authored Jul 10, 2024
2 parents 5eabcbe + 6bd71bd commit 03313bb
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 23 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Mac

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
gnu:
runs-on: macos-latest
strategy:
matrix:
gcc_version: [11, 12, 13]
build_type: [Debug, Release]
env:
FC: gfortran-${{ matrix.gcc_version }}

steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: brew install netcdf netcdf-fortran

- name: Run Cmake
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: Build
run: cmake --build build --verbose
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Changed FJX_scat-aer.dat format to expect 1 character greater width for PAA (data columns 3-9)
- Limit prints to single core
- Renamed all modules to use .F90 suffix and cldj_ prefix
- Modified the cmake files for Standalone to build on mac successfully

## Added
- Added CMake support
Expand All @@ -33,7 +34,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Added C pre-processor blocks for compatibility with GEOS-Chem offline CTM, GCHP, GEOS, and CESM
- Added new global variables RNAMES and BRANCH for species info
- Added GitHub config and PR/issue templates
- Added GitHub action for build tests
- Added GitHub action to test builds on Ubuntu
- Added GitHub action to test builds on Mac

### Fixed
- Fixed bugs for compatibility with gfortran compilers
Expand Down
23 changes: 17 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,23 @@ set(CloudJ_Fortran_FLAGS_DEBUG_Intel
CACHE STRING "Cloud-J compiler flags for build type debug with Intel compilers"
)

set(CloudJ_Fortran_FLAGS_GNU
-cpp -w -std=legacy -fautomatic -fno-align-commons -fconvert=big-endian
-fno-range-check -mcmodel=medium -fbacktrace -g -DLINUX_GFORTRAN
-ffree-line-length-none
CACHE STRING "Cloud-J compiler flags for all build types with GNU compilers"
)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
# arm based processors only support mcmodels of large small tiny
set(CloudJ_Fortran_FLAGS_GNU
-cpp -w -std=legacy -fautomatic -fno-align-commons -fconvert=big-endian
-fno-range-check -mcmodel=small -fbacktrace -g -DLINUX_GFORTRAN
-ffree-line-length-none
CACHE STRING "Cloud-J compiler flags for all build types with GNU compilers"
)
else()
set(CloudJ_Fortran_FLAGS_GNU
-cpp -w -std=legacy -fautomatic -fno-align-commons -fconvert=big-endian
-fno-range-check -mcmodel=medium -fbacktrace -g -DLINUX_GFORTRAN
-ffree-line-length-none
CACHE STRING "Cloud-J compiler flags for all build types with GNU compilers"
)
endif()

set(CloudJ_Fortran_FLAGS_RELEASE_GNU
-O3 -funroll-loops
CACHE STRING "Cloud-J compiler flags for build type release with GNU compilers"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Cloud-J

[![Ubuntu](https://github.com/geoschem/Cloud-J/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/geoschem/Cloud-J/actions/workflows/ubuntu.yml)
[![Mac](https://github.com/geoschem/Cloud-J/actions/workflows/mac.yml/badge.svg)](https://github.com/geoschem/Cloud-J/actions/workflows/mac.yml)
[![License](https://img.shields.io/badge/license-GPLv3-blue)](https://github.com/geoschem/Cloud-J/blob/main/LICENSE)

Cloud-J is a multi-scattering eight-stream radiative transfer model for solar radiation based on Fast-J. It was originally developed by Michael J. Prather (UCI). For information about the origins and history of Cloud-J and its predecessor Fast-J please see the [history document](https://github.com/geoschem/cloud-j/blob/main/docs/History_of_Fast-J_photolysis_code.md) in the docs subdirectory of this repository.
Expand Down
17 changes: 1 addition & 16 deletions src/Interfaces/Standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
# Cloud-J/src/CMakeLists.txt

add_library(CloudJ_Standalone STATIC EXCLUDE_FROM_ALL
CJ77.F90
)
target_link_libraries(CloudJ_Standalone
PUBLIC CloudJ_Core
)
target_include_directories(CloudJ_Standalone
INTERFACE ${CLOUDJ_BINARY_DIR}/mod
)
target_compile_options(CloudJ_Standalone
PRIVATE
""
$<$<STREQUAL:"${CMAKE_Fortran_COMPILER_ID}","GNU">:-ffree-line-length-none>
)

#if("cloudj_standalone" IN_LIST CLOUDJ_EXE_TARGETS)
add_executable(cloudj_standalone
CJ77.F90
)
target_link_libraries(cloudj_standalone
PUBLIC CloudJ_Standalone
PUBLIC CloudJ_Core
)
set_target_properties(cloudj_standalone PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
Expand Down

0 comments on commit 03313bb

Please sign in to comment.