Skip to content

Commit

Permalink
Merge pull request #333 from astro-informatics/chrisg_build_tweaks
Browse files Browse the repository at this point in the history
Clean-up dependencies
  • Loading branch information
mmcleod89 authored Oct 9, 2023
2 parents 83b1e0b + 3ce6f55 commit 63a1955
Show file tree
Hide file tree
Showing 56 changed files with 740 additions and 380 deletions.
94 changes: 77 additions & 17 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name: Documentation
on:
push:
branches: [ development ]
pull_request:
branches: [ development ]
if: github.event.pull_request.draft == false

env:
USE_CONAN: 0

jobs:
make-documentation:
Expand All @@ -11,22 +17,40 @@ jobs:

- name: Check out Purify
uses: actions/checkout@v3
with:
submodules: recursive
#with:
# submodules: recursive

- name: Install dependencies
run: |
sudo apt update
sudo apt install openmpi-bin libopenmpi-dev casacore-dev doxygen graphviz
if [[ "$USE_CONAN" = 0 ]]; then
sudo apt install libeigen3-dev libspdlog-dev libtiff-dev libcfitsio-dev
sudo apt install libbenchmark-dev libboost-all-dev libyaml-cpp-dev
git clone https://github.com/catchorg/Catch2.git -b v3.4.0
mkdir Catch2/build
cd Catch2/build
cmake .. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build
make -j$(nproc --ignore 1) install
cd -
wget --no-check-certificate --no-verbose http://www.fftw.org/fftw-3.3.10.tar.gz -O- | tar --no-same-owner -xz;
cd fftw-3.3.10
./configure --prefix=${{github.workspace}}/build --enable-shared
make -j$(nproc --ignore 1) install CFLAGS=-fPIC
# Fix bug in FFT3 (cf. https://github.com/FFTW/fftw3/issues/332)
sed -i -e 's/^.*FFTW3LibraryDepends.cmake.*$//1' ${{github.workspace}}/build/lib*/cmake/*/FFTW3Config.cmake
cd -
fi
- name: Install Tensorflow API on Ubuntu
uses: UCL/install-tensorflow-action@main
with:
version: 2.11.0
os: linux

- name: Install Conan
id: conan
if: env.USE_CONAN != '0'
uses: turtlebrowser/get-conan@main
with:
version: 1.60.1
Expand All @@ -39,33 +63,69 @@ jobs:
ref: master

- name: Create cppflow package
run: conan create ./cppflow/ -pr:h=default -pr:b=default

run: |
if [[ "USE_CONAN" = 1 ]]; then
conan create ./cppflow/ -pr:h=default -pr:b=default
else
mkdir cppflow/build
cd cppflow/build
cmake .. -DCMAKE_INSTALL_PREFIX=${PWD}
#cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build
make -j$(nproc --ignore 1) install
fi
- name: Checkout SOPT
uses: actions/checkout@v3
with:
repository: astroinformatics/sopt.git
repository: astro-informatics/sopt.git
path: sopt
ref: development

- name: Create SOPT package
run : |
conan create ./sopt --build missing -s:b compiler.libcxx=libstdc++11 -o mpi=off -o openmp=off -o docs=on -o cppflow=on -pr:h=default -pr:b=default
if [[ "USE_CONAN" = 1 ]]; then
conan create ./sopt --build missing -o mpi=off -o openmp=off -o docs=off -o cppflow=on -pr:h=default -pr:b=default
else
export CMAKE_PREFIX_PATH=${{github.workspace}}/cppflow/build:$CMAKE_PREFIX_PATH
#export CMAKE_PREFIX_PATH=${{github.workspace}}/Catch2/build/lib/cmake:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=${{github.workspace}}/build:$CMAKE_PREFIX_PATH
#export CMAKE_PREFIX_PATH=${{github.workspace}}/build/lib/cmake:$CMAKE_PREFIX_PATH
mkdir sopt/build
cd sopt/build
cmake .. -DCMAKE_INSTALL_PREFIX=${PWD} -Ddompi=OFF -Dopenmp=OFF -Ddocs=OFF -Dcppflow=ON
#cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build -Ddompi=OFF -Dopenmp=OFF -Ddocs=OFF -Dcppflow=ON
make -j$(nproc --ignore 1) install
fi
- name: Configure
run: |
# Need to install this specific version of doxygen because the other Conan build are broken on Conan v1
conan install doxygen/1.9.4@#2af713e135f12722e3536808017ba086 --update
conan install ${{github.workspace}} -if ${{github.workspace}}/build --build missing -s compiler.libcxx=libstdc++11 -o mpi=off -o openmp=off -o docs=on -o cppflow=on -pr:h=default -pr:b=default
if [[ "USE_CONAN" = 1 ]]; then
# Doxygen currently broken in Conan v1 and v2
#conan install doxygen/1.9.4@#2af713e135f12722e3536808017ba086 --update
conan install ${{github.workspace}} -if ${{github.workspace}}/build --build missing -o mpi=off -o openmp=off -o docs=on -o cppflow=on -pr:h=default -pr:b=default
else
export CMAKE_PREFIX_PATH=${{github.workspace}}/cppflow/build:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=${{github.workspace}}/build:$CMAKE_PREFIX_PATH
mkdir -p ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake .. -DCMAKE_INSTALL_PREFIX=${PWD} -Ddompi=OFF -Dopenmp=OFF -Ddocs=ON -Dcppflow=ON
fi
- name: Build
run: conan build ${{github.workspace}} -bf ${{github.workspace}}/build

- name: Make Docweb
run: |
cd build
make docweb VERBOSE=1
if [[ "USE_CONAN" = 1 ]]; then
conan build ${{github.workspace}} -bf ${{github.workspace}}/build
else
export CMAKE_PREFIX_PATH=${{github.workspace}}/cppflow/build:$CMAKE_PREFIX_PATH
##export CMAKE_PREFIX_PATH=${{github.workspace}}/fftw-3.3.10/build/lib/cmake:$CMAKE_PREFIX_PATH
#export CMAKE_PREFIX_PATH=${{github.workspace}}/fftw-3.3.10/build:$CMAKE_PREFIX_PATH
#export CMAKE_PREFIX_PATH=${{github.workspace}}/Catch2/build/lib/cmake:$CMAKE_PREFIX_PATH
##export CMAKE_PREFIX_PATH=${{github.workspace}}/sopt/build:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=${{github.workspace}}/build:$CMAKE_PREFIX_PATH
cd ${{github.workspace}}/build
make -j$(nproc --ignore 1) install
fi
- name: Deploy to GH pages
if: ${{github.event_name == 'push'}}
uses: JamesIves/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v3

# Check code meets Google C++ style guide https://google.github.io/styleguide/cppguide.html
# Check code meets Google C++ style guide https://google.github.io/styleguide/cppguide.html
- name: Run linting
uses: DoozyX/[email protected]
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ ipython-*.log
*.png
*.pdf
*~
local
CMakeUserPresets.json
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ project(Purify C CXX)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_files)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/build)

# Downloads and installs GreatCMakeCookOff
# It contains a number of cmake recipes
include(LookUp-GreatCMakeCookOff)

option(tests "Enable testing" on)
option(examples "Compile examples" off)
option(benchmarks "Enable benchmarking" off)
Expand All @@ -23,7 +19,7 @@ option(coverage "Build coverage" off)
option(cppflow "Build with TensorFlow interface" off)

if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Relese' as none was specified.")
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE)
endif()
message(STATUS "Building purify in ${CMAKE_BUILD_TYPE} mode")
Expand Down Expand Up @@ -58,10 +54,12 @@ endif()

if(tests) # Adds ctest
enable_testing()
find_package(Catch)
find_package(Catch2)
include(AddCatchTest)
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument")

if(tests AND coverage)
# Enable code coverage.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
Expand Down
Loading

0 comments on commit 63a1955

Please sign in to comment.