atrstm

Load and structure a combustion gas mixture
git clone git://git.meso-star.fr/atrstm.git
Log | Files | Refs | README | LICENSE

commit 995570d4274e35fcd716bc655f401104c0e10b86
parent 61814f27304b8d133b19bf6f85682e1ff7f9fd5f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu,  2 Nov 2023 11:44:46 +0100

Fix compilation with SIMD support

The SIMD instruction set is conditionally activated depending on the
presence or absence of the rsimd library (checked with pkg-config). If
enabled, the atrstm library must be compiled with the
atrstm_radcoef_simd4.c source, and the ATRSTM_USE_SIMD macro must be
defined. None of these conditions were met until this commit, which
resulted in a library that depended on rsimd but had no SIMD support.

Diffstat:
MMakefile | 15++++++++++++---
Mconfig.mk | 1+
2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -26,7 +26,7 @@ LIBNAME = $(LIBNAME_$(LIB_TYPE)) ################################################################################ # Library building ################################################################################ -SRC =\ +SRC_REGULAR =\ src/atrstm.c\ src/atrstm_cache.c\ src/atrstm_dump_svx_octree.c\ @@ -37,11 +37,20 @@ SRC =\ src/atrstm_setup_octrees.c\ src/atrstm_setup_uvm.c\ src/atrstm_svx.c +SRC_SIMD =\ + $(SRC_REGULAR)\ + src/atrstm_radcoefs_simd4.c +SRC = $(SRC_$(INSTRUCTION_SET)) OBJ = $(SRC:.c=.o) DEP = $(SRC:.c=.d) build_library: .config $(DEP) @$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done) \ + $$(if $(RSIMD_EXISTS); then \ + echo "INSTRUCTION_SET=SIMD"; \ + else \ + echo "INSTRUCTION_SET=REGULAR"; \ + fi) \ $$(if [ -n "$(LIBNAME)" ]; then \ echo "$(LIBNAME)"; \ else \ @@ -142,11 +151,11 @@ uninstall: all: build_library build_tests clean: clean_test - rm -f $(OBJ) $(TEST_OBJ) $(LIBNAME) + rm -f $(SRC_COMMON:.c=.o) $(SRC_SIMD:.c=.o) $(TEST_OBJ) $(LIBNAME) rm -f .config .test libatrstm.o atrstm.pc atrstm-local.pc distclean: clean - rm -f $(DEP) $(TEST_DEP) + rm -f $(SRC_COMMON:.c=.d) $(SRC_SIMD:.c=.d) $(TEST_DEP) lint: shellcheck -o all make.sh diff --git a/config.mk b/config.mk @@ -96,6 +96,7 @@ CFLAGS_COMMON =\ -pedantic\ -fvisibility=hidden\ -fstrict-aliasing\ + $$($(RSIMD_EXISTS) && echo "-DATRSTM_USE_SIMD")\ $(CFLAGS_HARDENED)\ $(WFLAGS)