@@ -378,14 +378,14 @@ if installSetup.headers or installSetup.libraries:
378378 include_bsonh_test ,
379379 ])
380380
381- # Compile the example files to .o so that we can link them twice: once statically, once shared.
382- exampleObjMap = [(target , clientEnv .Object (source )) for (target , source ) in exampleSourceMap ]
383-
384381staticClientEnv = clientEnv .Clone ()
385382staticClientEnv .PrependUnique (LIBDEPS = [mongoClientStaticLib ])
383+ staticClientEnv .AppendUnique (CPPDEFINES = ['STATIC_LIBMONGOCLIENT' ])
386384
387385# Build each statically linked client program
388- staticClientPrograms = [staticClientEnv .Program (target , obj ) for (target , obj ) in exampleObjMap ]
386+ staticClientPrograms = [
387+ staticClientEnv .Program (target , source ) for (target , source ) in exampleSourceMap
388+ ]
389389
390390# Install them to the root, and append the install targets to the list of client tests
391391clientTests = staticClientEnv .Install ("#/" , staticClientPrograms )
@@ -402,6 +402,10 @@ if buildShared:
402402 LIBDEPS = mongoClientLibDeps ,
403403 )
404404
405+ # Pretend that these files are shared object suffixed so they don't conflict with the objects
406+ # for the static library.
407+ sharedClientEnv ['OBJSUFFIX' ] = sharedClientEnv ['OBJSUFFIX' ] + 's'
408+
405409 # Deal with the different lookup models between regular UNIX and Darwin. For regular unix,
406410 # we set $ORIGIN to pull the copy we run against from the current directory
407411 # (#/sharedclient). On Darwin, the staged copy of the mongoclient dylib in #sharedclient
@@ -412,13 +416,14 @@ if buildShared:
412416 RPATH = [sharedClientEnv .Literal ("\\ $$ORIGIN" )])
413417
414418 sharedClientPrograms = [
415- sharedClientEnv .Program ("sharedclient/" + target , obj ) for (target , obj ) in exampleObjMap ]
419+ sharedClientEnv .Program (
420+ "sharedclient/" + target , source ) for (target , source ) in exampleSourceMap ]
416421 libEnv .Depends (sharedClientPrograms , mongoClientInstalls )
417422
418423 sharedClientProgramInstalls = sharedClientEnv .Install ("#/sharedclient" , sharedClientPrograms )
419424 clientTests .extend (sharedClientProgramInstalls )
420425
421- clientEnv .Alias ('clientTests' , clientTests , [] )
426+ clientEnv .Alias ('clientTests' , clientTests )
422427
423428# NOTE: There must be a mongod listening on 127.0.0.1:27999 (the traditional mongodb smoke test
424429# port) for the smokeClient target to run. In the server repo that is no problem, the smoke.py
0 commit comments