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; -*- |
Zhenkai Zhu | b9f0208 | 2013-03-14 12:45:15 -0700 | [diff] [blame] | 2 | VERSION='0.4' |
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): |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 8 | 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] | 9 | 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] | 10 | 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] | 11 | |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 12 | if Utils.unversioned_sys_platform () == "darwin": |
Zhenkai Zhu | bb170d4 | 2013-02-25 13:48:59 -0800 | [diff] [blame] | 13 | 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] | 14 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 15 | opt.load('compiler_c compiler_cxx boost protoc qt4 gnu_dirs') |
| 16 | opt.load('ndnx flags tinyxml', tooldir=['waf-tools']) |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 17 | |
| 18 | def configure(conf): |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 19 | conf.load("compiler_c compiler_cxx gnu_dirs flags") |
Alexander Afanasyev | a1b7bb5 | 2013-02-26 17:04:02 -0800 | [diff] [blame] | 20 | |
Alexander Afanasyev | f289063 | 2013-01-02 13:40:02 -0800 | [diff] [blame] | 21 | conf.define ("CHRONOSHARE_VERSION", VERSION) |
| 22 | |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 23 | 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] | 24 | conf.check_cfg(package='libevent', args=['--cflags', '--libs'], uselib_store='LIBEVENT', mandatory=True) |
| 25 | conf.check_cfg(package='libevent_pthreads', args=['--cflags', '--libs'], uselib_store='LIBEVENT_PTHREADS', mandatory=True) |
Zhenkai Zhu | 3457ed4 | 2013-03-12 15:15:21 -0700 | [diff] [blame] | 26 | conf.load('tinyxml') |
| 27 | conf.check_tinyxml(path=conf.options.tinyxml_dir) |
Zhenkai Zhu | bc2f628 | 2013-01-08 16:40:58 -0800 | [diff] [blame] | 28 | |
Alexander Afanasyev | cf77114 | 2013-03-19 11:15:27 -0700 | [diff] [blame] | 29 | conf.define ("TRAY_ICON", "chronoshare-big.png") |
| 30 | if Utils.unversioned_sys_platform () == "linux": |
| 31 | conf.define ("TRAY_ICON", "chronoshare-ubuntu.png") |
| 32 | |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 33 | if Utils.unversioned_sys_platform () == "darwin": |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 34 | 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] | 35 | conf.check_cxx(framework_name='AppKit', uselib_store='OSX_APPKIT', mandatory=False, compile_filename='test.mm') |
| 36 | conf.check_cxx(framework_name='CoreWLAN', uselib_store='OSX_COREWLAN', define_name='HAVE_COREWLAN', |
| 37 | use="OSX_FOUNDATION", mandatory=False, compile_filename='test.mm') |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 38 | |
| 39 | if conf.options.autoupdate: |
Zhenkai Zhu | bb170d4 | 2013-02-25 13:48:59 -0800 | [diff] [blame] | 40 | def check_sparkle(**kwargs): |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 41 | 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] | 42 | uselib_store='OSX_SPARKLE', define_name='HAVE_SPARKLE', mandatory=True, |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 43 | compile_filename='test.mm', use="OSX_FOUNDATION OSX_APPKIT", |
Zhenkai Zhu | bb170d4 | 2013-02-25 13:48:59 -0800 | [diff] [blame] | 44 | **kwargs |
| 45 | ) |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 46 | try: |
| 47 | # Try standard paths first |
Zhenkai Zhu | bb170d4 | 2013-02-25 13:48:59 -0800 | [diff] [blame] | 48 | check_sparkle() |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 49 | except: |
| 50 | try: |
| 51 | # Try local path |
| 52 | Logs.info ("Check local version of Sparkle framework") |
Alexander Afanasyev | 7c85d57 | 2013-02-26 22:06:54 -0800 | [diff] [blame] | 53 | check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(), |
| 54 | linkflags="-F%s/osx/Frameworks/" % conf.path.abspath()) |
| 55 | conf.env.HAVE_LOCAL_SPARKLE = 1 |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 56 | except: |
Alexander Afanasyev | a1b7bb5 | 2013-02-26 17:04:02 -0800 | [diff] [blame] | 57 | import urllib, subprocess, os, shutil |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 58 | if not os.path.exists('osx/Frameworks/Sparkle.framework'): |
| 59 | # Download to local path and retry |
| 60 | Logs.info ("Sparkle framework not found, trying to download it to 'build/'") |
Alexander Afanasyev | a1b7bb5 | 2013-02-26 17:04:02 -0800 | [diff] [blame] | 61 | |
Alexander Afanasyev | e8496a3 | 2013-03-03 16:10:43 -0800 | [diff] [blame] | 62 | urllib.urlretrieve ("http://sparkle.andymatuschak.org/files/Sparkle%201.5b6.zip", "build/Sparkle.zip") |
| 63 | if os.path.exists('build/Sparkle.zip'): |
| 64 | try: |
| 65 | subprocess.check_call (['unzip', '-qq', 'build/Sparkle.zip', '-d', 'build/Sparkle']) |
| 66 | os.remove ("build/Sparkle.zip") |
| 67 | if not os.path.exists("osx/Frameworks"): |
| 68 | os.mkdir ("osx/Frameworks") |
| 69 | os.rename ("build/Sparkle/Sparkle.framework", "osx/Frameworks/Sparkle.framework") |
| 70 | shutil.rmtree("build/Sparkle", ignore_errors=True) |
| 71 | |
| 72 | check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(), |
| 73 | linkflags="-F%s/osx/Frameworks/" % conf.path.abspath()) |
| 74 | conf.env.HAVE_LOCAL_SPARKLE = 1 |
| 75 | except subprocess.CalledProcessError as e: |
| 76 | conf.fatal("Cannot find Sparkle framework. Auto download failed: '%s' returned %s" % (' '.join(e.cmd), e.returncode)) |
| 77 | except: |
| 78 | conf.fatal("Unknown Error happened when auto downloading Sparkle framework") |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 79 | |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 80 | if conf.is_defined('HAVE_SPARKLE'): |
| 81 | conf.env.HAVE_SPARKLE = 1 # small cheat for wscript |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 82 | |
Alexander Afanasyev | c507ac2 | 2013-01-21 16:01:58 -0800 | [diff] [blame] | 83 | if conf.options.log4cxx: |
| 84 | conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX', mandatory=True) |
| 85 | conf.define ("HAVE_LOG4CXX", 1) |
| 86 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 87 | conf.load ('ndnx') |
Alexander Afanasyev | 3320698 | 2013-01-09 16:29:29 -0800 | [diff] [blame] | 88 | |
| 89 | conf.load('protoc') |
Alexander Afanasyev | 3320698 | 2013-01-09 16:29:29 -0800 | [diff] [blame] | 90 | |
| 91 | conf.load('qt4') |
| 92 | |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 93 | conf.load('boost') |
| 94 | |
Alexander Afanasyev | e1c9504 | 2013-02-27 01:02:36 -0800 | [diff] [blame] | 95 | conf.check_boost(lib='system test iostreams filesystem regex thread date_time') |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 96 | |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 97 | boost_version = conf.env.BOOST_VERSION.split('_') |
| 98 | if int(boost_version[0]) < 1 or int(boost_version[1]) < 46: |
| 99 | Logs.error ("Minumum required boost version is 1.46") |
| 100 | return |
| 101 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 102 | conf.check_ndnx () |
| 103 | conf.check_openssl () |
| 104 | conf.define ('NDNX_PATH', conf.env.NDNX_ROOT) |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 105 | |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 106 | if conf.options._test: |
Alexander Afanasyev | 9e5a470 | 2013-01-24 13:15:23 -0800 | [diff] [blame] | 107 | conf.define ('_TESTS', 1) |
Alexander Afanasyev | 72ac219 | 2013-01-03 19:33:43 -0800 | [diff] [blame] | 108 | conf.env.TEST = 1 |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 109 | |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 110 | conf.write_config_header('src/config.h') |
| 111 | |
Zhenkai Zhu | a7e3da7 | 2012-12-27 13:45:00 -0800 | [diff] [blame] | 112 | def build (bld): |
Zhenkai Zhu | e840942 | 2013-01-28 12:52:17 -0800 | [diff] [blame] | 113 | executor = bld.objects ( |
| 114 | target = "executor", |
| 115 | features = ["cxx"], |
| 116 | source = bld.path.ant_glob(['executor/**/*.cc']), |
| 117 | use = 'BOOST BOOST_THREAD LIBEVENT LIBEVENT_PTHREADS LOG4CXX', |
| 118 | includes = "executor src", |
| 119 | ) |
| 120 | |
Alexander Afanasyev | 3f101ec | 2013-01-17 16:58:03 -0800 | [diff] [blame] | 121 | scheduler = bld.objects ( |
| 122 | target = "scheduler", |
Alexander Afanasyev | 68f2a95 | 2013-01-08 14:34:16 -0800 | [diff] [blame] | 123 | features = ["cxx"], |
Alexander Afanasyev | 3f101ec | 2013-01-17 16:58:03 -0800 | [diff] [blame] | 124 | source = bld.path.ant_glob(['scheduler/**/*.cc']), |
Zhenkai Zhu | e840942 | 2013-01-28 12:52:17 -0800 | [diff] [blame] | 125 | use = 'BOOST BOOST_THREAD LIBEVENT LIBEVENT_PTHREADS LOG4CXX executor', |
Zhenkai Zhu | 1888f74 | 2013-01-28 12:47:33 -0800 | [diff] [blame] | 126 | includes = "scheduler executor src", |
Alexander Afanasyev | 68f2a95 | 2013-01-08 14:34:16 -0800 | [diff] [blame] | 127 | ) |
| 128 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 129 | libndnx = bld ( |
| 130 | target="ndnx", |
Alexander Afanasyev | 3f101ec | 2013-01-17 16:58:03 -0800 | [diff] [blame] | 131 | features=['cxx'], |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 132 | source = bld.path.ant_glob(['ndnx/**/*.cc', 'ndnx/**/*.cpp']), |
| 133 | use = 'TINYXML BOOST BOOST_THREAD SSL NDNX LOG4CXX scheduler executor', |
| 134 | includes = "ndnx src scheduler executor", |
Alexander Afanasyev | f289063 | 2013-01-02 13:40:02 -0800 | [diff] [blame] | 135 | ) |
| 136 | |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 137 | adhoc = bld ( |
| 138 | target = "adhoc", |
| 139 | features=['cxx'], |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 140 | includes = "ndnx src", |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 141 | ) |
| 142 | if Utils.unversioned_sys_platform () == "darwin": |
| 143 | adhoc.mac_app = True |
| 144 | adhoc.source = 'adhoc/adhoc-osx.mm' |
Alexander Afanasyev | 02a86ec | 2013-03-04 13:09:31 -0800 | [diff] [blame] | 145 | adhoc.use = "BOOST BOOST_THREAD BOOST_DATE_TIME LOG4CXX OSX_FOUNDATION OSX_COREWLAN" |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 146 | |
Alexander Afanasyev | 3f101ec | 2013-01-17 16:58:03 -0800 | [diff] [blame] | 147 | chornoshare = bld ( |
| 148 | target="chronoshare", |
| 149 | features=['cxx'], |
| 150 | source = bld.path.ant_glob(['src/**/*.cc', 'src/**/*.cpp', 'src/**/*.proto']), |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 151 | use = "BOOST BOOST_FILESYSTEM BOOST_DATE_TIME SQLITE3 LOG4CXX scheduler ndnx", |
| 152 | includes = "ndnx scheduler src executor", |
Alexander Afanasyev | ee7e613 | 2013-01-03 20:03:14 -0800 | [diff] [blame] | 153 | ) |
Alexander Afanasyev | b2fe74e | 2013-01-20 16:06:43 -0800 | [diff] [blame] | 154 | |
Zhenkai Zhu | 369eff1 | 2013-02-05 15:43:49 -0800 | [diff] [blame] | 155 | fs_watcher = bld ( |
| 156 | target = "fs_watcher", |
| 157 | features = "qt4 cxx", |
| 158 | defines = "WAF", |
| 159 | source = bld.path.ant_glob(['fs-watcher/*.cc']), |
| 160 | use = "SQLITE3 LOG4CXX scheduler executor QTCORE", |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 161 | includes = "ndnx fs-watcher scheduler executor src", |
Zhenkai Zhu | 369eff1 | 2013-02-05 15:43:49 -0800 | [diff] [blame] | 162 | ) |
| 163 | |
Alexander Afanasyev | ee7e613 | 2013-01-03 20:03:14 -0800 | [diff] [blame] | 164 | # Unit tests |
| 165 | if bld.env['TEST']: |
| 166 | unittests = bld.program ( |
| 167 | target="unit-tests", |
Zhenkai Zhu | d175627 | 2013-02-01 17:02:18 -0800 | [diff] [blame] | 168 | features = "qt4 cxx cxxprogram", |
| 169 | defines = "WAF", |
Zhenkai Zhu | 369eff1 | 2013-02-05 15:43:49 -0800 | [diff] [blame] | 170 | source = bld.path.ant_glob(['test/*.cc']), |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 171 | use = 'BOOST_TEST BOOST_FILESYSTEM BOOST_DATE_TIME LOG4CXX SQLITE3 QTCORE QTGUI ndnx database fs_watcher chronoshare', |
| 172 | includes = "ndnx scheduler src executor gui fs-watcher", |
Alexander Afanasyev | 4f62f44 | 2013-02-07 22:36:08 -0800 | [diff] [blame] | 173 | install_prefix = None, |
Alexander Afanasyev | ee7e613 | 2013-01-03 20:03:14 -0800 | [diff] [blame] | 174 | ) |
Alexander Afanasyev | f289063 | 2013-01-02 13:40:02 -0800 | [diff] [blame] | 175 | |
Zhenkai Zhu | a9a7e1d | 2013-02-25 18:29:07 -0800 | [diff] [blame] | 176 | http_server = bld ( |
| 177 | target = "http_server", |
Zhenkai Zhu | d942922 | 2013-02-25 22:34:09 -0800 | [diff] [blame] | 178 | features = "qt4 cxx", |
Zhenkai Zhu | a9a7e1d | 2013-02-25 18:29:07 -0800 | [diff] [blame] | 179 | source = bld.path.ant_glob(['server/*.cpp']), |
Zhenkai Zhu | d942922 | 2013-02-25 22:34:09 -0800 | [diff] [blame] | 180 | includes = "server src .", |
| 181 | use = "BOOST QTCORE" |
Zhenkai Zhu | a9a7e1d | 2013-02-25 18:29:07 -0800 | [diff] [blame] | 182 | ) |
| 183 | |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 184 | qt = bld ( |
| 185 | target = "ChronoShare", |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 186 | features = "qt4 cxx cxxprogram html_resources", |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 187 | defines = "WAF", |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 188 | source = bld.path.ant_glob(['gui/*.cpp', 'gui/*.cc', 'gui/images.qrc']), |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 189 | includes = "ndnx scheduler executor fs-watcher gui src adhoc server . ", |
| 190 | use = "BOOST BOOST_FILESYSTEM BOOST_DATE_TIME SQLITE3 QTCORE QTGUI LOG4CXX fs_watcher ndnx database chronoshare http_server", |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 191 | |
| 192 | html_resources = bld.path.find_dir ("gui/html").ant_glob([ |
| 193 | '**/*.js', '**/*.png', '**/*.css', |
| 194 | '**/*.html', '**/*.gif', '**/*.ico' |
| 195 | ]), |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 196 | ) |
| 197 | |
| 198 | if Utils.unversioned_sys_platform () == "darwin": |
| 199 | app_plist = '''<?xml version="1.0" encoding="UTF-8"?> |
Alexander Afanasyev | 83a5300 | 2013-01-24 11:12:01 -0800 | [diff] [blame] | 200 | <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> |
| 201 | <plist version="0.9"> |
| 202 | <dict> |
| 203 | <key>CFBundlePackageType</key> |
| 204 | <string>APPL</string> |
Zhenkai Zhu | d5d311a | 2013-03-04 15:12:46 -0800 | [diff] [blame] | 205 | <key>CFBundleIconFile</key> |
| 206 | <string>chronoshare.icns</string> |
Alexander Afanasyev | 83a5300 | 2013-01-24 11:12:01 -0800 | [diff] [blame] | 207 | <key>CFBundleGetInfoString</key> |
| 208 | <string>Created by Waf</string> |
Zhenkai Zhu | 3857d71 | 2013-02-27 22:51:25 -0800 | [diff] [blame] | 209 | <key>CFBundleIdentifier</key> |
| 210 | <string>edu.ucla.cs.irl.Chronoshare</string> |
Alexander Afanasyev | 83a5300 | 2013-01-24 11:12:01 -0800 | [diff] [blame] | 211 | <key>CFBundleSignature</key> |
| 212 | <string>????</string> |
| 213 | <key>NOTE</key> |
| 214 | <string>THIS IS A GENERATED FILE, DO NOT MODIFY</string> |
| 215 | <key>CFBundleExecutable</key> |
| 216 | <string>%s</string> |
| 217 | <key>LSUIElement</key> |
| 218 | <string>1</string> |
Zhenkai Zhu | 8e3e907 | 2013-02-28 15:40:51 -0800 | [diff] [blame] | 219 | <key>SUPublicDSAKeyFile</key> |
| 220 | <string>dsa_pub.pem</string> |
Zhenkai Zhu | d5d311a | 2013-03-04 15:12:46 -0800 | [diff] [blame] | 221 | <key>CFBundleIconFile</key> |
| 222 | <string>chronoshare.icns</string> |
Alexander Afanasyev | 83a5300 | 2013-01-24 11:12:01 -0800 | [diff] [blame] | 223 | </dict> |
| 224 | </plist>''' |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 225 | qt.mac_app = "ChronoShare.app" |
| 226 | qt.mac_plist = app_plist % "ChronoShare" |
Zhenkai Zhu | d5d311a | 2013-03-04 15:12:46 -0800 | [diff] [blame] | 227 | qt.mac_resources = 'chronoshare.icns' |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 228 | qt.use += " OSX_FOUNDATION OSX_COREWLAN adhoc" |
Alexander Afanasyev | 83a5300 | 2013-01-24 11:12:01 -0800 | [diff] [blame] | 229 | |
Alexander Afanasyev | 5a95a25 | 2013-02-25 12:55:48 -0800 | [diff] [blame] | 230 | if bld.env['HAVE_SPARKLE']: |
| 231 | qt.use += " OSX_SPARKLE" |
| 232 | qt.source += ["osx/auto-update/sparkle-auto-update.mm"] |
| 233 | qt.includes += " osx/auto-update" |
Alexander Afanasyev | 7c85d57 | 2013-02-26 22:06:54 -0800 | [diff] [blame] | 234 | if bld.env['HAVE_LOCAL_SPARKLE']: |
| 235 | qt.mac_frameworks = "osx/Frameworks/Sparkle.framework" |
Alexander Afanasyev | 548d38d | 2013-01-26 16:36:06 -0800 | [diff] [blame] | 236 | |
Alexander Afanasyev | 0b38ad0 | 2013-03-19 13:42:22 -0700 | [diff] [blame] | 237 | if Utils.unversioned_sys_platform () == "linux": |
| 238 | bld ( |
| 239 | features = "process_in", |
| 240 | target = "ChronoShare.desktop", |
| 241 | source = "ChronoShare.desktop.in", |
| 242 | install_prefix = "${DATADIR}/applications", |
| 243 | ) |
| 244 | bld.install_files ("${DATADIR}/applications", "ChronoShare.desktop") |
| 245 | bld.install_files ("${DATADIR}/ChronoShare", "gui/images/chronoshare-big.png") |
| 246 | |
Alexander Afanasyev | 548d38d | 2013-01-26 16:36:06 -0800 | [diff] [blame] | 247 | cmdline = bld ( |
| 248 | target = "csd", |
| 249 | features = "qt4 cxx cxxprogram", |
| 250 | defines = "WAF", |
Zhenkai Zhu | 369eff1 | 2013-02-05 15:43:49 -0800 | [diff] [blame] | 251 | source = "cmd/csd.cc", |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 252 | includes = "ndnx scheduler executor gui fs-watcher src . ", |
| 253 | use = "BOOST BOOST_FILESYSTEM BOOST_DATE_TIME SQLITE3 QTCORE QTGUI LOG4CXX fs_watcher ndnx database chronoshare" |
Alexander Afanasyev | 548d38d | 2013-01-26 16:36:06 -0800 | [diff] [blame] | 254 | ) |
| 255 | |
Alexander Afanasyev | eb575e0 | 2013-01-26 17:14:51 -0800 | [diff] [blame] | 256 | dump_db = bld ( |
| 257 | target = "dump-db", |
| 258 | features = "cxx cxxprogram", |
| 259 | source = "cmd/dump-db.cc", |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 260 | includes = "ndnx scheduler executor gui fs-watcher src . ", |
| 261 | use = "BOOST BOOST_FILESYSTEM BOOST_DATE_TIME SQLITE3 QTCORE LOG4CXX fs_watcher ndnx database chronoshare" |
Alexander Afanasyev | eb575e0 | 2013-01-26 17:14:51 -0800 | [diff] [blame] | 262 | ) |
| 263 | |
Alexander Afanasyev | a98e69c | 2013-02-24 15:42:45 -0800 | [diff] [blame] | 264 | from waflib import TaskGen |
| 265 | @TaskGen.extension('.mm') |
| 266 | def m_hook(self, node): |
| 267 | """Alias .mm files to be compiled the same as .cc files, gcc/clang will do the right thing.""" |
| 268 | return self.create_compiled_task('cxx', node) |
Zhenkai Zhu | 6b53f93 | 2013-03-02 20:46:02 -0800 | [diff] [blame] | 269 | |
Alexander Afanasyev | 0b38ad0 | 2013-03-19 13:42:22 -0700 | [diff] [blame] | 270 | @TaskGen.extension('.js', '.png', '.css', '.html', '.gif', '.ico', '.in') |
Alexander Afanasyev | caf48e2 | 2013-03-02 22:47:32 -0800 | [diff] [blame] | 271 | def sig_hook(self, node): |
| 272 | node.sig=Utils.h_file (node.abspath()) |
Zhenkai Zhu | 6b53f93 | 2013-03-02 20:46:02 -0800 | [diff] [blame] | 273 | |
Alexander Afanasyev | 0b38ad0 | 2013-03-19 13:42:22 -0700 | [diff] [blame] | 274 | @TaskGen.feature('process_in') |
| 275 | @TaskGen.after_method('process_source') |
| 276 | def create_process_in(self): |
| 277 | dst = self.bld.path.find_or_declare (self.target) |
| 278 | tsk = self.create_task ('process_in', self.source, dst) |
| 279 | |
| 280 | class process_in(Task.Task): |
| 281 | color='PINK' |
| 282 | |
| 283 | def run (self): |
| 284 | self.outputs[0].write (Utils.subst_vars(self.inputs[0].read (), self.env)) |
| 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 |