finish unfinished work at basing all install paths on the program name
[ardour.git] / libs / pbd / wscript
index 2f93887e624da004fffe0ddf618c12c5a9cfdefd..3e7b423fc74133728de701451b0ccf387f92a87c 100644 (file)
@@ -38,7 +38,6 @@ libpbd_sources = [
     'controllable.cc',
     'controllable_descriptor.cc',
     'clear_dir.cc',
-    'crossthread.cc',
     'cpus.cc',
     'debug.cc',
     'enumwriter.cc',
@@ -46,6 +45,7 @@ libpbd_sources = [
     'enums.cc',
     'epa.cc',
     'error.cc',
+    'ffs.cc',
     'file_manager.cc',
     'file_utils.cc',
     'fpu.cc',
@@ -58,6 +58,7 @@ libpbd_sources = [
     'openuri.cc',
     'pathexpand.cc',
     'pathscanner.cc',
+    'pbd.cc',
     'pool.cc',
     'property_list.cc',
     'pthread_utils.cc',
@@ -73,6 +74,7 @@ libpbd_sources = [
     'stateful.cc',
     'strreplace.cc',
     'strsplit.cc',
+    'system_exec.cc',
     'textreceiver.cc',
     'transmitter.cc',
     'undo.cc',
@@ -88,7 +90,7 @@ def options(opt):
 def configure(conf):
     conf.load('compiler_cxx')
     autowaf.build_version_files(path_prefix+'pbd/version.h', path_prefix+'version.cc',
-                    'libpbd', MAJOR, MINOR, MICRO)
+                    'libpbd', MAJOR, MINOR, MICRO, 'LIBPBD_API', 'pbd/libpbd_visibility.h')
     autowaf.configure(conf)
     autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
     autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
@@ -104,9 +106,14 @@ def configure(conf):
     # Boost headers
     autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
     autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
+    if conf.env['WINDOWS_VST_SUPPORT'] == True and Options.options.dist_target == 'mingw':
+        conf.check(compiler='cxx',
+                   lib='ole32',
+                   mandatory=True,
+                   uselib_store='OLE')
 
 def build(bld):
-    
+
     # Make signals_generated.h using signals.py
     bld(rule = 'python ${SRC} ${TGT}', source = 'pbd/signals.py', target = 'pbd/signals_generated.h')
 
@@ -114,14 +121,20 @@ def build(bld):
     if bld.is_defined ('INTERNAL_SHARED_LIBS'):
         print('BUILD SHARED LIB')
         obj              = bld.shlib(features = 'cxx cxxshlib', source=libpbd_sources)
+        obj.defines = [ 'LIBPBD_DLL_EXPORTS=1' ]
     else:
         print('BUILD STATIC LIB')
         obj              = bld.stlib(features = 'cxx cxxstlib', source=libpbd_sources)
         obj.cxxflags     = [ '-fPIC' ]
+        obj.cflags     = [ '-fPIC' ]
+        obj.defines      = []
 
     if bld.is_defined('DEBUG_RT_ALLOC'):
         obj.source += 'debug_rt_alloc.c'
 
+    if bld.env['build_target'] != 'mingw':
+        obj.source += [ 'crossthread.cc' ]
+
     obj.export_includes = ['.']
     obj.includes     = ['.']
     obj.name         = 'libpbd'
@@ -129,14 +142,19 @@ def build(bld):
     obj.uselib       = 'GLIBMM SIGCPP XML UUID SNDFILE GIOMM'
     if sys.platform == 'darwin':
         TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
-        obj.source += [ 'cocoa_open_uri.mm' ]
+        if 'cocoa_open_uri.mm' not in obj.source:
+            obj.source += [ 'cocoa_open_uri.mm' ]
         obj.uselib += ' OSX'
     obj.vnum         = LIBPBD_LIB_VERSION
-    obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
-    obj.defines     = ['PACKAGE="' + I18N_PACKAGE + '"']
+    obj.install_path = bld.env['LIBDIR']
+    obj.defines     += [ 'PACKAGE="' + I18N_PACKAGE + '"',
+                         ]
 
     if bld.env['build_target'] == 'x86_64':
         obj.defines += [ 'USE_X86_64_ASM' ]
+    if bld.env['build_target'] == 'mingw':
+        obj.source += [ 'windows_special_dirs.cc' ]
+        obj.uselib += ' OLE'
 
     if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
         # Unit tests
@@ -156,9 +174,8 @@ def build(bld):
         testobj.uselib       = 'CPPUNIT XML SNDFILE'
         testobj.use          = 'libpbd'
         testobj.name         = 'libpbd-tests'
-        if sys.platform != 'darwin':
+        if sys.platform != 'darwin' and bld.env['build_target'] != 'mingw':
             testobj.linkflags    = ['-lrt']
 
-
 def shutdown():
     autowaf.shutdown()