-
Notifications
You must be signed in to change notification settings - Fork 3
/
amio.ambuild
98 lines (92 loc) · 2.83 KB
/
amio.ambuild
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
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
#
# Copyright (C) 2004-2014 David Anderson
#
# This file is part of AMIO.
#
# AMIO is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# AMIO is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# AMIO. If not, see http://www.gnu.org/licenses/.
#
import os
### CLI
def Configure(binary):
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath),
os.path.join(builder.sourcePath, 'include'),
]
binary.sources += [
'shared/shared-errors.cc',
'shared/shared-string.cc',
'shared/shared-net.cc',
'shared/shared-task-queue.cc',
]
if builder.target_platform != 'windows':
binary.sources += [
'posix/posix-utils.cc',
'posix/posix-base-poller.cc',
'posix/posix-errors.cc',
'posix/posix-event-loop.cc',
'posix/posix-event-queue.cc',
'posix/posix-transport.cc',
'posix/posix-select.cc',
'posix/posix-poll.cc',
'posix/posix-net.cc',
]
binary.compiler.cflags += ['-fPIC']
if builder.target_platform != 'mac':
binary.sources += [
'posix/posix-time.cc',
]
else:
binary.sources += [
'bsd/mach-time.cc',
]
if builder.target_platform == 'linux':
binary.sources += [
'linux/linux-utils.cc',
'linux/linux-epoll.cc',
]
elif builder.target_platform in ['mac', 'freebsd', 'openbsd', 'netbsd']:
binary.sources += [
'bsd/bsd-utils.cc',
'bsd/bsd-kqueue.cc',
]
elif builder.target_platform == 'windows':
binary.sources += [
'windows/windows-base-poller.cc',
'windows/windows-context.cc',
'windows/windows-errors.cc',
'windows/windows-event-loop.cc',
'windows/windows-file.cc',
'windows/windows-iocp.cc',
'windows/windows-net.cc',
'windows/windows-socket.cc',
'windows/windows-time.cc',
'windows/windows-transport.cc',
'windows/windows-util.cc',
]
elif builder.target_platform == 'solaris':
binary.sources += [
'solaris/solaris-utils.cc',
'solaris/solaris-devpoll.cc',
'solaris/solaris-port.cc',
]
return binary
static_lib = builder.compiler.StaticLibrary('amio.a')
static_lib = Configure(static_lib)
KE.static_lib = builder.Add(static_lib)
dynamic_lib = builder.compiler.Library('libamio')
dynamic_lib.compiler.defines += [
'KE_EXPORTING',
]
dynamic_lib = Configure(dynamic_lib)
KE.dynamic_lib = builder.Add(dynamic_lib)