Expand Makefile build to support MacOS#221
Conversation
913335e to
eaa3e7c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #221 +/- ##
=======================================
Coverage 99.89% 99.89%
=======================================
Files 24 24
Lines 4690 4690
Branches 878 878
=======================================
Hits 4685 4685
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
a5d0e9c to
8e75ba2
Compare
|
It's OK to drop |
8e75ba2 to
758fa17
Compare
|
Ok! I'll get back at this after lunch haha |
|
Looks pretty promising so far. Nice quick work! I'm impressed. ;-) |
|
By the way, I went into the config and explicitly set the |
|
I suggest to put l.65 in the SHARED_TARGETS += $(LIB)/libsolsys2.$(SOEXT)inside a nested conditional, probably for Darwin (because I think it another Mac OS quirk). E.g.: ifneq ($(BUILTIN_SOLSYS2),1)
SOLSYS_TARGETS += $(OBJ)/solsys2.o
# Don't build solsys2 shared lib on Mac OS -- it does not like mystery symbols.
ifneq ($(shell uname -s),Darwin)
SHARED_TARGETS += $(LIB)/libsolsys2.$(SOEXT)
endif
endif |
The point is that when It looks like that for the Mac OS build you don't want to deal with |
758fa17 to
cdcc6cd
Compare
|
Makes sense! Boy do I love platform-specific quirks. |
cdcc6cd to
3fa61e0
Compare
|
sigh mac's |
of course.... |
3fa61e0 to
457a7f8
Compare
|
Oops I broke in install ci |
457a7f8 to
bc7d629
Compare
|
It looks like the I think you want to add that to $(LIB)/libsolsys%.so.$(SO_VERSION): | $(LIB) $(LIB)/libsupernovas.so
$(CC) -o $@ $(SOFLAGS) -L$(LIB) -lsupernovas $(SHLIBS)You probaly need an |
fb2f99d to
02f5784
Compare
a82557d to
ca6f91e
Compare
|
Alright @attipaci give this a look. I'm not super satisfied with checking the platform in three places, but I couldn't figure out a pattern to make it work right once. |
|
I'm drafting up a CMake alternative too - just to sus it out a bit. |
|
Thanks for all the effort. I'll look at it tomorrow, and see if I have any further ideas for improvement... |
attipaci
left a comment
There was a problem hiding this comment.
Kiran, thanks for all the work you put into it. It looks pretty good. I just have a few minor comments. Take them lightly, and ignore them if you don't agree. ;-)
| $(LIB)/libsolsys%.$(SOEXT).$(SO_VERSION): | $(LIB) $(LIB)/libsupernovas.$(SOEXT).$(SO_VERSION) | ||
| ifeq ($(UNAME_S),Darwin) | ||
| $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $^ \ | ||
| -dynamiclib -fPIC \ |
There was a problem hiding this comment.
One thing we could try is to define SOFLAGS (or whatever) in config.mk e.g. as:
ifeq ($(UNAME_S),Darwin)
SOFLAGS = -dynamiclib -fPIC -Wl,-install_name,@rpath/$(notdir $@)
else
SOFLAGS = -shared -fPIC -Wl,-soname,$(notdir $@)
endifand then have a simple rule here (and elsewhere as):
/libsolsys%.$(SOEXT).$(SO_VERSION): | $(LIB) $(LIB)/libsupernovas.$(SOEXT).$(SO_VERSION)
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $^ $(SOFLAGS) $(LIB)/libsupernovas.$(SOEXT).$(SO_VERSION) $(SHLIBS) $(LDFLAGS)I think the explicit specification of the libsupernovas.so to link against is a good idea regardless of whether it's MacOS or not. I'm not sure that the .$(SO_VERSION) is needed though when invoking libsupernovas. My guess is that part can be omitted...
Of course including the $@ in the SOFLAGS definition might not work but it's worth a try, and maybe there is something similar than can work even if it not exactly the same as proposed...
There was a problem hiding this comment.
Yeah I had a lot of problems with $@ not being in a specific recipe. I think I might have a solution, testing now.
| - os: ubuntu-latest | ||
| cc: gcc | ||
| - os: macos-latest | ||
| cc: clang |
There was a problem hiding this comment.
Apart from adding macos to the CI, I like the clang here for other reasons also. I was already thinking to add clang builds to the CI, so there it is. Done. Thanks! :-)
There was a problem hiding this comment.
It isn't fully matrix'ed though. I'ts only mapping gcc to ubuntu and clang to macos. We can add cc to the matrix to get all four combinations though!
1d0b547 to
f759c76
Compare
f759c76 to
915b7ce
Compare
|
Alright I've cleaned up the logic quite a bit and consolidated the platform-specifics in one place in |
|
It turns out that this broke the shared libs build for Linux packaging. A fix is at PR #226. Generally, one should not set
|
Fixes #220
.sowith an extension that dynamically is detected viaunameLD_LIBRARY_PATHwith one that dynamically changes toDYLD_LIBRARY_PATHfor mac-Din the installation section, as mac'sinstalldoesn't support it. I think this is ok because we precede them withinstall -d, which is supported.sedcalls to work cross-platform in tests