Skip to content

Commit

Permalink
test - compile QF with extra include dir
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Oct 16, 2024
1 parent 6e11647 commit 8b077cc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ $(OBJDIR)/%.o : $(CURDIR)/%.sycl.cpp | $$(@D)/.DIR
$(call quiet,SYCLCXX) $(SYCLFLAGS) $(CPPFLAGS) -c -o $@ $(abspath $<)

$(OBJDIR)/%$(EXE_SUFFIX) : tests/%.c | $$(@D)/.DIR
$(call quiet,LINK.c) $(CEED_LDFLAGS) -o $@ $(abspath $<) $(CEED_LIBS) $(CEED_LDLIBS) $(LDLIBS)
$(call quiet,LINK.c) $(CEED_LDFLAGS) -o $@ $(abspath $<) $(CEED_LIBS) $(CEED_LDLIBS) $(LDLIBS) -I./tests/test-include

$(OBJDIR)/%$(EXE_SUFFIX) : tests/%.f90 | $$(@D)/.DIR
$(call quiet,LINK.F) -DSOURCE_DIR='"$(abspath $(<D))/"' $(CEED_LDFLAGS) -o $@ $(abspath $<) $(CEED_LIBS) $(CEED_LDLIBS) $(LDLIBS)
Expand Down
7 changes: 5 additions & 2 deletions tests/t406-qfunction-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// Test include path with "/./"
#include "./t406-qfunction-scales.h"

CEED_QFUNCTION_HELPER CeedScalar times_two(CeedScalar x) { return SCALE_TWO * x; }
// Test include via -I....
#include <fake-sys-include.h>

CEED_QFUNCTION_HELPER CeedScalar times_three(CeedScalar x) { return SCALE_THREE * x; }
CEED_QFUNCTION_HELPER CeedScalar times_two(CeedScalar x) { return FAKE_SYS_SCALE_ONE * SCALE_TWO * x; }

CEED_QFUNCTION_HELPER CeedScalar times_three(CeedScalar x) { return FAKE_SYS_SCALE_ONE * SCALE_THREE * x; }
7 changes: 7 additions & 0 deletions tests/t406-qfunction.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ int main(int argc, char **argv) {
CeedScalar v_true[q];

CeedInit(argv[1], &ceed);
{
char file_path[2056] = __FILE__;
char *last_slash = strrchr(file_path, '/');

memcpy(&file_path[last_slash - file_path], "/test-include/", 15);
CeedAddJitSourceRoot(ceed, file_path);
}

CeedVectorCreate(ceed, q, &w);
CeedVectorCreate(ceed, q, &u);
Expand Down
1 change: 1 addition & 0 deletions tests/test-include/fake-sys-include.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define FAKE_SYS_SCALE_ONE 1

0 comments on commit 8b077cc

Please sign in to comment.