Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 2 | VERSION='0.1' |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 3 | APPNAME='chronoshare' |
| 4 | |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 5 | from waflib import Build, Logs, Utils, Task, TaskGen, Configure |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 6 | |
| 7 | def options(opt): |
| 8 | opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''') |
| 9 | opt.add_option('--test', action='store_true',default=False,dest='_test',help='''build unit tests''') |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 10 | opt.add_option('--yes',action='store_true',default=False) # for autoconf/automake/make compatibility |
Alexander Afanasyev | c507ac2 | 2013-01-21 16:01:58 -0800 | [diff] [blame] | 11 | opt.add_option('--log4cxx', action='store_true',default=False,dest='log4cxx',help='''Compile with log4cxx logging support''') |
Alexander Afanasyev | 5f9d09e | 2012-12-28 19:43:08 -0800 | [diff] [blame] | 12 | |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 13 | if Utils.unversioned_sys_platform () == "darwin": |
Zhenkai Zhu | bb170d4 | 2013-02-25 13:48:59 -0800 | [diff] [blame] | 14 | opt.add_option('--auto-update', action='store_true',default=False,dest='autoupdate',help='''(OSX) Download sparkle framework and enable autoupdate feature''') |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 15 | |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 16 | opt.load('compiler_c compiler_cxx boost ccnx protoc qt4') |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 17 | |
| 18 | def configure(conf): |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 19 | conf.load("compiler_c compiler_cxx") |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 20 | |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 21 | if conf.options.debug: |
| 22 | conf.define ('_DEBUG', 1) |
| 23 | conf.add_supported_cxxflags (cxxflags = ['-O0', |
| 24 | '-Wall', |
| 25 | '-Wno-unused-variable', |
| 26 | '-g3', |
| 27 | '-Wno-unused-private-field', # only clang supports |
| 28 | '-fcolor-diagnostics', # only clang supports |
| 29 | '-Qunused-arguments' # only clang supports |
| 30 | ]) |
| 31 | else: |
Alexander Afanasyev | d985a85 | 2013-03-04 10:34:33 -0800 | [diff] [blame] | 32 | conf.add_supported_cxxflags (cxxflags = ['-O3', '-g']) |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 33 | |
Alexander Afanasyev | a1b7bb5 | 2013-02-26 17:04:02 -0800 | [diff] [blame] | 34 | # I wish I could use it, but there is some weirdness with boost tests. Give up for now |
| 35 | # try: |
| 36 | # conf.check(features='cxx cxxprogram', cxxflags="-std=c++11") |
| 37 | # conf.env.append_value ('CXXFLAGS', ["-std=c++11"]) |
| 38 | # except: |
| 39 | # try: |
| 40 | # conf.check(features='cxx cxxprogram', cxxflags="-std=c++0x") |
| 41 | # conf.env.append_value ('CXXFLAGS', ["-std=c++0x"]) |
| 42 | # except: |
| 43 | # conf.fatal ("You compiler doesn't support C++11. You can try GCC >= 4.4 or recent version of Clang.") |
| 44 | |
Alexander Afanasyev | f289063 | 2013-01-02 13:40:02 -0800 | [diff] [blame] | 45 | conf.define ("CHRONOSHARE_VERSION", VERSION) |
| 46 | |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 47 | conf.check_cfg(package='sqlite3', args=['--cflags', '--libs'], uselib_store='SQLITE3', mandatory=True) |
Zhenkai Zhu | bc2f628 | 2013-01-08 16:40:58 -0800 | [diff] [blame] | 48 | conf.check_cfg(package='libevent', args=['--cflags', '--libs'], uselib_store='LIBEVENT', mandatory=True) |
| 49 | conf.check_cfg(package='libevent_pthreads', args=['--cflags', '--libs'], uselib_store='LIBEVENT_PTHREADS', mandatory=True) |
| 50 | |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 51 | if Utils.unversioned_sys_platform () == "darwin": |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 52 | conf.check_cxx(framework_name='Foundation', uselib_store='OSX_FOUNDATION', mandatory=False, compile_filename='test.mm') |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 53 | conf.check_cxx(framework_name='AppKit', uselib_store='OSX_APPKIT', mandatory=False, compile_filename='test.mm') |
| 54 | conf.check_cxx(framework_name='CoreWLAN', uselib_store='OSX_COREWLAN', define_name='HAVE_COREWLAN', |
| 55 | use="OSX_FOUNDATION", mandatory=False, compile_filename='test.mm') |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 56 | |
| 57 | if conf.options.autoupdate: |
Zhenkai Zhu | bb170d4 | 2013-02-25 13:48:59 -0800 | [diff] [blame] | 58 | def check_sparkle(**kwargs): |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 59 | conf.check_cxx (framework_name="Sparkle", header_name=["Foundation/Foundation.h", "AppKit/AppKit.h"], |
Zhenkai Zhu | bb170d4 | 2013-02-25 13:48:59 -0800 | [diff] [blame] | 60 | uselib_store='OSX_SPARKLE', define_name='HAVE_SPARKLE', mandatory=True, |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 61 | compile_filename='test.mm', use="OSX_FOUNDATION OSX_APPKIT", |
Zhenkai Zhu | bb170d4 | 2013-02-25 13:48:59 -0800 | [diff] [blame] | 62 | **kwargs |
| 63 | ) |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 64 | try: |
| 65 | # Try standard paths first |
Zhenkai Zhu | bb170d4 | 2013-02-25 13:48:59 -0800 | [diff] [blame] | 66 | check_sparkle() |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 67 | except: |
| 68 | try: |
| 69 | # Try local path |
| 70 | Logs.info ("Check local version of Sparkle framework") |
Alexander Afanasyev | 7c85d57 | 2013-02-26 22:06:54 -0800 | [diff] [blame] | 71 | check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(), |
| 72 | linkflags="-F%s/osx/Frameworks/" % conf.path.abspath()) |
| 73 | conf.env.HAVE_LOCAL_SPARKLE = 1 |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 74 | except: |
Alexander Afanasyev | a1b7bb5 | 2013-02-26 17:04:02 -0800 | [diff] [blame] | 75 | import urllib, subprocess, os, shutil |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 76 | if not os.path.exists('osx/Frameworks/Sparkle.framework'): |
| 77 | # Download to local path and retry |
| 78 | Logs.info ("Sparkle framework not found, trying to download it to 'build/'") |
Alexander Afanasyev | a1b7bb5 | 2013-02-26 17:04:02 -0800 | [diff] [blame] | 79 | |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 80 | urllib.urlretrieve ("http://sparkle.andymatuschak.org/files/Sparkle%201.5b6.zip", "build/Sparkle.zip") |
| 81 | if os.path.exists('build/Sparkle.zip'): |
| 82 | try: |
| 83 | subprocess.check_call (['unzip', '-qq', 'build/Sparkle.zip', '-d', 'build/Sparkle']) |
| 84 | os.remove ("build/Sparkle.zip") |
| 85 | if not os.path.exists("osx/Frameworks"): |
| 86 | os.mkdir ("osx/Frameworks") |
| 87 | os.rename ("build/Sparkle/Sparkle.framework", "osx/Frameworks/Sparkle.framework") |
| 88 | shutil.rmtree("build/Sparkle", ignore_errors=True) |
| 89 | |
| 90 | check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(), |
| 91 | linkflags="-F%s/osx/Frameworks/" % conf.path.abspath()) |
| 92 | conf.env.HAVE_LOCAL_SPARKLE = 1 |
| 93 | except subprocess.CalledProcessError as e: |
| 94 | conf.fatal("Cannot find Sparkle framework. Auto download failed: '%s' returned %s" % (' '.join(e.cmd), e.returncode)) |
| 95 | except: |
| 96 | conf.fatal("Unknown Error happened when auto downloading Sparkle framework") |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 97 | |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 98 | if conf.is_defined('HAVE_SPARKLE'): |
| 99 | conf.env.HAVE_SPARKLE = 1 # small cheat for wscript |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 100 | |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 101 | if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False): |
Alexander Afanasyev | 5f9d09e | 2012-12-28 19:43:08 -0800 | [diff] [blame] | 102 | libcrypto = conf.check_cc(lib='crypto', |
| 103 | header_name='openssl/crypto.h', |
| 104 | define_name='HAVE_SSL', |
| 105 | uselib_store='SSL') |
| 106 | else: |
| 107 | conf.define ("HAVE_SSL", 1) |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 108 | if not conf.get_define ("HAVE_SSL"): |
| 109 | conf.fatal ("Cannot find SSL libraries") |
| 110 | |
Alexander Afanasyev | c507ac2 | 2013-01-21 16:01:58 -0800 | [diff] [blame] | 111 | if conf.options.log4cxx: |
| 112 | conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX', mandatory=True) |
| 113 | conf.define ("HAVE_LOG4CXX", 1) |
| 114 | |
Zhenkai Zhu | 0a17aea | 2012-12-28 14:30:22 -0800 | [diff] [blame] | 115 | conf.load ('ccnx') |
Alexander Afanasyev | 3320698 | 2013-01-09 16:29:29 -0800 | [diff] [blame] | 116 | |
| 117 | conf.load('protoc') |
Alexander Afanasyev | 3320698 | 2013-01-09 16:29:29 -0800 | [diff] [blame] | 118 | |
| 119 | conf.load('qt4') |
| 120 | |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 121 | conf.load('boost') |
| 122 | |
Alexander Afanasyev | e1c9504 | 2013-02-27 01:02:36 -0800 | [diff] [blame] | 123 | conf.check_boost(lib='system test iostreams filesystem regex thread date_time') |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 124 | |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 125 | boost_version = conf.env.BOOST_VERSION.split('_') |
| 126 | if int(boost_version[0]) < 1 or int(boost_version[1]) < 46: |
| 127 | Logs.error ("Minumum required boost version is 1.46") |
| 128 | return |
| 129 | |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 130 | conf.check_ccnx (path=conf.options.ccnx_dir) |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 131 | conf.define ('CCNX_PATH', conf.env.CCNX_ROOT) |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 132 | |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 133 | if conf.options._test: |
Alexander Afanasyev | 9e5a470 | 2013-01-24 13:15:23 -0800 | [diff] [blame] | 134 | conf.define ('_TESTS', 1) |
Alexander Afanasyev | 72ac219 | 2013-01-03 19:33:43 -0800 | [diff] [blame] | 135 | conf.env.TEST = 1 |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 136 | |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 137 | conf.write_config_header('src/config.h') |
| 138 | |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 139 | def build (bld): |
Zhenkai Zhu | e840942 | 2013-01-28 12:52:17 -0800 | [diff] [blame] | 140 | executor = bld.objects ( |
| 141 | target = "executor", |
| 142 | features = ["cxx"], |
| 143 | source = bld.path.ant_glob(['executor/**/*.cc']), |
| 144 | use = 'BOOST BOOST_THREAD LIBEVENT LIBEVENT_PTHREADS LOG4CXX', |
| 145 | includes = "executor src", |
| 146 | ) |
| 147 | |
Alexander Afanasyev | 3f101ec | 2013-01-17 16:58:03 -0800 | [diff] [blame] | 148 | scheduler = bld.objects ( |
| 149 | target = "scheduler", |
Alexander Afanasyev | 68f2a95 | 2013-01-08 14:34:16 -0800 | [diff] [blame] | 150 | features = ["cxx"], |
Alexander Afanasyev | 3f101ec | 2013-01-17 16:58:03 -0800 | [diff] [blame] | 151 | source = bld.path.ant_glob(['scheduler/**/*.cc']), |
Zhenkai Zhu | e840942 | 2013-01-28 12:52:17 -0800 | [diff] [blame] | 152 | use = 'BOOST BOOST_THREAD LIBEVENT LIBEVENT_PTHREADS LOG4CXX executor', |
Zhenkai Zhu | 1888f74 | 2013-01-28 12:47:33 -0800 | [diff] [blame] | 153 | includes = "scheduler executor src", |
Alexander Afanasyev | 68f2a95 | 2013-01-08 14:34:16 -0800 | [diff] [blame] | 154 | ) |
| 155 | |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 156 | libccnx = bld ( |
Alexander Afanasyev | 3f101ec | 2013-01-17 16:58:03 -0800 | [diff] [blame] | 157 | target="ccnx", |
| 158 | features=['cxx'], |
| 159 | source = bld.path.ant_glob(['ccnx/**/*.cc', 'ccnx/**/*.cpp']), |
Zhenkai Zhu | e840942 | 2013-01-28 12:52:17 -0800 | [diff] [blame] | 160 | use = 'BOOST BOOST_THREAD SSL CCNX LOG4CXX scheduler executor', |
Zhenkai Zhu | 1888f74 | 2013-01-28 12:47:33 -0800 | [diff] [blame] | 161 | includes = "ccnx src scheduler executor", |
Alexander Afanasyev | f289063 | 2013-01-02 13:40:02 -0800 | [diff] [blame] | 162 | ) |
| 163 | |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 164 | adhoc = bld ( |
| 165 | target = "adhoc", |
| 166 | features=['cxx'], |
| 167 | includes = "ccnx src", |
| 168 | ) |
| 169 | if Utils.unversioned_sys_platform () == "darwin": |
| 170 | adhoc.mac_app = True |
| 171 | adhoc.source = 'adhoc/adhoc-osx.mm' |
Alexander Afanasyev | e33846d | 2013-02-25 15:26:08 -0800 | [diff] [blame] | 172 | adhoc.use = "LOG4CXX OSX_FOUNDATION OSX_COREWLAN" |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 173 | |
Alexander Afanasyev | 3f101ec | 2013-01-17 16:58:03 -0800 | [diff] [blame] | 174 | chornoshare = bld ( |
| 175 | target="chronoshare", |
| 176 | features=['cxx'], |
| 177 | source = bld.path.ant_glob(['src/**/*.cc', 'src/**/*.cpp', 'src/**/*.proto']), |
Alexander Afanasyev | e1c9504 | 2013-02-27 01:02:36 -0800 | [diff] [blame] | 178 | use = "BOOST BOOST_FILESYSTEM BOOST_DATE_TIME SQLITE3 LOG4CXX scheduler ccnx", |
Zhenkai Zhu | 1888f74 | 2013-01-28 12:47:33 -0800 | [diff] [blame] | 179 | includes = "ccnx scheduler src executor", |
Alexander Afanasyev | ee7e613 | 2013-01-03 20:03:14 -0800 | [diff] [blame] | 180 | ) |
Alexander Afanasyev | b2fe74e | 2013-01-20 16:06:43 -0800 | [diff] [blame] | 181 | |
Zhenkai Zhu | 369eff1 | 2013-02-05 15:43:49 -0800 | [diff] [blame] | 182 | fs_watcher = bld ( |
| 183 | target = "fs_watcher", |
| 184 | features = "qt4 cxx", |
| 185 | defines = "WAF", |
| 186 | source = bld.path.ant_glob(['fs-watcher/*.cc']), |
| 187 | use = "SQLITE3 LOG4CXX scheduler executor QTCORE", |
| 188 | includes = "fs-watcher scheduler executor src", |
| 189 | ) |
| 190 | |
Alexander Afanasyev | ee7e613 | 2013-01-03 20:03:14 -0800 | [diff] [blame] | 191 | # Unit tests |
| 192 | if bld.env['TEST']: |
| 193 | unittests = bld.program ( |
| 194 | target="unit-tests", |
Zhenkai Zhu | d175627 | 2013-02-01 17:02:18 -0800 | [diff] [blame] | 195 | features = "qt4 cxx cxxprogram", |
| 196 | defines = "WAF", |
Zhenkai Zhu | 369eff1 | 2013-02-05 15:43:49 -0800 | [diff] [blame] | 197 | source = bld.path.ant_glob(['test/*.cc']), |
Alexander Afanasyev | e1c9504 | 2013-02-27 01:02:36 -0800 | [diff] [blame] | 198 | use = 'BOOST_TEST BOOST_FILESYSTEM BOOST_DATE_TIME LOG4CXX SQLITE3 QTCORE QTGUI ccnx database fs_watcher chronoshare', |
Zhenkai Zhu | 369eff1 | 2013-02-05 15:43:49 -0800 | [diff] [blame] | 199 | includes = "ccnx scheduler src executor gui fs-watcher", |
Alexander Afanasyev | 4f62f44 | 2013-02-07 22:36:08 -0800 | [diff] [blame] | 200 | install_prefix = None, |
Alexander Afanasyev | ee7e613 | 2013-01-03 20:03:14 -0800 | [diff] [blame] | 201 | ) |
Alexander Afanasyev | f289063 | 2013-01-02 13:40:02 -0800 | [diff] [blame] | 202 | |
Zhenkai Zhu | a9a7e1d | 2013-02-25 18:29:07 -0800 | [diff] [blame] | 203 | http_server = bld ( |
| 204 | target = "http_server", |
Zhenkai Zhu | d942922 | 2013-02-25 22:34:09 -0800 | [diff] [blame] | 205 | features = "qt4 cxx", |
Zhenkai Zhu | a9a7e1d | 2013-02-25 18:29:07 -0800 | [diff] [blame] | 206 | source = bld.path.ant_glob(['server/*.cpp']), |
Zhenkai Zhu | d942922 | 2013-02-25 22:34:09 -0800 | [diff] [blame] | 207 | includes = "server src .", |
| 208 | use = "BOOST QTCORE" |
Zhenkai Zhu | a9a7e1d | 2013-02-25 18:29:07 -0800 | [diff] [blame] | 209 | ) |
| 210 | |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 211 | qt = bld ( |
| 212 | target = "ChronoShare", |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 213 | features = "qt4 cxx cxxprogram html_resources", |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 214 | defines = "WAF", |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 215 | source = bld.path.ant_glob(['gui/*.cpp', 'gui/*.cc', 'gui/images.qrc']), |
Zhenkai Zhu | d942922 | 2013-02-25 22:34:09 -0800 | [diff] [blame] | 216 | includes = "ccnx scheduler executor fs-watcher gui src adhoc server . ", |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 217 | use = "BOOST BOOST_FILESYSTEM BOOST_DATE_TIME SQLITE3 QTCORE QTGUI LOG4CXX fs_watcher ccnx database chronoshare http_server", |
| 218 | |
| 219 | html_resources = bld.path.find_dir ("gui/html").ant_glob([ |
| 220 | '**/*.js', '**/*.png', '**/*.css', |
| 221 | '**/*.html', '**/*.gif', '**/*.ico' |
| 222 | ]), |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 223 | ) |
| 224 | |
| 225 | if Utils.unversioned_sys_platform () == "darwin": |
| 226 | app_plist = '''<?xml version="1.0" encoding="UTF-8"?> |
Alexander Afanasyev | 83a5300 | 2013-01-24 11:12:01 -0800 | [diff] [blame] | 227 | <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> |
| 228 | <plist version="0.9"> |
| 229 | <dict> |
| 230 | <key>CFBundlePackageType</key> |
| 231 | <string>APPL</string> |
| 232 | <key>CFBundleGetInfoString</key> |
| 233 | <string>Created by Waf</string> |
Zhenkai Zhu | 3857d71 | 2013-02-27 22:51:25 -0800 | [diff] [blame] | 234 | <key>CFBundleIdentifier</key> |
| 235 | <string>edu.ucla.cs.irl.Chronoshare</string> |
Alexander Afanasyev | 83a5300 | 2013-01-24 11:12:01 -0800 | [diff] [blame] | 236 | <key>CFBundleSignature</key> |
| 237 | <string>????</string> |
| 238 | <key>NOTE</key> |
| 239 | <string>THIS IS A GENERATED FILE, DO NOT MODIFY</string> |
| 240 | <key>CFBundleExecutable</key> |
| 241 | <string>%s</string> |
| 242 | <key>LSUIElement</key> |
| 243 | <string>1</string> |
Zhenkai Zhu | 8e3e907 | 2013-02-28 15:40:51 -0800 | [diff] [blame] | 244 | <key>SUPublicDSAKeyFile</key> |
| 245 | <string>dsa_pub.pem</string> |
Alexander Afanasyev | 83a5300 | 2013-01-24 11:12:01 -0800 | [diff] [blame] | 246 | </dict> |
| 247 | </plist>''' |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 248 | qt.mac_app = "ChronoShare.app" |
| 249 | qt.mac_plist = app_plist % "ChronoShare" |
| 250 | qt.use += " OSX_FOUNDATION OSX_COREWLAN adhoc" |
Alexander Afanasyev | 83a5300 | 2013-01-24 11:12:01 -0800 | [diff] [blame] | 251 | |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 252 | if bld.env['HAVE_SPARKLE']: |
| 253 | qt.use += " OSX_SPARKLE" |
| 254 | qt.source += ["osx/auto-update/sparkle-auto-update.mm"] |
| 255 | qt.includes += " osx/auto-update" |
Alexander Afanasyev | 7c85d57 | 2013-02-26 22:06:54 -0800 | [diff] [blame] | 256 | if bld.env['HAVE_LOCAL_SPARKLE']: |
| 257 | qt.mac_frameworks = "osx/Frameworks/Sparkle.framework" |
Alexander Afanasyev | 548d38d | 2013-01-26 16:36:06 -0800 | [diff] [blame] | 258 | |
| 259 | cmdline = bld ( |
| 260 | target = "csd", |
| 261 | features = "qt4 cxx cxxprogram", |
| 262 | defines = "WAF", |
Zhenkai Zhu | 369eff1 | 2013-02-05 15:43:49 -0800 | [diff] [blame] | 263 | source = "cmd/csd.cc", |
| 264 | includes = "ccnx scheduler executor gui fs-watcher src . ", |
Alexander Afanasyev | e1c9504 | 2013-02-27 01:02:36 -0800 | [diff] [blame] | 265 | use = "BOOST BOOST_FILESYSTEM BOOST_DATE_TIME SQLITE3 QTCORE QTGUI LOG4CXX fs_watcher ccnx database chronoshare" |
Alexander Afanasyev | 548d38d | 2013-01-26 16:36:06 -0800 | [diff] [blame] | 266 | ) |
| 267 | |
Alexander Afanasyev | eb575e0 | 2013-01-26 17:14:51 -0800 | [diff] [blame] | 268 | dump_db = bld ( |
| 269 | target = "dump-db", |
| 270 | features = "cxx cxxprogram", |
| 271 | source = "cmd/dump-db.cc", |
Zhenkai Zhu | 369eff1 | 2013-02-05 15:43:49 -0800 | [diff] [blame] | 272 | includes = "ccnx scheduler executor gui fs-watcher src . ", |
Alexander Afanasyev | e1c9504 | 2013-02-27 01:02:36 -0800 | [diff] [blame] | 273 | use = "BOOST BOOST_FILESYSTEM BOOST_DATE_TIME SQLITE3 QTCORE LOG4CXX fs_watcher ccnx database chronoshare" |
Alexander Afanasyev | eb575e0 | 2013-01-26 17:14:51 -0800 | [diff] [blame] | 274 | ) |
| 275 | |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 276 | from waflib import TaskGen |
| 277 | @TaskGen.extension('.mm') |
| 278 | def m_hook(self, node): |
| 279 | """Alias .mm files to be compiled the same as .cc files, gcc/clang will do the right thing.""" |
| 280 | return self.create_compiled_task('cxx', node) |
Zhenkai Zhu | 6b53f93 | 2013-03-02 20:46:02 -0800 | [diff] [blame] | 281 | |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 282 | @TaskGen.extension('.js', '.png', '.css', '.html', '.gif', '.ico') |
| 283 | def sig_hook(self, node): |
| 284 | node.sig=Utils.h_file (node.abspath()) |
Zhenkai Zhu | 6b53f93 | 2013-03-02 20:46:02 -0800 | [diff] [blame] | 285 | |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 286 | @TaskGen.feature('html_resources') |
| 287 | @TaskGen.before_method('process_source') |
| 288 | def create_qrc_task(self): |
| 289 | output = self.bld.path.find_or_declare ("gui/html.qrc") |
| 290 | tsk = self.create_task('html_resources', self.html_resources, output) |
Alexander Afanasyev | 1cb641f | 2013-03-03 17:49:02 -0800 | [diff] [blame] | 291 | tsk.base_path = output.parent.get_src () |
| 292 | self.create_rcc_task (output.get_src ()) |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 293 | |
| 294 | class html_resources(Task.Task): |
| 295 | color='PINK' |
| 296 | |
| 297 | def __str__ (self): |
Alexander Afanasyev | 1cb641f | 2013-03-03 17:49:02 -0800 | [diff] [blame] | 298 | return "%s: Generating %s\n" % (self.__class__.__name__.replace('_task',''), self.outputs[0].nice_path ()) |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 299 | |
| 300 | def run (self): |
| 301 | out = self.outputs[0] |
Alexander Afanasyev | 9cc6c21 | 2013-03-04 12:45:38 -0800 | [diff] [blame^] | 302 | bld_out = out.get_bld () |
| 303 | src_out = out.get_src () |
| 304 | bld_out.write('<RCC>\n <qresource prefix="/">\n') |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 305 | for f in self.inputs: |
Alexander Afanasyev | 9cc6c21 | 2013-03-04 12:45:38 -0800 | [diff] [blame^] | 306 | bld_out.write (' <file>%s</file>\n' % f.path_from (self.base_path), 'a') |
| 307 | bld_out.write(' </qresource>\n</RCC>', 'a') |
Alexander Afanasyev | 1cb641f | 2013-03-03 17:49:02 -0800 | [diff] [blame] | 308 | |
Alexander Afanasyev | 9cc6c21 | 2013-03-04 12:45:38 -0800 | [diff] [blame^] | 309 | src_out.write (bld_out.read(), 'w') |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 310 | return 0 |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 311 | |
| 312 | @Configure.conf |
| 313 | def add_supported_cxxflags(self, cxxflags): |
| 314 | """ |
| 315 | Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable |
| 316 | """ |
| 317 | self.start_msg('Checking allowed flags for c++ compiler') |
| 318 | |
| 319 | supportedFlags = [] |
| 320 | for flag in cxxflags: |
| 321 | if self.check_cxx (cxxflags=[flag], mandatory=False): |
| 322 | supportedFlags += [flag] |
| 323 | |
| 324 | self.end_msg (' '.join (supportedFlags)) |
| 325 | self.env.CXXFLAGS += supportedFlags |