@@ -8,9 +8,6 @@ Import('env')
88flagnames = 'CFLAGS CXXFLAGS LDFLAGS' .split ()
99env .MergeFlags ([os .environ .get (n , '' ) for n in flagnames ])
1010
11- # The directory of this SConscript should be searched first for any headers.
12- env .PrependUnique (CPPPATH = Dir ('.' ))
13-
1411# Insert LIBRARY_PATH explicitly because some compilers
1512# ignore it in the system environment.
1613env .PrependUnique (LIBPATH = env ['ENV' ].get ('LIBRARY_PATH' , '' ).split (':' ))
@@ -24,11 +21,6 @@ if env['tool'] == 'intelc':
2421 Exit (1 )
2522 env .Tool ('intelc' , topdir = icpc [:icpc .rfind ('/bin' )])
2623
27- # Declare external libraries.
28- env .ParseConfig ("gsl-config --cflags --libs" )
29- # dladdr in runtimepath.cpp requires the dl library.
30- env .AppendUnique (LIBS = ['dl' ])
31-
3224fast_linkflags = ['-s' ]
3325
3426# Platform specific intricacies.
@@ -90,6 +82,10 @@ if build_tests and env['test_installed']:
9082 SConscript ('tests/SConscript' )
9183 Return ()
9284
85+ # Here we do not test the installed library. Any diffpy headers
86+ # should thus be looked up from our source tree.
87+ env .PrependUnique (CPPPATH = Dir ('.' ))
88+
9389# Load the version script first to resolve the majorminor tuple
9490SConscript ('diffpy/SConscript.version' )
9591
@@ -110,7 +106,15 @@ if 'sdist' in COMMAND_LINE_TARGETS:
110106# Top Level Targets ----------------------------------------------------------
111107
112108# lib -- shared library object
113- libdiffpy = env .SharedLibrary ('diffpy' , env ['lib_sources' ])
109+
110+ # use new environment with extra libraries needed for libdiffpy.
111+ env_lib = env .Clone ()
112+ # Setup GSL, the GNU Scientific library.
113+ env_lib .ParseConfig ("gsl-config --cflags --libs" )
114+ # The dladdr call in runtimepath.cpp requires the dl library.
115+ env_lib .AppendUnique (LIBS = ['dl' ])
116+
117+ libdiffpy = env_lib .SharedLibrary ('diffpy' , env ['lib_sources' ])
114118Export ('libdiffpy' )
115119lib = Alias ('lib' , [libdiffpy , env ['lib_includes' ]])
116120Default (lib )
0 commit comments