Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
43 changes: 43 additions & 0 deletions T/TopOpt_in_PETSc/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "TopOpt_in_PETSc"
version = v"0.1"

# Collection of sources required to complete build
sources = [
GitSource("https://github.com/topopt/TopOpt_in_PETSc", "26eecbf3b1d0135956e0364d77c30e43e9bc3db2"),
DirectorySource("./bundled"),
]

# Bash recipe for building across all platforms
# New makefiles added, the patches fix some weird include issues mostly.
# There is likely a better way to fix them, or upstream the fixes.
script = raw"""
cd TopOpt_in_PETSc
make -f ../Makefile libtopopt.${dlext} topopt${exeext}
install -Dvm 755 "topopt${exeext}" "${bindir}/topopt${exeext}"
install -Dvm 755 "libtopopt.${dlext}" "${libdir}/libtopopt.${dlext}"
install_license lesser.txt
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_cxxstring_abis(expand_gfortran_versions(supported_platforms(exclude=[Platform("i686", "windows")])))


# The products that we will ensure are always built
products = [
LibraryProduct("libtopopt", :libtopopt),
ExecutableProduct("topopt", :topopt)
]

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency("PETSc_jll"; compat="3.16.5"),
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"))
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"9")
20 changes: 20 additions & 0 deletions T/TopOpt_in_PETSc/bundled/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
PETSC_DIR = $(libdir)/petsc/double_real_Int32
PETSC_ARCH = x86_64-linux-gnu_double_real_Int32
CXXFLAGS = -fPIC
CPPFLAGS =-I. -I$(includedir) -I$(PETSC_DIR)/include -I$(PETSC_DIR)/
LDFLAGS = -L${libdir} -Wl,-rpath,${libdir}/petsc/double_real_Int32/lib -L${libdir}/petsc/double_real_Int32/lib
LDLIBS = -lpetsc_double_real_Int32
ifneq (,$(findstring mingw,$(target)))
LDLIBS += -lmsmpi
else
LDLIBS += -lmpi
endif

topopt$(exeext): main.o TopOpt.o LinearElasticity.o MMA.o Filter.o PDEFilter.o MPIIO.o
$(CXX) $(CPPFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)

libtopopt.$(dlext): TopOpt.o LinearElasticity.o MMA.o Filter.o PDEFilter.o MPIIO.o
$(CXX) $(CPPFLAGS) -shared -o $@ $^ $(LDFLAGS) $(LDLIBS)

clean:
rm -rf topopt$(exeext) libtopopt.$(dlext) *.o output* binary* log* makevtu.pyc Restart*
14 changes: 14 additions & 0 deletions T/TopOpt_in_PETSc/bundled/patches/petsc_name_mangle.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/config/BuildSystem/config/packages/BlasLapack.py b/config/BuildSystem/config/packages/BlasLapack.py
index bbae50c096..9ad0a994eb 100644
--- a/config/BuildSystem/config/packages/BlasLapack.py
+++ b/config/BuildSystem/config/packages/BlasLapack.py
@@ -121,7 +121,8 @@ class Configure(config.package.Package):
foundLapack = 0
self.f2c = 0
# allow a user-specified suffix to be appended to BLAS/LAPACK symbols
- self.suffix = self.argDB.get('with-blaslapack-suffix', '')
+ # argDB return a list when with-blaslapack-suffix is used
+ self.suffix = self.argDB.get('with-blaslapack-suffix', '')[0]
mangleFunc = self.compilers.fortranMangling
self.logPrint('Checking for Fortran name mangling '+mangleFunc+' on BLAS/LAPACK')
foundBlas = self.checkBlas(blasLibrary, self.getOtherLibs(foundBlas, blasLibrary), mangleFunc,'dot')