Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build OSX with Cmake #18

Merged
merged 21 commits into from
Jan 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .ci_support/osx_python3.6.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
MACOSX_DEPLOYMENT_TARGET:
- '10.9'
boost_cpp:
- 1.70.0
bzip2:
- '1'
c_compiler:
- clang
c_compiler_version:
- '9'
channel_sources:
- conda-forge,defaults
channel_targets:
- conda-forge main
cxx_compiler:
- clangxx
cxx_compiler_version:
- '9'
fftw:
- '3'
fortran_compiler:
- gfortran
fortran_compiler_version:
- '7'
liblapack:
- 3.8.0 *netlib
libnetcdf:
- 4.7.3
macos_machine:
- x86_64-apple-darwin13.4.0
macos_min_version:
- '10.9'
netcdf_fortran:
- '4.5'
numpy:
- '1.14'
perl:
- 5.26.2
pin_run_as_build:
boost-cpp:
max_pin: x.x.x
bzip2:
max_pin: x
fftw:
max_pin: x
netcdf-fortran:
max_pin: x.x
perl:
max_pin: x.x.x
python:
min_pin: x.x
max_pin: x.x
readline:
max_pin: x
zlib:
max_pin: x.x
python:
- '3.6'
readline:
- '8.0'
zlib:
- '1.2'
62 changes: 62 additions & 0 deletions .ci_support/osx_python3.7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
MACOSX_DEPLOYMENT_TARGET:
- '10.9'
boost_cpp:
- 1.70.0
bzip2:
- '1'
c_compiler:
- clang
c_compiler_version:
- '9'
channel_sources:
- conda-forge,defaults
channel_targets:
- conda-forge main
cxx_compiler:
- clangxx
cxx_compiler_version:
- '9'
fftw:
- '3'
fortran_compiler:
- gfortran
fortran_compiler_version:
- '7'
liblapack:
- 3.8.0 *netlib
libnetcdf:
- 4.7.3
macos_machine:
- x86_64-apple-darwin13.4.0
macos_min_version:
- '10.9'
netcdf_fortran:
- '4.5'
numpy:
- '1.14'
perl:
- 5.26.2
pin_run_as_build:
boost-cpp:
max_pin: x.x.x
bzip2:
max_pin: x
fftw:
max_pin: x
netcdf-fortran:
max_pin: x.x
perl:
max_pin: x.x.x
python:
min_pin: x.x
max_pin: x.x
readline:
max_pin: x
zlib:
max_pin: x.x
python:
- '3.7'
readline:
- '8.0'
zlib:
- '1.2'
62 changes: 62 additions & 0 deletions .ci_support/osx_python3.8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
MACOSX_DEPLOYMENT_TARGET:
- '10.9'
boost_cpp:
- 1.70.0
bzip2:
- '1'
c_compiler:
- clang
c_compiler_version:
- '9'
channel_sources:
- conda-forge,defaults
channel_targets:
- conda-forge main
cxx_compiler:
- clangxx
cxx_compiler_version:
- '9'
fftw:
- '3'
fortran_compiler:
- gfortran
fortran_compiler_version:
- '7'
liblapack:
- 3.8.0 *netlib
libnetcdf:
- 4.7.3
macos_machine:
- x86_64-apple-darwin13.4.0
macos_min_version:
- '10.9'
netcdf_fortran:
- '4.5'
numpy:
- '1.14'
perl:
- 5.26.2
pin_run_as_build:
boost-cpp:
max_pin: x.x.x
bzip2:
max_pin: x
fftw:
max_pin: x
netcdf-fortran:
max_pin: x.x
perl:
max_pin: x.x.x
python:
min_pin: x.x
max_pin: x.x
readline:
max_pin: x
zlib:
max_pin: x.x
python:
- '3.8'
readline:
- '8.0'
zlib:
- '1.2'
27 changes: 21 additions & 6 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion azure-pipelines.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ perl -pi -e 's/\r$//g' ${SRC_DIR}/cmake/*.cmake
patch -p1 --ignore-whitespace -t -i amber19-fix-cmake.patch || true

CMAKE_FLAGS=""
BUILD_GUI="TRUE"
if [[ "$target_platform" == osx* ]]; then
CMAKE_FLAGS+=" -DCMAKE_OSX_SYSROOT=${CONDA_BUILD_SYSROOT}"
CMAKE_FLAGS+=" -DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}"
export FFLAGS="-isysroot ${CONDA_BUILD_SYSROOT} ${FFLAGS}"
BUILD_GUI="FALSE"
# Hack around https://github.com/conda-forge/gfortran_osx-64-feedstock/issues/11
# Taken from https://github.com/awvwgk/staged-recipes/tree/dftd4/recipes/dftd4
# See contents of fake-bin/cc1 for an explanation
export PATH="${PATH}:${RECIPE_DIR}/fake-bin"
fi

# Build AmberTools with cmake
Expand All @@ -27,7 +32,7 @@ cmake ${SRC_DIR} ${CMAKE_FLAGS} \
-DCOMPILER=MANUAL \
-DPYTHON_EXECUTABLE=${PYTHON} \
-DDOWNLOAD_MINICONDA=FALSE \
-DBUILD_GUI=TRUE \
-DBUILD_GUI=${BUILD_GUI} \
-DCHECK_UPDATES=FALSE

make && make install
Expand Down
26 changes: 26 additions & 0 deletions recipe/fake-bin/cc1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

###
# Taken from https://github.com/awvwgk/staged-recipes/tree/dftd4/recipes/dftd4
###

# Detecting flags from gfortran which is backed by clang fails with
# x86_64-apple-darwin13.4.0-gfortran: error trying to exec 'cc1': execvp: No such file or directory
# This comes from
# https://github.com/mesonbuild/meson/blob/61993f893bbdc2415155e28ee70e6ea806725e64/mesonbuild/environment.py#L668-L671
# which runs
# x86_64-apple-darwin13.4.0-gfortran -E -dM -
# Looking at the verbose output this is trying to run:
# cc1 -E -quiet -v -D__DYNAMIC__ - -fPIC -mmacosx-version-min=10.9 -mtune=generic -dM
# The -quiet argument must be removed from the arguments as this isn't supported by clang
# Adding this file to PATH hacks around these issues

# Already reported at: https://github.com/conda-forge/gfortran_osx-64-feedstock/issues/11

ARGS=()
for var in "$@"; do
# Ignore known bad arguments
[ "$var" != '-quiet' ] && ARGS+=("$var")
done

"$CC" "${ARGS[@]}"
19 changes: 10 additions & 9 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ source:
- patches/do_not_use_global_conda_prefix.patch
- patches/do_not_symlink_missing_ff12pol.patch
- patches/use_external_netcdf.patch
- patches/do_not_override_osx_deployment_target.patch # [osx]
# Fix weird bug described here:
# https://github.com/conda-forge/ambertools-feedstock/pull/11#issuecomment-570618741
- patches/delete_xdrfile_version.patch # [osx]
# The following patch was downloaded from this GH issue:
# https://github.com/Amber-MD/cmake-buildscripts/issues/131#issuecomment-561280272
# It needs to be applied manually in build.sh
# - patches/amber19-fix-cmake.patch

build:
number: 0
skip: True # [win or py2k or osx]
number: 1
skip: True # [win or py2k]

requirements:
build:
Expand Down Expand Up @@ -52,9 +56,8 @@ requirements:
- pthread-stubs
- fftw
- liblapack
- xorg-libxt
- xorg-libxext
- xorg-libx11
- xorg-libxt # [linux]
- xorg-libxext # [linux]
- readline
run:
- python
Expand All @@ -68,10 +71,8 @@ requirements:
- fftw
- libblas
- liblapack
- libopenblas
- xorg-libxt
- xorg-libxext
- xorg-libx11
- xorg-libxt # [linux]
- xorg-libxext # [linux]
- readline

test:
Expand Down
7 changes: 7 additions & 0 deletions recipe/patches/delete_xdrfile_version.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
diff --git a/AmberTools/src/cpptraj/src/xdrfile/VERSION b/AmberTools/src/cpptraj/src/xdrfile/VERSION
deleted file mode 100644
index 8926873d..00000000
--- a/AmberTools/src/cpptraj/src/xdrfile/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-Code is from MDTRAJ (https://github.com/mdtraj/mdtraj), commit aa1c91f3ab6b0f9e9f1d0c790d2b5bff7c83ece4
13 changes: 13 additions & 0 deletions recipe/patches/do_not_override_osx_deployment_target.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake
index 914eddbb..b2ed5cf5 100644
--- a/cmake/CompilerFlags.cmake
+++ b/cmake/CompilerFlags.cmake
@@ -215,7 +215,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STR
if(TARGET_OSX)
# on OS X, Python will link pytraj's extension modules to libc++, so cpptraj needs to use the same standard library
add_flags(CXX -stdlib=libc++)
- set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)
+ # set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)
endif()

if(OPENMP AND (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.7))