summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuo Jinghua <sunmoon1997@gmail.com>2010-01-10 23:07:16 +0800
committerLuo Jinghua <sunmoon1997@gmail.com>2010-01-10 23:07:16 +0800
commit27baf10598f4a2d34ca6e140e249ce95d844e78d (patch)
tree707830a19eb6b5db7fb6c2a61c8bab2d5c581868
parent83dccb88e122f298a943de694d1157b7d66f2f7a (diff)
fixed iconv.dll build on win32
-rw-r--r--SConstruct26
1 files changed, 21 insertions, 5 deletions
diff --git a/SConstruct b/SConstruct
index 3f7f073..86012a0 100644
--- a/SConstruct
+++ b/SConstruct
@@ -19,10 +19,20 @@ env.AppendUnique(CCFLAGS = ['-Wall', '-g'],
uniconv = env.ConvenienceLibrary ('uniconv', srcs)
-iconv = env.SharedLibrary('iconv', 'iconv.c',
- LIBS = ['uniconv'],
- LIBPATH = ['.'],
- CPPPATH = ['.'])
+iconv_env = env.Clone()
+iconv_src = ['iconv.c']
+if iconv_env['PLATFORM'] == 'win32':
+ iconv_def = os.path.join('win32', 'iconv.def')
+ if 'gcc' in iconv_env['CC']:
+ iconv_src.append(iconv_def)
+ else:
+ iconv_env.AppendUnique(LINKFLAGS = ['/DEF:' + iconv_def])
+ iconv_env.AppendUnique(CPPDEFINES = ['UNICONV_REPLACE_ICONV'])
+
+iconv = iconv_env.SharedLibrary('iconv', iconv_src,
+ LIBS = ['uniconv'],
+ LIBPATH = ['.'],
+ CPPPATH = ['.'])
test = env.Program ('test', 'main.c',
LIBS = ['uniconv'],
@@ -32,4 +42,10 @@ conv = env.Program ('uconv', 'uconv.c',
LIBS = ['uniconv'],
LIBPATH = ['.'],
CPPPATH = ['.'])
-conv2 = bareenv.Program ('uconv2', 'uconv2.c')
+
+conv2_env = bareenv.Clone()
+if env['PLATFORM'] == 'win32':
+ conv2_env.AppendUnique(CPPPATH = ['win32'],
+ LIBS = ['iconv'],
+ LIBPATH = ['.'])
+conv2 = conv2_env.Program ('uconv2', 'uconv2.c')