Skip to content

Commit

Permalink
test macos-12 (#55)
Browse files Browse the repository at this point in the history
* order

* static

* finding static dependencies

* end

---------

Co-authored-by: fdobad <[email protected]>
  • Loading branch information
fdobad and fdobad authored Sep 2, 2024
1 parent b1d52eb commit 5991e53
Show file tree
Hide file tree
Showing 12 changed files with 192 additions and 289 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-debian-stable.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: build debian stable

on:
pull_request:
branches:
- main
# pull_request:
# branches:
# - main
workflow_dispatch:
workflow_call:

Expand Down
46 changes: 0 additions & 46 deletions .github/workflows/build-macos-13.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/build-macos-latest.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: build macos all

on:
# pull_request:
# branches:
# - main
workflow_dispatch:
workflow_call:

permissions:
contents: write

jobs:
build:
strategy:
matrix:
runner: ["macOS-12", "macOS-13", "macOS-14"]
runs-on: ${{ matrix.runner }}

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Check Runner
run: |
# arch
# echo "runner: ${{ matrix.runner }}.$(arch).$(uname -m)"
# mayor version: sw_vers -productVersion | cut -d '.' -f 1
# Darwin : uname -s
echo "suffix="$(uname -s).${{ matrix.runner }}.$(arch)"" >> $GITHUB_ENV
brew config
- name: Install Dependencies
run: |
brew install gcc@12 libomp eigen boost libtiff # llvm ?
- name: Build
run: |
cd Cell2Fire
make clean
make -f makefile.macos
otool -L Cell2Fire > otool_${{ env.suffix }}.txt
mv Cell2Fire Cell2Fire_${{ env.suffix }}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: binaries_${{ env.suffix }}
path: |
Cell2Fire/otool_${{ env.suffix }}.txt
Cell2Fire/Cell2Fire_${{ env.suffix }}
- name: Install Static Dependencies
run: |
brew install gcc@12 libomp eigen boost libtiff jpeg-turbo xz zstd zlib
- name: Build Static
run: |
cd Cell2Fire
make clean
make -f makefile.macos-static
otool -L Cell2Fire > otool_${{ env.suffix }}-static.txt
mv Cell2Fire Cell2Fire_${{ env.suffix }}-static
- name: Upload Static
uses: actions/upload-artifact@v4
with:
name: binaries_${{ env.suffix }}-static
path: |
Cell2Fire/otool_${{ env.suffix }}-static.txt
Cell2Fire/Cell2Fire_${{ env.suffix }}-static
6 changes: 3 additions & 3 deletions .github/workflows/build-manylinux.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: build manylinux

on:
pull_request:
branches:
- main
# pull_request:
# branches:
# - main
workflow_dispatch:
workflow_call:

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: build windows

on:
pull_request:
branches:
- main
# pull_request:
# branches:
# - main
workflow_dispatch:
workflow_call:

Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: release

on:
pull_request:
branches:
- main
# pull_request:
# branches:
# - main
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
Expand All @@ -20,18 +20,14 @@ jobs:
build_debian_stable:
uses: ./.github/workflows/build-debian-stable.yml

# build_macos_latest:
# uses: ./.github/workflows/build-macos-latest.yml

# build_macos_13:
# uses: ./.github/workflows/build-macos-13.yml
build_macos:
uses: ./.github/workflows/build-macos.yml

build_windows:
uses: ./.github/workflows/build-windows.yml

release:
# needs: [build_ubuntu_latest, build_debian_stable, build_windows, build_macos_latest, build_macos_13]
needs: [build_manylinux, build_windows, build_debian_stable]
needs: [build_manylinux, build_windows, build_debian_stable, build_macos]
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -65,6 +61,7 @@ jobs:
zip ../Cell2FireW_${{ env.RELEASE_TAG }}-manylinux-x86_64-binary.zip Cell2Fire ldd_manylinux.txt
zip ../Cell2FireW_${{ env.RELEASE_TAG }}-Debian.bookworm.x86_64-binary.zip Cell2Fire.Debian.bookworm.x86_64 ldd.Debian.bookworm.x86_64.txt
zip ../Cell2FireW_${{ env.RELEASE_TAG }}-Ubuntu.jammy.x86_64-binary.zip Cell2Fire.Ubuntu.jammy.x86_64 ldd.Ubuntu.jammy.x86_64.txt
zip ../Cell2FireW_${{ env.RELEASE_TAG }}-macOS-binaries.zip Cell2Fire_Darwin* otool*.txt
- name: Zip Data Instances
run: |
Expand Down Expand Up @@ -96,6 +93,7 @@ jobs:
Cell2FireW_${{ env.RELEASE_TAG }}-manylinux-x86_64-binary.zip
Cell2FireW_${{ env.RELEASE_TAG }}-Debian.bookworm.x86_64-binary.zip
Cell2FireW_${{ env.RELEASE_TAG }}-Ubuntu.jammy.x86_64-binary.zip
Cell2FireW_${{ env.RELEASE_TAG }}-macOS-binaries.zip
Kitral-asc.zip
Kitral-tif.zip
CanadianFBP-asc.zip
Expand Down
44 changes: 0 additions & 44 deletions Cell2Fire/makefile.debian

This file was deleted.

86 changes: 47 additions & 39 deletions Cell2Fire/makefile.macos
Original file line number Diff line number Diff line change
@@ -1,44 +1,52 @@
LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
CC = /opt/homebrew/bin/g++-12
CFLAGS = -std=c++14 -O3 -I /opt/homebrew/include -I /opt/homebrew/include/eigen3 -fopenmp
LIBS = -m64 -fPIC -fno-strict-aliasing -fexceptions -fopenmp -DNDEBUG -DIL_STD -lm -lpthread -ldl
TARGETS = Cell2Fire
all: $(TARGETS)
Cell2Fire: Cell2Fire.o Cells.o FuelModelSpain.o FuelModelKitral.o FuelModelFBP.o Spotting.o ReadCSV.o ReadArgs.o Lightning.o WriteCSV.o Ellipse.o DataGenerator.o
$(CC) -o $@ $(LIBS) Cell2Fire.o Cells.o FuelModelSpain.o FuelModelKitral.o FuelModelFBP.o Spotting.o ReadCSV.o ReadArgs.o Lightning.o WriteCSV.o Ellipse.o DataGenerator.o
Cell2Fire.o: Cell2Fire.cpp Cells.o FuelModelSpain.o FuelModelKitral.o FuelModelFBP.o Spotting.o ReadCSV.o ReadArgs.o WriteCSV.o DataGenerator.o
$(CC) -c $(CFLAGS) Cell2Fire.cpp
Spotting.o: Spotting.cpp Spotting.h Cells.h
$(CC) -c $(CFLAGS) Spotting.cpp
Cells.o: Cells.cpp Cells.h FuelModelSpain.o FuelModelKitral.o FuelModelFBP.o
$(CC) -c $(CFLAGS) Cells.cpp
ReadCSV.o: ReadCSV.cpp ReadCSV.h
$(CC) -c $(CFLAGS) ReadCSV.cpp
ReadArgs.o: ReadArgs.cpp ReadArgs.h
$(CC) -c $(CFLAGS) ReadArgs.cpp
Lightning.o: Lightning.cpp Lightning.h
$(CC) -c $(CFLAGS) Lightning.cpp
Forest.o: Forest.cpp Forest.h
$(CC) -c $(CFLAGS) Forest.cpp
WriteCSV.o: WriteCSV.cpp WriteCSV.h
$(CC) -c $(CFLAGS) WriteCSV.cpp
Ellipse.o: Ellipse.cpp Ellipse.h
$(CC) -c $(LIBS) $(CFLAGS) Ellipse.cpp
FuelModelSpain.o: FuelModelSpain.cpp FuelModelSpain.h Cells.h
$(CC) -c $(LIBS) $(CFLAGS) FuelModelSpain.cpp
FuelModelKitral.o: FuelModelKitral.cpp FuelModelKitral.h Cells.h
$(CC) -c $(LIBS) $(CFLAGS) FuelModelKitral.cpp
FuelModelFBP.o: FuelModelFBP.cpp FuelModelFBP.h Cells.h
$(CC) -c $(LIBS) $(CFLAGS) FuelModelFBP.cpp
DataGenerator.o: DataGenerator.cpp DataGenerator.h
$(CC) -c $(LIBS) $(CFLAGS) DataGenerator.cpp
# Development dependencies
CXX = g++-12

# NOT WORKING
# Capture the value of the environment variable HOMEBREW_PREFIX
# HOMEBREW_PREFIX := $(shell echo $$HOMEBREW_PREFIX)
# HOMEBREW_PREFIX := $(shell echo $(brew --prefix))

# Capture the output of the `arch` command
ARCH := $(shell arch)

# Set HOMEBREW_PREFIX based on the architecture
ifeq ($(ARCH), arm64)
HOMEBREW_PREFIX := /opt/homebrew
else
HOMEBREW_PREFIX := /usr/local
endif

INCLUDE := $(HOMEBREW_PREFIX)/include
OPT := $(HOMEBREW_PREFIX)/opt

# Compiler and linker flags
CXXFLAGS = -m64 -fPIC -fno-strict-aliasing -fexceptions -fopenmp -DNDEBUG -DIL_STD -std=c++14 -O3 -I $(INCLUDE) -I $(INCLUDE)/eigen3 -I $(INCLUDE)/boost
LDFLAGS = -m64 -fPIC -fno-strict-aliasing -fexceptions -fopenmp -DNDEBUG -DIL_STD -lm -lpthread -ltiff -L$(OPT)/libtiff/lib

# Source files
SRCS = Cell2Fire.cpp Cells.cpp FuelModelSpain.cpp FuelModelKitral.cpp FuelModelFBP.cpp Spotting.cpp ReadCSV.cpp ReadArgs.cpp Lightning.cpp WriteCSV.cpp Ellipse.cpp DataGenerator.cpp

# Object files
OBJS = $(SRCS:.cpp=.o)

# Target executable
TARGET = Cell2Fire

# Build rules

all: $(TARGET)

$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LDFLAGS)

%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@

clean:
rm -f Lightning.o ReadArgs.o ReadCSV.o Cell2Fire.o Cells.o Cell2Fire Spotting.o WriteCSV.o Ellipse.o FuelModelFBP.o FuelModelKitral.o FuelModelSpain.o DataGenerator.o *.gch
rm -f $(OBJS) $(TARGET)

DESTDIR = /usr/local/bin
install: all
cp $(TARGETS) $(DESTDIR)
uninstall: all
rm -rf $(DESTDIR)/$(TARGETS)

rm $(DESTDIR)/$(TARGETS)
Loading

0 comments on commit 5991e53

Please sign in to comment.