Skip to content

fix compilation on macOS #171

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

Merged
merged 4 commits into from
Nov 24, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 16 additions & 8 deletions Makefile.macosx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
# 3. Removed fsk_fast_filter.h from atest receipe, clang compiler was having
# a hissy fit. Not check with GCC.

# Where should we install it?
# Looks for libraries and includes, default is Homebrew
INSTALLDIR := /usr/local

# To use Macports, uncomment this line
#INSTALLDIR := /opt/local

APPS := direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients atest log2gpx gen_packets ttcalc kissutil

all : $(APPS) direwolf.conf
Expand All @@ -44,7 +51,7 @@ ifeq (${DARWIN_CC},)
DARWIN_CC := $(shell which gcc)
EXTRA_CFLAGS :=
else
EXTRA_CFLAGS := -fvectorize -fslp-vectorize -fslp-vectorize-aggressive -pthread
EXTRA_CFLAGS := -fvectorize -fslp-vectorize -pthread
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang has deprecated this flag

endif

# Change as required in support of the available libraries
Expand Down Expand Up @@ -74,8 +81,9 @@ CFLAGS += -D_BSD_SOURCE
# get much better results by telling it we have at least a Pentium 3
# which hass the SSE instructions.

CFLAGS += -march=core2 -msse4.1 -std=gnu99
#CFLAGS += -march=core2 -msse4.1 -std=gnu99
#CFLAGS += -march=pentium3 -sse
CFLAGS += -march=native
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should i re-include -std=gnu99?



# Add -ffastmath in only if compiler version recognizes it.
Expand All @@ -90,19 +98,19 @@ endif
# Use PortAudio Library

# Force static linking of portaudio if the static library is available.
PA_LIB_STATIC := $(shell find /opt/local/lib -maxdepth 1 -type f -name "libportaudio.a")
PA_LIB_STATIC := $(shell find $(INSTALLDIR)/lib -maxdepth 1 -type f -name "libportaudio.a")
#$(info $$PA_LIB_STATIC is [${PA_LIB_STATIC}])
ifeq (${PA_LIB_STATIC},)
LDLIBS += -L/opt/local/lib -lportaudio
LDLIBS += -L$(INSTALLDIR)/lib -lportaudio
else
LDLIBS += /opt/local/lib/libportaudio.a
LDLIBS += $(INSTALLDIR)/lib/libportaudio.a
endif

# Include libraries portaudio requires.
LDLIBS += -framework CoreAudio -framework AudioUnit -framework AudioToolbox
LDLIBS += -framework Foundation -framework CoreServices

CFLAGS += -DUSE_PORTAUDIO -I/opt/local/include
CFLAGS += -DUSE_PORTAUDIO -I$(INSTALLDIR)/include

# Uncomment following lines to enable GPS interface & tracker function.
# Not available for MacOSX (as far as I know).
Expand All @@ -111,12 +119,12 @@ CFLAGS += -DUSE_PORTAUDIO -I/opt/local/include
# Well never mind, issue with Macports with 64bit libs ;-( leave the check in
# until (if ever) Macports fixes the issue.

#GPS_HEADER := $(shell find /opt/local/include -maxdepth 1 -type f -name "gps.h")
#GPS_HEADER := $(shell find $(INSTALLDIR)/include -maxdepth 1 -type f -name "gps.h")
#ifeq (${GPS_HEADER},)
#GPS_OBJS :=
#else
#CFLAGS += -DENABLE_GPSD
#LDLIBS += -L/opt/local/lib -lgps -lgpsd
#LDLIBS += -L$(INSTALLDIR)/lib -lgps -lgpsd
#GPS_OBJS := dwgps.o dwgpsnmea.o dwgpsd.o
#endif

Expand Down
1 change: 1 addition & 0 deletions search_sdks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ if [ ! -z "$selected_sdk" ]; then

# Remove the "u" if 10.4u Universal SDK is used.
min_str="${min_str%%u}"
min_str="${min_str:-10.14}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some safety net


system_sdk="-isystem ${selected_sdk} -mmacosx-version-min=${min_str}"
else
Expand Down