changeset 50:b4657c63bab4

- Windows build fixes
author tomwalters
date Thu, 22 Jul 2010 01:19:52 +0000
parents 0cd20c748308
children 978fb645eb0f
files SConstruct
diffstat 1 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/SConstruct	Sun Jul 11 03:46:06 2010 +0000
+++ b/SConstruct	Thu Jul 22 01:19:52 2010 +0000
@@ -28,6 +28,9 @@
 import os
 import shutil
 
+# Location of libsndfile on Windows
+windows_libsndfile_location = "C:\\Program Files\\Mega-Nerd\\libsndfile\\"
+
 # Sources common to every version
 common_sources = ['Support/Common.cc',
                   'Support/FileList.cc',
@@ -153,10 +156,29 @@
 # Dependencies
 deplibs = ['sndfile']
 
-for depname in deplibs:
-  env.ParseConfig('pkg-config --cflags --libs ' + depname)
+if target_platform != 'win32':
+  for depname in deplibs:
+    env.ParseConfig('pkg-config --cflags --libs ' + depname)
+  env.AppendUnique(LIBS = deplibs)
+else:
+  #env.AppendUnique(LIBS = ['wsock32', 'winmm'])
+  if 'sndfile' in deplibs:
+    ###### libsndfile ########################################
+    # This one is only valid for win32 and already precompiled
+    # Only need to create .lib file from .def
+    shutil.copyfile(windows_libsndfile_location + '/libsndfile-1.dll',
+                    build_dir+'/libsndfile-1.dll')
+    if compiler=='msvc':
+      shutil.copyfile(windows_libsndfile_location + '/libsndfile-1.def',
+                      build_dir+'/libsndfile-1.def')
+      env.Command(build_dir + '/libsndfile.lib', build_dir + '/libsndfile.def',
+                  env['AR'] + ' /nologo /machine:i386 /def:$SOURCE /out:$TARGET')
+      env.Append(CPPPATH = [windows_libsndfile_location])
+      env.AppendUnique(LIBPATH = [build_dir])
+      # Replace 'sndfile' with 'sndfile-1'
+      deplibs.remove('sndfile')
+      deplibs.append('sndfile-1')
 
-env.AppendUnique(LIBS = deplibs)
 
 
 # Builder for the main program