summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lilv_internal.h5
-rw-r--r--src/util.c4
-rw-r--r--test/lilv_test.c2
-rw-r--r--test/test.lv2/test.c5
-rw-r--r--wscript17
5 files changed, 21 insertions, 12 deletions
diff --git a/src/lilv_internal.h b/src/lilv_internal.h
index cedc33e..15d2716 100644
--- a/src/lilv_internal.h
+++ b/src/lilv_internal.h
@@ -29,13 +29,16 @@ extern "C" {
#ifdef _WIN32
# include <windows.h>
# include <direct.h>
+# include <stdio.h>
# define dlopen(path, flags) LoadLibrary(path)
# define dlclose(lib) FreeLibrary((HMODULE)lib)
# define unlink(path) _unlink(path)
# define rmdir(path) _rmdir(path)
# ifdef _MSC_VER
# define __func__ __FUNCTION__
-# define snprintf _snprintf
+# ifndef snprintf
+# define snprintf _snprintf
+# endif
# endif
#ifndef INFINITY
# define INFINITY DBL_MAX + DBL_MAX
diff --git a/src/util.c b/src/util.c
index b600586..9e791b4 100644
--- a/src/util.c
+++ b/src/util.c
@@ -39,8 +39,9 @@
# include <io.h>
# define F_OK 0
# define mkdir(path, flags) _mkdir(path)
+# if defined(_MSC_VER) && _MSC_VER <= 1400
/** Implement 'CreateSymbolicLink()' for MSVC 8 or earlier */
-BOOLEAN WINAPI
+extern "C" BOOLEAN WINAPI
CreateSymbolicLink(LPCTSTR linkpath, LPCTSTR targetpath, DWORD flags)
{
typedef BOOLEAN (WINAPI* PFUNC)(LPCTSTR, LPCTSTR, DWORD);
@@ -49,6 +50,7 @@ CreateSymbolicLink(LPCTSTR linkpath, LPCTSTR targetpath, DWORD flags)
"CreateSymbolicLinkA");
return pfn ? pfn(linkpath, targetpath, flags) : 0;
}
+# endif
#else
# include <dirent.h>
# include <limits.h>
diff --git a/test/lilv_test.c b/test/lilv_test.c
index 5f879f9..0c48588 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -31,9 +31,11 @@
#ifdef _WIN32
# include <direct.h>
+# include <io.h>
# define mkdir(path, flags) _mkdir(path)
# define setenv(n, v, r) SetEnvironmentVariable((n), (v))
# define unsetenv(n) SetEnvironmentVariable((n), NULL)
+# define mkstemp(pat) _mktemp(pat)
#else
# include <dirent.h>
# include <unistd.h>
diff --git a/test/test.lv2/test.c b/test/test.lv2/test.c
index 2850f0e..30677f1 100644
--- a/test/test.lv2/test.c
+++ b/test/test.lv2/test.c
@@ -27,6 +27,11 @@
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+#ifdef _WIN32
+# include <io.h>
+# define mkstemp(pat) _mktemp(pat)
+#endif
+
#define TEST_URI "http://example.org/lilv-test-plugin"
#define TMP_TEMPLATE "lilv_testXXXXXX"
diff --git a/wscript b/wscript
index 556bbff..0ff80f8 100644
--- a/wscript
+++ b/wscript
@@ -235,7 +235,6 @@ def build(bld):
lib = []
if bld.env.MSVC_COMPILER:
libflags = []
- defines = ['snprintf=_snprintf']
# Pkgconfig file
autowaf.build_pc(bld, 'LILV', LILV_VERSION, LILV_MAJOR_VERSION, [],
@@ -280,6 +279,8 @@ def build(bld):
install_path = '${PYTHONDIR}')
if bld.env.BUILD_TESTS:
+ import re
+
test_libs = lib
test_cflags = ['']
test_linkflags = ['']
@@ -287,17 +288,12 @@ def build(bld):
test_cflags += ['--coverage']
test_linkflags += ['--coverage']
- # Test plugin library
- penv = bld.env.derive()
- shlib_pattern = penv.cshlib_PATTERN
- if shlib_pattern.startswith('lib'):
- shlib_pattern = shlib_pattern[3:]
- penv.cshlib_PATTERN = shlib_pattern
- shlib_ext = shlib_pattern[shlib_pattern.rfind('.'):]
+ # Make a pattern for shared objects without the 'lib' prefix
+ module_pattern = re.sub('^lib', '', bld.env.cshlib_PATTERN)
+ shlib_ext = module_pattern[module_pattern.rfind('.'):]
for p in ['test'] + test_plugins:
obj = bld(features = 'c cshlib',
- env = penv,
source = 'test/%s.lv2/%s.c' % (p, p),
name = p,
target = 'test/%s.lv2/%s' % (p, p),
@@ -307,6 +303,7 @@ def build(bld):
linkflags = test_linkflags,
lib = test_libs,
uselib = 'LV2')
+ obj.env.cshlib_PATTERN = module_pattern
for p in test_plugins:
if not bld.path.find_node('test/%s.lv2/test_%s.c' % (p, p)):
@@ -390,7 +387,6 @@ def build(bld):
# Build bindings test plugin
obj = bld(features = 'c cshlib',
- env = penv,
source = 'bindings/test/bindings_test_plugin.c',
name = 'bindings_test_plugin',
target = 'bindings/bindings_test_plugin.lv2/bindings_test_plugin',
@@ -400,6 +396,7 @@ def build(bld):
linkflags = test_linkflags,
lib = test_libs,
uselib = 'LV2')
+ obj.env.cshlib_PATTERN = module_pattern
# Bindings test plugin data files
for i in [ 'manifest.ttl.in', 'bindings_test_plugin.ttl.in' ]: