-
Notifications
You must be signed in to change notification settings - Fork 2
/
SConscript.target.win32
87 lines (75 loc) · 3.62 KB
/
SConscript.target.win32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright (c) Open Connectivity Foundation (OCF), AllJoyn Open Source
# Project (AJOSP) Contributors and others.
#
# SPDX-License-Identifier: Apache-2.0
#
# All rights reserved. This program and the accompanying materials are
# made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Copyright (c) Open Connectivity Foundation and Contributors to AllSeen
# Alliance. All rights reserved.
#
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all
# copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
import os
import platform
Import('env')
default_target_os = 'win7'
allowed_target_oss = ('win7', 'win10')
# Target specific SCons command line variables
default_msvc_version = os.environ.get('AJ_MSVC_VERSION', '12.0')
supported_msvc_versions = [ '8.0', '9.0', '10.0', '11.0', '11.0Exp', '12.0', '12.0Exp', '14.0', '14.0Exp' ]
vars = Variables()
vars.Add(EnumVariable('OS', 'Target OS', default_target_os, allowed_values = allowed_target_oss))
vars.Add(EnumVariable('MSVC_VERSION', 'MSVC compiler version - Windows', default_msvc_version, allowed_values = supported_msvc_versions))
vars.Add(BoolVariable('NO_AUTH', "Compile in authentication mechanism's to the code base", os.environ.get('AJ_NO_AUTH', False)))
vars.Update(env)
Help(vars.GenerateHelpText(env))
# Platform libraries
env.Append(LIBS = ['advapi32'])
# Compiler flags
env.Append(CFLAGS = ['/J', '/W3', '/nologo'])
env.Append(CPPDEFINES = ['_CRT_SECURE_NO_WARNINGS', 'AJ_MAIN'])
if env['NO_AUTH']:
env.Append(CPPDEFINES = ['TEST_DISABLE_SECURITY'])
# Debug/Release Variants
if env['VARIANT'] == 'debug':
env.Append(CFLAGS = ['/Zi', '/Od', '/MDd'])
env.Append(CPPDEFINES = ['_DEBUG'])
env.Append(LINKFLAGS = ['/debug'])
else:
env.Append(CFLAGS = ['/Gy', '/O1', '/GF', '/MD'])
env.Append(LINKFLAGS = ['/opt:ref', '/NODEFAULTLIB:libcmt.lib'])
env['connectivity_options'] = ['tcp', 'ardp']
# Unit test build preprocessor macro
if os.environ.has_key('GTEST_DIR') or ARGUMENTS.get('GTEST_DIR'):
env.Append(CPPDEFINES = ['GTEST_ENABLED'])
# Support running on Win7 and newer Windows versions.
env.Append(CPPDEFINES = [('_WIN32_WINNT', '_WIN32_WINNT_WIN7')])
# This is needed in order to build with Scons and Visual Studio multiple targets
# in parallel using the -j option. See alljoyn\build_core\conf\windows\SConscript.
env['CCPDBFLAGS'] = '/Z7'
env['PDB'] = '${TARGET.base}.pdb'
env.Append(LINKFLAGS=['/PDB:${TARGET.base}.pdb'])
# Large Memory Platform
env.Append(CPPDEFINES = ['AJ_NVRAM_SIZE=64000'])
env.Append(CPPDEFINES = ['AJ_NVRAM_SIZE_CREDS=10000'])
env.Append(CPPDEFINES = ['AJ_NVRAM_SIZE_SERVICES=10000'])
env.Append(CPPDEFINES = ['AJ_NVRAM_SIZE_FRAMEWORK=10000'])
env.Append(CPPDEFINES = ['AJ_NVRAM_SIZE_ALLJOYNJS=10000'])
env.Append(CPPDEFINES = ['AJ_NVRAM_SIZE_RESERVED=14000'])
env.Append(CPPDEFINES = ['AJ_NVRAM_SIZE_APPS=10000'])
env.Append(CPPDEFINES = ['AJ_NUM_REPLY_CONTEXTS=8'])