Various tweaks for Windows builds.
authorCarl Hetherington <cth@carlh.net>
Sat, 21 Jul 2012 21:45:18 +0000 (22:45 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 21 Jul 2012 21:45:18 +0000 (22:45 +0100)
asdcplib/src/KM_platform.h
asdcplib/src/KM_prng.cpp
asdcplib/src/wscript
src/metadata.cc
test/wscript
wscript

index 4216bc2faf2ccf4f8e04275016b13e40b18cc1aa..266c01aeb7fb441c900c9b31c7a18ba057b7c637 100644 (file)
@@ -51,10 +51,10 @@ WINUSERAPI
 LRESULT\r
 WINAPI\r
 SendMessage(\r
-    __in HWND hWnd,\r
-    __in UINT Msg,\r
-    __in WPARAM wParam,\r
-    __in LPARAM lParam)\r
+    HWND hWnd,\r
+    UINT Msg,\r
+    WPARAM wParam,\r
+    LPARAM lParam)\r
 {\r
        return SendMessageW(hWnd, Msg, wParam, lParam);\r
 }\r
@@ -64,10 +64,10 @@ WINUSERAPI
 LRESULT\r
 WINAPI\r
 SendMessage(\r
-    __in HWND hWnd,\r
-    __in UINT Msg,\r
-    __in WPARAM wParam,\r
-    __in LPARAM lParam)\r
+    HWND hWnd,\r
+    UINT Msg,\r
+    WPARAM wParam,\r
+    LPARAM lParam)\r
 {\r
        return SendMessageA(hWnd, Msg, wParam, lParam);\r
 }\r
index e7526da113fbfebf014f88470f9d971877b3a6a3..06b22d9182f4862c99abecf51f75a11c938335a1 100755 (executable)
@@ -141,11 +141,17 @@ public:
        memcpy(buf + gen_count, tmp, len - gen_count);
       }
 
+#ifdef LIBDCP_POSIX
     if (libdcp_test)
       {    
         for (unsigned int i = 0; i < len; ++i)
          buf[i] = rand_r(&m_libdcp_test_rng_state);
       }
+#endif
+
+#ifdef LIBDCP_WINDOWS
+    /* XXX */
+#endif
   }
 };
 
index 2d118aed9a72b6b9e90c90d86f630d849e7e7b64..a2756dfa81d087142f5b830e6e374f21455c6f4c 100644 (file)
@@ -1,16 +1,17 @@
 def configure(conf):
-    conf.check_cc(msg = 'Checking for library expat', header_name = 'tiffio.h', lib = 'expat', uselib_store = 'EXPAT', mandatory = True)
-    conf.env.append_value('CXXFLAGS', '-DHAVE_EXPAT')
     conf.env.append_value('CXXFLAGS', '-D_FILE_OFFSET_BITS=64')
     conf.env.append_value('CXXFLAGS', '-DPACKAGE_VERSION="1.9.45-dvdomatic"')
-    # XXX: ?
-    conf.env.append_value('CXXFLAGS', '-DASDCP_PLATFORM="linux"')
+    if conf.options.target_windows:
+        conf.env.append_value('CXXFLAGS', '-DASDCP_PLATFORM="win32"')
+        conf.env.append_value('CXXFLAGS', '-DKM_WIN32')
+    else:
+        conf.env.append_value('CXXFLAGS', '-DASDCP_PLATFORM="linux"')
 
 def build(bld):
     obj = bld(features = 'cxx cxxshlib')
     obj.name = 'libkumu-libdcp'
     obj.target = 'kumu-libdcp'
-    obj.uselib = 'EXPAT'
+    obj.uselib = 'OPENSSL'
     obj.includes = ['.']
     obj.export_includes = ['.']
     obj.source = """
@@ -25,7 +26,8 @@ def build(bld):
     obj = bld(features = 'cxx cxxshlib')
     obj.name = 'libasdcp-libdcp'
     obj.target = 'asdcp-libdcp'
-    obj.uselib = 'EXPAT'
+    obj.uselib = 'OPENSSL'
+    obj.use = 'libkumu-libdcp'
     obj.includes = ['.']
     obj.export_includes = ['.']
     obj.source = """
index 07e289b3ccaadeee38ab06d254dbe6758d516037..7d663eb27a929c5d2f8de8d71cb180a8d12a15f0 100644 (file)
@@ -36,12 +36,18 @@ Metadata::Metadata ()
        , issuer ("libdcp" LIBDCP_VERSION)
        , creator ("libdcp" LIBDCP_VERSION)
 {
+#ifdef LIBDCP_POSIX    
        char buffer[64];
        time_t now;
        time (&now);
        struct tm* tm = localtime (&now);
        strftime (buffer, 64, "%Y-%m-%dT%I:%M:%S+00:00", tm);
        issue_date = string (buffer);
+#endif
+
+#ifdef LIBDCP_WINDOWS
+       /* XXX */
+#endif 
 }
 
 /** @return Singleton Metadata instance */
index cd10983a720a05414d890d2ad93c0199cfb87c5e..136cf36d24e035639815d92d1b0a04f89455c079 100644 (file)
@@ -1,9 +1,17 @@
 def configure(conf):
+    if conf.options.target_windows:
+        boost_lib_suffix = '-mt'
+    else:
+        boost_lib_suffix = ''
+
     conf.check_cxx(fragment = """
                               #define BOOST_TEST_MODULE Config test\n
                              #include <boost/test/unit_test.hpp>\n
                               int main() {}
-                              """, msg = 'Checking for boost unit testing library', lib = 'boost_unit_test_framework', uselib_store = 'BOOST_TEST')
+                              """,
+                              msg = 'Checking for boost unit testing library',
+                              lib = 'boost_unit_test_framework%s' % boost_lib_suffix,
+                              uselib_store = 'BOOST_TEST')
 
 def build(bld):
     obj = bld(features = 'cxx cxxprogram')
diff --git a/wscript b/wscript
index 9f863d05ed826fdde807a60d70b4c0d067520cd3..ea16cf93538f004933ac5689397a331fa7d79803 100644 (file)
--- a/wscript
+++ b/wscript
@@ -6,14 +6,25 @@ VERSION = '0.05pre'
 
 def options(opt):
     opt.load('compiler_cxx')
+    opt.add_option('--target-windows', action='store_true', default = False, help = 'set up to do a cross-compile to Windows')
 
 def configure(conf):
     conf.load('compiler_cxx')
-    conf.env.append_value('CXXFLAGS', ['-Wall', '-Werror', '-Wextra', '-Wno-unused-result', '-O2', '-D_FILE_OFFSET_BITS=64'])
+    conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-Wno-unused-result', '-O2', '-D_FILE_OFFSET_BITS=64'])
     conf.env.append_value('CXXFLAGS', ['-DLIBDCP_VERSION="%s"' % VERSION])
 
+    if conf.options.target_windows:
+        conf.env.append_value('CXXFLAGS', '-DLIBDCP_WINDOWS')
+    else:
+        conf.env.append_value('CXXFLAGS', '-DLIBDCP_POSIX')
+
     conf.check_cfg(package = 'openssl', args = '--cflags --libs', uselib_store = 'OPENSSL', mandatory = True)
     conf.check_cfg(package = 'sigc++-2.0', args = '--cflags --libs', uselib_store = 'SIGC++', mandatory = True)
+
+    if conf.options.target_windows:
+        boost_lib_suffix = '-mt'
+    else:
+        boost_lib_suffix = ''
     
     conf.check_cxx(fragment = """
                              #include <boost/filesystem.hpp>\n
@@ -21,7 +32,7 @@ def configure(conf):
                              """,
                    msg = 'Checking for boost filesystem library',
                    libpath = '/usr/local/lib',
-                   lib = ['boost_filesystem', 'boost_system'],
+                   lib = ['boost_filesystem%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
                    uselib_store = 'BOOST_FILESYSTEM')
 
     conf.recurse('test')