Skip to content

Commit

Permalink
Convert HelFEM to use new libcxxwrap / libjulia
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Jan 5, 2021
1 parent 62590d6 commit ffbe326
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions H/HelFEM/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using BinaryBuilder, Pkg

julia_version = v"1.5.3"

name = "HelFEM"
version = v"0.0.3"
version = v"0.1.5"
sources = [
GitSource("https://github.com/mortenpi/HelFEM.git", "a4d3b2e6f16f7f7953afd5f69a44257a65c5b131")
]
Expand All @@ -20,20 +22,16 @@ else
OPENBLAS="${libdir}/libopenblas.${dlext}"
fi
# On i686, it seems that we need to explicitly tell GCC that we want SSE2. Refs:
# https://github.com/JuliaLang/julia/blob/v1.4.1/src/atomics.h#L8-L10
# https://stackoverflow.com/questions/16410149/error-sse2-instruction-set-not-enabled-when-including-emmintrin-h
if [[ "${target}" == i686* ]]; then
export CXXFLAGS="-msse -msse2"
fi
# Compile libhelfem as a static library
cd ${WORKSPACE}/srcdir/HelFEM/
cmake \
-DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DHELFEM_BINARIES=OFF \
-DHELFEM_FIND_DEPS=ON \
-DUSE_OPENMP=OFF \
-DHELFEM_BINARIES=OFF -DHELFEM_FIND_DEPS=ON \
-B build/ -S .
make -C build/ -j${nproc} helfem
make -C build/ install
Expand All @@ -43,37 +41,35 @@ install_license LICENSE
# Compile the CxxWrap wrapper as a shared library
cd ${WORKSPACE}/srcdir/HelFEM/julia
cmake \
-DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} -DCMAKE_BUILD_TYPE=Release \
-DBLAS_LIBRARIES=${OPENBLAS} \
-DJulia_PREFIX=$prefix -DCMAKE_FIND_ROOT_PATH=$prefix -DJlCxx_DIR=$prefix/lib/cmake/JlCxx \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_ROOT_PATH=${prefix} \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DJulia_PREFIX=${prefix} \
-B build/ -S .
make -C build/ -j${nproc}
make -C build/ install
"""

# These are the platforms the libcxxwrap_julia_jll is built on.
platforms = [
Platform("x86_64", "linux"; libc="glibc", cxxstring_abi = "cxx11"),
Platform("i686", "linux"; libc="glibc", cxxstring_abi = "cxx11"),
Platform("armv7l", "linux"; libc="glibc", cxxstring_abi = "cxx11"),
Platform("aarch64", "linux"; libc="glibc", cxxstring_abi = "cxx11"),
Platform("x86_64", "macos"),
Platform("x86_64", "windows"; cxxstring_abi = "cxx11"),
Platform("i686", "windows"; cxxstring_abi = "cxx11"),
Platform("x86_64", "freebsd"),
]
include("../../L/libjulia/common.jl")
platforms = libjulia_platforms(julia_version)
platforms = expand_cxxstring_abis(platforms)

products = [
LibraryProduct("libhelfem-cxxwrap", :libhelfem),
]

dependencies = [
BuildDependency(PackageSpec(name = "Julia_jll", version = "1.4.1")),
Dependency(PackageSpec(name = "libcxxwrap_julia_jll", version = "0.8.0")),
BuildDependency(PackageSpec(name="libjulia_jll", version=julia_version)),
Dependency("libcxxwrap_julia_jll"),
Dependency(PackageSpec(name = "armadillo_jll", version = "9.850.1")),
Dependency(PackageSpec(name = "GSL_jll", version = "2.6.0")),
Dependency(PackageSpec(name = "OpenBLAS_jll", version = "0.3.9")),
]

# preferred_gcc_version = v"7" is a requirement from libcxxwrap_julia_jll
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version = v"7")
# preferred_gcc_version = v"8" is a requirement from libcxxwrap_julia_jll
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
preferred_gcc_version=v"8",
julia_compat = "$(julia_version.major).$(julia_version.minor)")

0 comments on commit ffbe326

Please sign in to comment.