-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteapot.rb
101 lines (69 loc) · 2.64 KB
/
teapot.rb
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
#
# This file is part of the "Teapot" project, and is released under the MIT license.
#
teapot_version "3.0"
# Project Metadata
define_project "async-http" do |project|
project.title = "Async HTTP"
project.summary = 'Provides HTTP/1.x client and server implementations.'
project.license = "MIT License"
project.add_author 'Samuel Williams', email: '[email protected]'
project.version = "1.0.0"
end
# Build Targets
define_target 'async-http-headers' do |target|
source_root = target.package.path + 'source'
target.provides "Headers/AsyncHTTP" do
append header_search_paths source_root
end
end
define_target 'async-http-library' do |target|
target.depends "Language/C++14"
target.depends "Library/AsyncNetwork", public: true
target.depends "Library/URI", public: true
target.depends "Library/Memory", public: true
target.depends "Library/Logger", public: true
target.depends "Convert/Ragel"
target.depends "Headers/AsyncHTTP", public: true
target.provides "Library/AsyncHTTP" do
source_root = target.package.path + 'source'
cache_prefix = environment[:build_prefix] + environment.checksum
parsers = source_root.glob('Async/HTTP/**/*Parser.rl')
implementation_files = parsers.collect do |file|
implementation_file = cache_prefix / (file.relative_path + '.cpp')
convert source_file: file, destination_path: implementation_file
end
library_path = build static_library: "AsyncHTTP", source_files: source_root.glob('Async/HTTP/**/*.cpp') + implementation_files
append linkflags library_path
end
end
define_target "async-http-tests" do |target|
target.depends 'Library/UnitTest'
target.depends "Language/C++14"
target.depends "Library/AsyncHTTP"
target.provides "Test/AsyncHTTP" do |*arguments|
test_root = target.package.path + 'test'
run source_files: test_root.glob('Async/HTTP/**/*.cpp'), arguments: arguments
end
end
# Configurations
define_configuration "development" do |configuration|
configuration[:source] = "https://github.com/kurocha/"
configuration.import "async-http"
# Provides all the build related infrastructure:
configuration.require "platforms"
configuration.require "build-files"
# Provides unit testing infrastructure and generators:
configuration.require "unit-test"
# Provides some useful C++ generators:
configuration.require "generate-travis"
configuration.require "generate-project"
configuration.require "generate-cpp-class"
end
define_configuration "async-http" do |configuration|
configuration.public!
configuration.require "async-network"
configuration.require "logger"
configuration.require "memory"
configuration.require "ragel"
end