@@ -63,6 +63,10 @@ SHARED=$(if $(findstring $(OS),linux freebsd dragonflybsd),1,)
63
63
64
64
LINKDL =$(if $(findstring $(OS ) ,linux) ,-L-ldl,)
65
65
66
+ # link shared libraries and test runner executables against the C++ runtime library,
67
+ # for the core.stdcpp.* bindings
68
+ LINKCXX =$(if $(findstring $(OS ) ,osx) ,-L-lc++,-L-lstdc++)
69
+
66
70
MAKEFILE = $(firstword $(MAKEFILE_LIST ) )
67
71
68
72
DDOCFLAGS=-conf = -c -w -o- -Isrc -Iimport -version=CoreDdoc
@@ -245,7 +249,7 @@ $(DRUNTIMESO) $(DRUNTIMESOLIB) dll: DFLAGS+=-version=Shared -fPIC
245
249
dll : $(DRUNTIMESOLIB )
246
250
247
251
$(DRUNTIMESO ) : $(OBJS ) $(SRCS ) $(DMD )
248
- $(DMD ) -shared -debuglib= -defaultlib= -of$(DRUNTIMESO ) $(DFLAGS ) $(SRCS ) $(OBJS ) $(LINKDL ) -L-lpthread -L-lm
252
+ $(DMD ) -shared -debuglib= -defaultlib= -of$(DRUNTIMESO ) $(DFLAGS ) $(SRCS ) $(OBJS ) $(LINKDL ) $( LINKCXX ) -L-lpthread -L-lm
249
253
250
254
$(DRUNTIMESOLIB ) : $(OBJS ) $(SRCS ) $(DMD )
251
255
$(DMD ) -c -fPIC -of$(DRUNTIMESOOBJ ) $(DFLAGS ) $(SRCS )
@@ -296,15 +300,15 @@ $(addprefix $(ROOT)/unittest/,$(DISABLED_TESTS)) :
296
300
ifeq (,$(SHARED ) )
297
301
298
302
$(ROOT ) /unittest/test_runner : $(OBJS ) $(SRCS ) src/test_runner.d $(DMD )
299
- $(DMD ) $(UDFLAGS ) $(UTFLAGS ) -of$@ src/test_runner.d $(SRCS ) $(OBJS ) -debuglib= -defaultlib= -L-lpthread -L-lm
303
+ $(DMD ) $(UDFLAGS ) $(UTFLAGS ) -of$@ src/test_runner.d $(SRCS ) $(OBJS ) -debuglib= -defaultlib= $( LINKCXX ) -L-lpthread -L-lm
300
304
301
305
else
302
306
303
307
UT_DRUNTIME: =$(ROOT ) /unittest/libdruntime-ut$(DOTDLL )
304
308
305
309
$(UT_DRUNTIME ) : UDFLAGS+=-version=Shared -fPIC
306
310
$(UT_DRUNTIME ) : $(OBJS ) $(SRCS ) $(DMD )
307
- $(DMD ) $(UDFLAGS ) -shared $(UTFLAGS ) -of$@ $(SRCS ) $(OBJS ) $(LINKDL ) -debuglib= -defaultlib= -L-lpthread -L-lm
311
+ $(DMD ) $(UDFLAGS ) -shared $(UTFLAGS ) -of$@ $(SRCS ) $(OBJS ) $(LINKDL ) -debuglib= -defaultlib= $( LINKCXX ) -L-lpthread -L-lm
308
312
309
313
$(ROOT ) /unittest/test_runner : $(UT_DRUNTIME ) src/test_runner.d $(DMD )
310
314
$(DMD ) $(UDFLAGS ) -of$@ src/test_runner.d -L$(UT_DRUNTIME ) -debuglib= -defaultlib= -L-lpthread -L-lm
0 commit comments