ncval-stubout: Handle multiple files
[nativeclient.git] / npapi_plugin / SConscript
blob9a8aaf59ea2b0b58f05d9ac4b37bf94669d3ec11
1 # Copyright 2008, Google Inc.
2 # All rights reserved.
3
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
7
8 #     * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 #     * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following disclaimer
12 # in the documentation and/or other materials provided with the
13 # distribution.
14 #     * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived from
16 # this software without specific prior written permission.
17
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 Import('env')
33 # TODO: there is an  unreferenced file ldt_unittest.cc in this directory
35 env.Prepend(
36     CPPPATH = [
37         '$SOURCE_ROOT/googleclient/third_party/npapi/files/include',
38     ],
41 env.Append(
42     CPPPATH = [
43         '$SOURCE_ROOT/googleclient',
44         '$SOURCE_ROOT/googleclient/third_party/libxt/include',
45     ],
46     LIBS = [
47         'nonnacl_util',
48         'nonnacl_srpc',
49         'nrd_xfer',
50         'naclthread',
51         'gio',
52         'google_nacl_npruntime',
53         'google_nacl_imc_c',
54     ],
57 if not env.Bit('mac'):
58   env['COMPONENT_STATIC'] = False
61 if env.Bit('linux'):
62     env.Append(
63         CCFLAGS=[
64             '-mno-align-double',
65             '-fPIC',
66         ],
67         CPPDEFINES = [
68             'XP_UNIX', 'MOZ_X11',
69         ],
70         LIBS = [
71             'X11'
72         ],
73     )
76 if env.Bit('mac'):
77     env.Append(
78         CPPPATH = ['/Developer/Headers/FlatCarbon'],
79         CCFLAGS=[
80             '-mno-align-double',
81             '-Wno-error',
82         ],
83         CPPDEFINES = [
84             'XP_MACOSX',
85             'XP_UNIX',
86             ['TARGET_API_MAC_CARBON', '1'],
87             'NO_X11',
88             'USE_SYSTEM_CONSOLE',
89         ],
90         FRAMEWORKS = [
91             'Carbon',
92         ],
93         # TODO: it's a little awkward to, when you want a bundle:
94         #  1) add -bundle to your LINKFLAGS
95         #  2) create a "program" (which shows up in all_programs target)
96         #  3) create a bundle out of it, specifying the bundle extension
97         # Ideally that all happens inside a CompleteBundlePseudoBuilder().
98         LINKFLAGS = [
99             '-bundle', '-framework', 'Foundation'
100         ]
101     )
104 if env.Bit('windows'):
105     env.Append(
106         CCFLAGS = [
107             '/EHsc',
108         ],
109         CPPDEFINES = [
110             'XP_WIN', 'WIN32', '_WINDOWS'
111         ],
112         LIBS = [
113             'gdi32',
114             'user32',
115         ],
116     )
117     env.Tool('atlmfc_vc80')
120 nacl_npplugin_inputs = [
121     # common files
122     env.ComponentObject('np_entry',
123                         '$MAIN_DIR/third_party/npapi_plugin/np_entry.cc'),
124     env.ComponentObject('npn_gate',
125                         '$MAIN_DIR/third_party/npapi_plugin/npn_gate.cc'),
126     'npp_gate.cc',
127     'npp_launcher.cc',
128     # NPAPI remote support
129     'npapi_bridge/npmodule.cc',
130     # SRPC support
131     'srpc/srpc.cc',
132     'srpc/plugin.cc',
133     'srpc/ret_array.cc',
134     'srpc/connected_socket.cc',
135     'srpc/shared_memory.cc',
136     'srpc/socket_address.cc',
137     'srpc/srpc_client.cc',
138     'srpc/service_runtime_interface.cc',
139     'srpc/unknown_handle.cc',
140     'srpc/video.cc',
141     # generic URL-origin / same-domain handling
142     'origin.cc',
145 if env['TARGET_PLATFORM'] == 'WINDOWS':
146   nacl_npplugin_inputs += [
147       'npapi_bridge/win/npmodule_win.cc',
148       'nacl_plugin.def',
149       env.RES('nacl_plugin.rc'),
150   ]
151 else:
152   nacl_npplugin_inputs += [
153       'npapi_bridge/linux/npmodule_linux.cc'
154   ]
156 if env['TARGET_PLATFORM'] == 'MAC':
157   nacl_npplugin_inputs += [
158       'npapi_bridge/osx/npmodule_osx.cc'
159   ]
162 npGoogleNaClPlugin = 'npGoogleNaClPlugin'
164 if not env.Bit('mac'):
165   exe = env.ComponentLibrary(npGoogleNaClPlugin, nacl_npplugin_inputs,
166                              no_import_lib = True)
167 else:
168   REZ = '/Developer/Tools/Rez'
169   env.Command(target='npGoogleNaClPlugin.rsrc',
170               source='npGoogleNaClPlugin.r',
171               action=[Action(REZ + ' -o $TARGET $SOURCE -useDF')])
172   exe = env.ComponentProgram(npGoogleNaClPlugin, nacl_npplugin_inputs,
173                              no_import_lib = True)
174   # Bundle pattern can be found in
175   # //depot/googleclient/tools/hammer/site_scons/site_tools/target_platform_mac.py
176   env.Bundle('$STAGING_DIR/' + npGoogleNaClPlugin + '.bundle',
177              BUNDLE_EXE = exe[0],
178              BUNDLE_PKGINFO_FILENAME = 0,
179              BUNDLE_RESOURCES = 'npGoogleNaClPlugin.rsrc')