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