-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: add tests for various MSYS2 environments #132
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic | ||
CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE | ||
|
||
# Set OBJCOPY if not defined by environment: | ||
OBJCOPY ?= objcopy | ||
|
@@ -56,6 +56,8 @@ ifdef OPENMP | |
CFLAGS += -fopenmp | ||
endif | ||
|
||
TARGET := $(shell $(CC) -dumpmachine) | ||
|
||
|
||
.PHONY: all analyze clean | ||
|
||
|
@@ -64,9 +66,16 @@ all: bin/base64 lib/libbase64.o | |
bin/base64: bin/base64.o lib/libbase64.o | ||
$(CC) $(CFLAGS) -o $@ $^ | ||
|
||
lib/libbase64.o: $(OBJS) | ||
$(LD) -r -o $@ $^ | ||
$(OBJCOPY) --keep-global-symbols=lib/exports.txt $@ | ||
lib/exports.build.txt: lib/exports.txt | ||
ifeq (i686-w64-mingw32, $(TARGET)) | ||
sed -e 's/^/_/' $< > $@ | ||
else | ||
cp -f $< $@ | ||
endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly I'm not a big fan of this compatibility block, though I understand why it's needed. In the longer term I think we should try to get rid of the exports file entirely and rely on compiler/linker features to mark functions as hidden or visible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean like annotating these symbols as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like this either but if we're to keep the current semantic, it's needed. I wouldn't mind if the makefile produced the same things as the CMake build does for a static library (just something like Another option is not to support makefile builds for Windows at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My idea for the future roadmap is basically to engineer the library such that all functions start with Until then, I suggest we keep going as usual, so using this Makefile hack/complication out of necessity. |
||
|
||
lib/libbase64.o: lib/exports.build.txt $(OBJS) | ||
$(LD) -r -o $@ $(OBJS) | ||
$(OBJCOPY) --keep-global-symbols=$< $@ | ||
|
||
lib/config.h: | ||
@echo "#define HAVE_AVX512 $(HAVE_AVX512)" > $@ | ||
|
@@ -97,4 +106,4 @@ analyze: clean | |
scan-build --use-analyzer=`which clang` --status-bugs make | ||
|
||
clean: | ||
rm -f bin/base64 bin/base64.o lib/libbase64.o lib/config.h $(OBJS) | ||
rm -f bin/base64 bin/base64.o lib/libbase64.o lib/config.h lib/exports.build.txt $(OBJS) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic | ||
CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE | ||
ifdef OPENMP | ||
CFLAGS += -fopenmp | ||
endif | ||
|
||
TARGET := $(shell $(CC) -dumpmachine) | ||
ifneq (, $(findstring darwin, $(TARGET))) | ||
BENCH_LDFLAGS= | ||
else ifneq (, $(findstring mingw, $(TARGET))) | ||
BENCH_LDFLAGS= | ||
else | ||
# default to linux, -lrt needed | ||
BENCH_LDFLAGS=-lrt | ||
|
@@ -15,7 +17,9 @@ endif | |
|
||
test: clean test_base64 benchmark | ||
./test_base64 | ||
ifeq (, $(findstring mingw, $(TARGET))) # no "/dev/urandom" on Windows | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a really old pull request, #6, which fixes this on Windows. Now that we have a provisional CI environment for Windows, I can try to revive that branch and see if I can get the benchmark to work. Having a working Windows benchmark would also be great for checking in CI that certain changes did not introduce speed regressions on that platform. |
||
./benchmark | ||
endif | ||
|
||
valgrind: clean test_base64 | ||
valgrind --error-exitcode=2 ./test_base64 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it support
-i
or--relocatable
? Both are synonyms of-r
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The feature is supported for ELF & Mach-O targets but not for Windows.