summaryrefslogtreecommitdiffstats
path: root/src/SConscript.py
blob: 3cfaa2d447c45c83bb16096f2d35b7f95158c6a6 (plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#******************************************************************
#
# Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

##
# Program configuration for the ccfxmpp library.
#
##

Import('env')


######################################################################
# Source files and Targets
######################################################################
ccfxmpp_src = [
    Glob('common/*.cpp'),
    Glob('connect/*.cpp'),
    Glob('pubsub/*.cpp'),
    Glob('bosh/*.cpp'),
    Glob('xml/*.cpp'),
    Glob('xmpp/*.cpp'),
    ]




ccfxmpp_lib_env = env.Clone()


######################################################################
# Compiler Flags
######################################################################
ccfxmpp_lib_env.AppendUnique(CPPPATH = [
		'include/'
		])


target_os = env.get('TARGET_OS')

ccfxmpp_lib_env.AppendUnique(CPPPATH = ['#external/rapidxml-1.13/'])

if target_os not in ['windows', 'winrt']:
    ccfxmpp_lib_env.AppendUnique(CPPPATH = ['platform/linux/'])
    ccfxmpp_lib_env.AppendUnique(CXXFLAGS = [
        '-std=c++11',
        '-fdata-sections',
        '-ffunction-sections',
        '-flto',
        '-fno-rtti',
        '-DCCF_XMPP_EXPORTS',
        '-DASIO_STANDALONE',
        '-DASIO_NO_TYPEID',
        '-Os',
        '-Wall', 
        '-Werror',
        '-Wno-unknown-pragmas',             # Ignore any windows-specific pragmas (don't warn)
        '-fPIC',
        ])
    if target_os not in ['darwin','ios']:
        ccfxmpp_lib_env.AppendUnique(
            CXXFLAGS = [
                '-Wl,--gc-sections',
                '-Wl,--strip-all',
                ])
    
    if env['STROPHE']:
        ccfxmpp_lib_env.AppendUnique(CXXFLAGS = [
            '-DENABLE_LIBSTROPHE',
            ])
    if not env['RELEASE']:
        # NOTE: We are currently leaving logging disabled in release to decrease code footprint.
        ccfxmpp_lib_env.AppendUnique(CXXFLAGS = [
            '-g',
            '-DLOGSTREAM_ENABLE_ALL_LOGGING',
            ])
elif target_os in ['windows', 'winrt']:
    ccfxmpp_lib_env.AppendUnique(CPPPATH = ['#WinDT/WinDT/'])

elif target_os == 'android':
    ccfxmpp_lib_env.AppendUnique(CXXFLAGS = ['-fno-rtti', '-fexceptions'])
    ccfxmpp_lib_env.AppendUnique(CPPPATH = ['platform/linux/include/'])
#	ccfxmpp_lib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
#	ccfxmpp_lib_env.AppendUnique(LIBS = ['octbstack', 'oc_logger', 'boost_thread', 'gnustl_static', 'log'])


if target_os in ['darwin', 'ios']:
    ccfxmpp_lib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
    ccfxmpp_lib_env.AppendUnique(CPPPATH = ['/usr/local/include'])
#	ccfxmpp_lib_env.AppendUnique(LIBS = ['octbstack', 'oc_logger'])


libccfxmpp_st = ccfxmpp_lib_env.StaticLibrary('ccfxmpp', ccfxmpp_src)
ccfxmpp_lib_env.Install(env.get('BUILD_DIR'), libccfxmpp_st)


ccfxmpp_shared_lib_env = ccfxmpp_lib_env.Clone()
ccfxmpp_shared_lib_env.AppendUnique(CXXFLAGS = ['-fvisibility=hidden'])

if target_os not in ['darwin', 'ios']:
    libccfxmpp_sh = ccfxmpp_shared_lib_env.SharedLibrary('ccfxmpp', ccfxmpp_src)
    ccfxmpp_shared_lib_env.Install(env.get('BUILD_DIR'), libccfxmpp_sh)


if env['RELEASE']:
    pass
    # TODO: Run strip against the shared object library (to remove symbols)