root/lang/cplusplus/llv8call/trunk/ext/SConscript @ 19827

Revision 19827, 1.5 kB (checked in by tokuhirom, 6 years ago)

better detect

Line 
1import platform
2from distutils import sysconfig
3
4Import("env")
5Import("conf")
6
7def GuessOS():
8  id = platform.system()
9  if id == 'Linux':
10    return 'linux'
11  elif id == 'Darwin':
12    return 'macos'
13  elif id == 'Windows':
14    return 'win32'
15  else:
16    return None
17
18OS_GUESS = GuessOS()
19
20env.Append(
21    CCFLAGS = ['-DUSING_V8_SHARED'],
22    CPPPATH = ['../../v8/include/', '../src/', '/opt/local/include/', sysconfig.get_python_inc()],
23    LIBPATH = ['../../v8/'],
24)
25
26if conf.CheckCHeader("Python.h"):
27    env.SharedLibrary(
28        "python",
29        ['python.cc'],
30        LIBS=['v8', 'python' + sysconfig.get_config_var('VERSION')],
31    )
32
33# libmemcached
34if conf.CheckLib('memcached'):
35    env.SharedLibrary(
36        "libmemcached",
37        ['libmemcached.cc'],
38        LIBS=['v8', 'memcached'],
39    )
40elif OS_GUESS == 'win32':
41    env.SharedLibrary(
42        "memcached",
43        ['libmemcached-win32.cc'],
44        LIBS=['v8', 'ws2_32'],
45    )
46
47if OS_GUESS == 'linux' or OS_GUESS == 'macos':
48    env.SharedLibrary(
49        "posix",
50        ['posix.cc'],
51        LIBS=['v8'],
52    )
53
54# curl
55if conf.CheckLib('curl'):
56    libs = ['v8', 'curl']
57    if conf.CheckLib('iconv') or OS_GUESS == 'macos':
58        libs.append('iconv')
59    env.SharedLibrary(
60        "curl",
61        ['curl.cc'],
62        LIBS=libs,
63    )
64
65# fcgi
66if conf.CheckLib('fcgi'):
67    env.SharedLibrary(
68        "fcgi",
69        ['fcgi.cc'],
70        LIBS=['v8', 'fcgi'],
71    )
72
73# sqlite3
74env.SharedLibrary(
75    "sqlite3",
76    ["sqlite3-amalgamination.c", 'sqlite3.cc'],
77    LIBS=['v8'],
78)
Note: See TracBrowser for help on using the browser.