Commit 100aee28 authored by Jeremy L Thompson's avatar Jeremy L Thompson
Browse files

Merge branch 'jeremy/weak-fix' into 'main'

build - weak symbols fix for macos

See merge request !1321
parents 01e0717c c18e48c2
Loading
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -289,12 +289,12 @@ RATEL_LIB = -lratel
# Source files
# ------------------------------------------------------------

libratel.c  := $(filter-out src/internal/ratel-jit-source-root-$(if $(for_install),default,install).c %-ad-enzyme.c %-ad-adolc.c %-uhyper.c, $(sort $(shell find $(SRCDIR) -type f -name "*.c")))
libratel.c := $(sort $(filter-out $(SRCDIR)/internal/ratel-jit-source-root-$(if $(for_install),default,install).c %-ad-enzyme.c %-ad-adolc.c %-uhyper.c, $(shell find $(SRCDIR) -type f -name "*.c")))

# Enzyme-AD
ifneq ($(ENZYME_LIB),)
	CFLAGS     += $(ENZYMEFLAGS)
	libratel.c += $(sort $(wildcard $(SRCDIR)/**/*-ad-enzyme.c))
	libratel.c += $(sort $(wildcard $(SRCDIR)/materials/*-ad-enzyme.c))
endif

# ADOL-C
@@ -306,14 +306,14 @@ endif
ifneq ($(WITH_ADOLC),)
    LDLIBS       += -ladolc
    CXXFLAGS     += -fPIC
	libratel.c   += $(sort $(wildcard $(SRCDIR)/**/*-ad-adolc.c))
	libratel.cpp += $(sort $(wildcard $(SRCDIR)/**/*-ad-adolc-cpp.cpp))
	libratel.c   += $(sort $(wildcard $(SRCDIR)/materials/*-ad-adolc.c))
	libratel.cpp += $(sort $(wildcard $(SRCDIR)/materials/*-ad-adolc-cpp.cpp))
endif

# UHyper
ifneq ($(FC),)
  libratel.c   += $(wildcard src/materials/*-uhyper.c)
  libratel.for := $(wildcard src/materials/*_uhyper.for)
  libratel.c   += $(sort $(wildcard $(SRCDIR)/materials/*-uhyper.c))
  libratel.for := $(sort $(wildcard $(SRCDIR)/materials/*_uhyper.for))
endif

# Tests
@@ -365,7 +365,7 @@ $(libratel.o) : | info-basic
$(libratel.so) : $(call weak_last,$(libratel.o)) | $$(@D)/.DIR
	$(call quiet,LINK) $(LDFLAGS) -shared -o $@ $^ $(LDLIBS)

$(libratel.a)  : $(libratel.o) | $$(@D)/.DIR
$(libratel.a)  : $(call weak_last,$(libratel.o)) | $$(@D)/.DIR
	$(call quiet,AR) $(ARFLAGS) $@ $^

$(OBJDIR)/%.o : $(CURDIR)/%.c | $$(@D)/.DIR
+11 −0
Original line number Diff line number Diff line
// This header does not have guards because it is included multiple times.
// The RATEL_MODEL macro is used to to call each registration function in the order listed in `ratel-model.c`.
// This is also used to create weakly linked registration functions in `ratel-model-*-weak.c'.

// LCOV_EXCL_START

// Elasticity
RATEL_MODEL("elasticity-neo-hookean-current-ad-adolc", ElasticityNeoHookeanCurrentAD_ADOLC)
RATEL_MODEL("elasticity-neo-hookean-initial-ad-adolc", ElasticityNeoHookeanInitialAD_ADOLC)

// LCOV_EXCL_STOP
+15 −0
Original line number Diff line number Diff line
// This header does not have guards because it is included multiple times.
// The RATEL_MODEL macro is used to to call each registration function in the order listed in `ratel-model.c`.
// This is also used to create weakly linked registration functions in `ratel-model-*-weak.c'.

// LCOV_EXCL_START

// Elasticity
RATEL_MODEL("elasticity-neo-hookean-current-ad-enzyme", ElasticityNeoHookeanCurrentAD_Enzyme)
RATEL_MODEL("elasticity-neo-hookean-initial-ad-enzyme", ElasticityNeoHookeanInitialAD_Enzyme)
RATEL_MODEL("elasticity-isochoric-ogden-current-ad-enzyme", ElasticityIsochoricOgdenCurrentAD_Enzyme)

// Plasticity
RATEL_MODEL("plasticity-hencky-current-additive-ad-enzyme", PlasticityHenckyCurrentAdditiveAD_Enzyme)

// LCOV_EXCL_STOP
+10 −0
Original line number Diff line number Diff line
// This header does not have guards because it is included multiple times.
// The RATEL_MODEL macro is used to to call each registration function in the order listed in `ratel-model.c`.
// This is also used to create weakly linked registration functions in `ratel-model-*-weak.c'.

// LCOV_EXCL_START

// Elasticity
RATEL_MODEL("elasticity-uhyper", ElasticityUHyper)

// LCOV_EXCL_STOP
+13 −11
Original line number Diff line number Diff line
// List each model registration function once here.
// The RATEL_MODEL macro is used to to call each registration function in the order listed in `ratel-model.c`.
// Also, the macro creates weak symbols in `ratel-model-weak.c` for each material model.
//
// If the model requires special dependencies, then list the model in a separate header for that dependency.
// For example, models relying upon Enzyme are in the header `ratel-model-list-enzyme.h`.
//
// The macro takes two arguments:
// RATEL_MODEL("command-line-argument", ModelSuffix)
// The command line argument to select the material model is given by `command-line-argument`.
// The source file `material-model.c` must define `RatelMaterialCreate_ModelSuffix` and `RatelRegisterModel_ModelSuffix`.
// Inside of `RatelRegisterModel_ModelSuffix`, use the RATEL_MODEL_REGISTER macro.
//
// This header does not have guards because it may be included multiple times.

#include <ratel.h>
// Enzyme
#include "ratel-model-list-enzyme.h"

// ADOL-C
#include "ratel-model-list-adolc.h"

// UHyper
#include "ratel-model-list-uhyper.h"

// LCOV_EXCL_START

@@ -23,11 +34,7 @@ RATEL_MODEL("elasticity-linear", ElasticityLinear)
RATEL_MODEL("elasticity-mixed-linear", ElasticityMixedLinear)
RATEL_MODEL("elasticity-neo-hookean-current", ElasticityNeoHookeanCurrent)
RATEL_MODEL("elasticity-neo-hookean-shock-scalar-current", ElasticityNeoHookeanShockScalarCurrent)
RATEL_MODEL("elasticity-neo-hookean-current-ad-enzyme", ElasticityNeoHookeanCurrentAD_Enzyme)
RATEL_MODEL("elasticity-neo-hookean-current-ad-adolc", ElasticityNeoHookeanCurrentAD_ADOLC)
RATEL_MODEL("elasticity-neo-hookean-initial", ElasticityNeoHookeanInitial)
RATEL_MODEL("elasticity-neo-hookean-initial-ad-enzyme", ElasticityNeoHookeanInitialAD_Enzyme)
RATEL_MODEL("elasticity-neo-hookean-initial-ad-adolc", ElasticityNeoHookeanInitialAD_ADOLC)
RATEL_MODEL("elasticity-mooney-rivlin-initial", ElasticityMooneyRivlinInitial)
RATEL_MODEL("elasticity-mooney-rivlin-current", ElasticityMooneyRivlinCurrent)
RATEL_MODEL("elasticity-isochoric-neo-hookean-initial", ElasticityIsochoricNeoHookeanInitial)
@@ -36,7 +43,6 @@ RATEL_MODEL("elasticity-isochoric-mooney-rivlin-initial", ElasticityIsochoricMoo
RATEL_MODEL("elasticity-isochoric-mooney-rivlin-current", ElasticityIsochoricMooneyRivlinCurrent)
RATEL_MODEL("elasticity-isochoric-ogden-initial", ElasticityIsochoricOgdenInitial)
RATEL_MODEL("elasticity-isochoric-ogden-current", ElasticityIsochoricOgdenCurrent)
RATEL_MODEL("elasticity-isochoric-ogden-current-ad-enzyme", ElasticityIsochoricOgdenCurrentAD_Enzyme)
RATEL_MODEL("elasticity-mixed-neo-hookean-initial", ElasticityMixedNeoHookeanInitial)
RATEL_MODEL("elasticity-mixed-neo-hookean-current", ElasticityMixedNeoHookeanCurrent)
RATEL_MODEL("elasticity-mixed-neo-hookean-PL-initial", ElasticityMixedNeoHookeanPLInitial)
@@ -55,7 +61,6 @@ RATEL_MODEL("plasticity-linear", PlasticityLinear)
RATEL_MODEL("plasticity-hencky-initial", PlasticityHenckyInitial)
RATEL_MODEL("plasticity-hencky-current", PlasticityHenckyCurrent)
RATEL_MODEL("plasticity-hencky-current-additive", PlasticityHenckyCurrentAdditive)
RATEL_MODEL("plasticity-hencky-current-additive-ad-enzyme", PlasticityHenckyCurrentAdditiveAD_Enzyme)
RATEL_MODEL("plasticity-hencky-initial-principal", PlasticityHenckyInitialPrincipal)
RATEL_MODEL("plasticity-hencky-current-principal", PlasticityHenckyCurrentPrincipal)
RATEL_MODEL("plasticity-hencky-damage-initial-principal", PlasticityHenckyDamageInitialPrincipal)
@@ -82,7 +87,4 @@ RATEL_MODEL("viscoelasticity-hencky-current-principal", ViscoelasticityHenckyCur
RATEL_MODEL("viscoelasticity-hencky-damage-initial-principal", ViscoelasticityHenckyDamageInitialPrincipal)
RATEL_MODEL("viscoelasticity-hencky-damage-current-principal", ViscoelasticityHenckyDamageCurrentPrincipal)

// UHyper
RATEL_MODEL("elasticity-uhyper", ElasticityUHyper)

// LCOV_EXCL_STOP
Loading