cxxproject 0.5.76 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile.rb +116 -116
- data/bin/cxx +10 -10
- data/lib/cxxproject/buildingblocks/binary_library.rb +39 -39
- data/lib/cxxproject/buildingblocks/building_block.rb +251 -234
- data/lib/cxxproject/buildingblocks/command_line.rb +79 -86
- data/lib/cxxproject/buildingblocks/custom_building_block.rb +39 -39
- data/lib/cxxproject/buildingblocks/executable.rb +246 -258
- data/lib/cxxproject/buildingblocks/has_dependencies_mixin.rb +83 -83
- data/lib/cxxproject/buildingblocks/has_includes_mixin.rb +20 -20
- data/lib/cxxproject/buildingblocks/has_libraries_mixin.rb +34 -34
- data/lib/cxxproject/buildingblocks/has_sources_mixin.rb +371 -379
- data/lib/cxxproject/buildingblocks/makefile.rb +153 -153
- data/lib/cxxproject/buildingblocks/module.rb +35 -35
- data/lib/cxxproject/buildingblocks/single_source.rb +33 -33
- data/lib/cxxproject/buildingblocks/source_library.rb +124 -111
- data/lib/cxxproject/errorparser/diab_compiler_error_parser.rb +40 -40
- data/lib/cxxproject/errorparser/diab_linker_error_parser.rb +41 -41
- data/lib/cxxproject/errorparser/error_parser.rb +50 -71
- data/lib/cxxproject/errorparser/gcc_compiler_error_parser.rb +35 -35
- data/lib/cxxproject/errorparser/gcc_linker_error_parser.rb +35 -35
- data/lib/cxxproject/errorparser/ti_compiler_error_parser.rb +30 -30
- data/lib/cxxproject/errorparser/ti_linker_error_parser.rb +30 -30
- data/lib/cxxproject/eval_context.rb +144 -144
- data/lib/cxxproject/ext/file.rb +71 -81
- data/lib/cxxproject/ext/filelist.rb +6 -6
- data/lib/cxxproject/ext/progressbar.rb +20 -0
- data/lib/cxxproject/ext/rake.rb +419 -434
- data/lib/cxxproject/ext/rake_dirty.rb +30 -30
- data/lib/cxxproject/ext/rake_listener.rb +59 -59
- data/lib/cxxproject/ext/stdout.rb +44 -44
- data/lib/cxxproject/ext/string.rb +9 -9
- data/lib/cxxproject/ide_interface.rb +187 -189
- data/lib/cxxproject/toolchain/clang.rb +39 -43
- data/lib/cxxproject/toolchain/colorizing_formatter.rb +99 -99
- data/lib/cxxproject/toolchain/diab.rb +1 -1
- data/lib/cxxproject/toolchain/gcc.rb +1 -1
- data/lib/cxxproject/toolchain/provider.rb +131 -143
- data/lib/cxxproject/toolchain/toolchain.rb +38 -38
- data/lib/cxxproject/toolchain/toolchain_benchmark.rb +23 -23
- data/lib/cxxproject/torake.rb +259 -218
- data/lib/cxxproject/utils/cleanup.rb +20 -24
- data/lib/cxxproject/utils/console.rb +6 -6
- data/lib/cxxproject/utils/exit_helper.rb +40 -40
- data/lib/cxxproject/utils/graphstream.rb +154 -154
- data/lib/cxxproject/utils/optional.rb +16 -16
- data/lib/cxxproject/utils/printer.rb +50 -50
- data/lib/cxxproject/utils/process.rb +52 -58
- data/lib/cxxproject/utils/progress.rb +66 -0
- data/lib/cxxproject/utils/progress_helper.rb +77 -0
- data/lib/cxxproject/utils/rbcurse.rb +284 -0
- data/lib/cxxproject/utils/rbcurse_executable_ext.rb +14 -0
- data/lib/cxxproject/utils/rbcurse_progress.rb +71 -0
- data/lib/cxxproject/utils/rbcurse_tasktable.rb +51 -0
- data/lib/cxxproject/utils/stats.rb +60 -60
- data/lib/cxxproject/utils/ubigraph.rb +228 -228
- data/lib/cxxproject/utils/utils.rb +37 -69
- data/lib/cxxproject/version.rb +7 -7
- data/lib/cxxproject.rb +23 -19
- data/lib/tools/Rakefile.rb.template +10 -10
- data/lib/tools/project.rb.template +6 -6
- data/lib/tools/project_wizard.rb +66 -66
- data/spec/building_block_spec.rb +56 -56
- data/spec/cxxproject_2_rake_spec.rb +186 -186
- data/spec/file_ext_spec.rb +30 -30
- data/spec/ide_interface_spec.rb +41 -41
- data/spec/object_dependency_spec.rb +83 -83
- data/spec/project_path_spec.rb +71 -71
- data/spec/rake_listener_ext_spec.rb +58 -58
- data/spec/spec_helper.rb +18 -18
- data/spec/string_spec.rb +11 -11
- data/spec/testdata/basic/exe12/project.rb +5 -5
- data/spec/testdata/basic/lib1/project.rb +5 -5
- data/spec/testdata/basic/lib2/project.rb +8 -8
- data/spec/testdata/multiple_levels/libs/lib1/project.rb +5 -5
- data/spec/testdata/multiple_levels/libs/lib2/project.rb +19 -19
- data/spec/testdata/multiple_levels/mainproject/basic/project.rb +8 -8
- data/spec/testdata/onlyOneHeader/Rakefile.rb +4 -4
- data/spec/testdata/onlyOneHeader/project.rb +4 -4
- data/spec/toolchain_spec.rb +29 -29
- metadata +116 -107
- checksums.yaml +0 -7
- data/lib/cxxproject/buildingblocks/lint.rb +0 -89
- data/lib/cxxproject/errorparser/gcc_lint_error_parser.rb +0 -34
- data/lib/cxxproject/errorparser/greenhills_compiler_error_parser.rb +0 -32
- data/lib/cxxproject/errorparser/greenhills_linker_error_parser.rb +0 -44
- data/lib/cxxproject/errorparser/keil_compiler_error_parser.rb +0 -40
- data/lib/cxxproject/errorparser/keil_linker_error_parser.rb +0 -30
- data/lib/cxxproject/toolchain/gcc_lint.rb +0 -21
- data/lib/cxxproject/toolchain/gcc_param.rb +0 -7
- data/lib/cxxproject/toolchain/greenhills.rb +0 -51
- data/lib/cxxproject/toolchain/keil.rb +0 -52
- data/lib/cxxproject/utils/valgrind.rb +0 -11
@@ -1,43 +1,39 @@
|
|
1
|
-
require 'cxxproject/utils/utils'
|
2
|
-
require 'cxxproject/toolchain/provider'
|
3
|
-
require 'cxxproject/errorparser/error_parser'
|
4
|
-
require 'cxxproject/errorparser/gcc_compiler_error_parser'
|
5
|
-
|
6
|
-
|
7
|
-
module
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
CLANG_CHAIN[:COMPILER][:C] =
|
24
|
-
CLANG_CHAIN[:COMPILER][:C][:
|
25
|
-
|
26
|
-
|
27
|
-
CLANG_CHAIN[:COMPILER][:ASM] =
|
28
|
-
|
29
|
-
|
30
|
-
CLANG_CHAIN[:ARCHIVER][:
|
31
|
-
|
32
|
-
CLANG_CHAIN[:
|
33
|
-
|
34
|
-
CLANG_CHAIN[:LINKER][:
|
35
|
-
CLANG_CHAIN[:LINKER][:
|
36
|
-
CLANG_CHAIN[:LINKER][:
|
37
|
-
CLANG_CHAIN[:LINKER][:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
CLANG_CHAIN[:LINKER][:ERROR_PARSER] = GCCLinkerErrorParser.new
|
42
|
-
end
|
43
|
-
end
|
1
|
+
require 'cxxproject/utils/utils'
|
2
|
+
require 'cxxproject/toolchain/provider'
|
3
|
+
require 'cxxproject/errorparser/error_parser'
|
4
|
+
require 'cxxproject/errorparser/gcc_compiler_error_parser'
|
5
|
+
|
6
|
+
module Cxxproject
|
7
|
+
module Toolchain
|
8
|
+
gccCompilerErrorParser = GCCCompilerErrorParser.new
|
9
|
+
|
10
|
+
CLANG_CHAIN = Provider.add("CLANG")
|
11
|
+
|
12
|
+
CLANG_CHAIN[:COMPILER][:CPP].update({
|
13
|
+
:COMMAND => "llvm-g++",
|
14
|
+
:DEFINE_FLAG => "-D",
|
15
|
+
:OBJECT_FILE_FLAG => "-o",
|
16
|
+
:INCLUDE_PATH_FLAG => "-I",
|
17
|
+
:COMPILE_FLAGS => "-c ",
|
18
|
+
:DEP_FLAGS => "-MMD -MF ", # empty space at the end is important!
|
19
|
+
:ERROR_PARSER => gccCompilerErrorParser
|
20
|
+
})
|
21
|
+
|
22
|
+
CLANG_CHAIN[:COMPILER][:C] = Utils.deep_copy(CLANG_CHAIN[:COMPILER][:CPP])
|
23
|
+
CLANG_CHAIN[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
|
24
|
+
CLANG_CHAIN[:COMPILER][:C][:COMMAND] = "llvm-gcc"
|
25
|
+
|
26
|
+
CLANG_CHAIN[:COMPILER][:ASM] = Utils.deep_copy(CLANG_CHAIN[:COMPILER][:C])
|
27
|
+
CLANG_CHAIN[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
|
28
|
+
|
29
|
+
CLANG_CHAIN[:ARCHIVER][:COMMAND] = "ar"
|
30
|
+
CLANG_CHAIN[:ARCHIVER][:ARCHIVE_FLAGS] = "r"
|
31
|
+
|
32
|
+
CLANG_CHAIN[:LINKER][:COMMAND] = "llvm-g++"
|
33
|
+
CLANG_CHAIN[:LINKER][:SCRIPT] = "-T"
|
34
|
+
CLANG_CHAIN[:LINKER][:USER_LIB_FLAG] = "-l:"
|
35
|
+
CLANG_CHAIN[:LINKER][:EXE_FLAG] = "-o"
|
36
|
+
CLANG_CHAIN[:LINKER][:LIB_FLAG] = "-l"
|
37
|
+
CLANG_CHAIN[:LINKER][:LIB_PATH_FLAG] = "-L"
|
38
|
+
end
|
39
|
+
end
|
@@ -1,99 +1,99 @@
|
|
1
|
-
require 'cxxproject/utils/optional'
|
2
|
-
|
3
|
-
module Cxxproject
|
4
|
-
include Utils
|
5
|
-
|
6
|
-
class ColorizingFormatter
|
7
|
-
class << self
|
8
|
-
attr_accessor :enabled
|
9
|
-
end
|
10
|
-
def enabled?
|
11
|
-
false
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
define_colorizin_formatter = lambda do
|
16
|
-
require 'colored'
|
17
|
-
|
18
|
-
# simple class to colorize compiler output
|
19
|
-
# the class depends on the rainbow gem
|
20
|
-
class ColorizingFormatter
|
21
|
-
|
22
|
-
# colors are not instance vars due to caching the building blocks
|
23
|
-
def self.setColorScheme(scheme)
|
24
|
-
if scheme == :black
|
25
|
-
@@warning_color = :yellow
|
26
|
-
@@error_color = :red
|
27
|
-
@@info_color = :white
|
28
|
-
@@additional_info_color = :cyan
|
29
|
-
@@success_color = :green
|
30
|
-
elsif scheme == :white
|
31
|
-
@@warning_color = :magenta
|
32
|
-
@@error_color = :red
|
33
|
-
@@info_color = :black
|
34
|
-
@@additional_info_color = :blue
|
35
|
-
@@success_color = :green
|
36
|
-
end
|
37
|
-
end
|
38
|
-
ColorizingFormatter.setColorScheme(:black) # default
|
39
|
-
|
40
|
-
def printError(str)
|
41
|
-
[@@error_color,:bold].inject(str) {|m,x| m.send(x)}
|
42
|
-
end
|
43
|
-
|
44
|
-
def printWarning(str)
|
45
|
-
[@@warning_color,:bold].inject(str) {|m,x| m.send(x)}
|
46
|
-
end
|
47
|
-
|
48
|
-
def printInfo(str)
|
49
|
-
[@@info_color,:bold].inject(str) {|m,x| m.send(x)}
|
50
|
-
end
|
51
|
-
|
52
|
-
def printAdditionalInfo(str)
|
53
|
-
[@@additional_info_color,:bold].inject(str) {|m,x| m.send(x)}
|
54
|
-
end
|
55
|
-
|
56
|
-
def printSuccess(str)
|
57
|
-
[@@success_color,:bold].inject(str) {|m,x| m.send(x)}
|
58
|
-
end
|
59
|
-
|
60
|
-
# formats several lines of usually compiler output
|
61
|
-
def format(compiler_output, error_descs, error_parser)
|
62
|
-
return compiler_output if not enabled?
|
63
|
-
res = ""
|
64
|
-
begin
|
65
|
-
zipped = compiler_output.split($/).zip(error_descs)
|
66
|
-
zipped.each do |l,desc|
|
67
|
-
if desc.severity != 255
|
68
|
-
coloring = {}
|
69
|
-
if desc.severity == ErrorParser::SEVERITY_WARNING
|
70
|
-
res << printWarning(l)
|
71
|
-
elsif desc.severity == ErrorParser::SEVERITY_ERROR
|
72
|
-
res << printError(l)
|
73
|
-
else
|
74
|
-
res << printInfo(l)
|
75
|
-
end
|
76
|
-
else
|
77
|
-
res << l
|
78
|
-
end
|
79
|
-
res << "\n"
|
80
|
-
end
|
81
|
-
rescue Exception => e
|
82
|
-
puts "Error while parsing compiler output: #{e}"
|
83
|
-
return compiler_output
|
84
|
-
end
|
85
|
-
res
|
86
|
-
end
|
87
|
-
|
88
|
-
# getter to access the static variable with an instance
|
89
|
-
def enabled?
|
90
|
-
return ColorizingFormatter.enabled
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
|
95
|
-
end
|
96
|
-
|
97
|
-
Utils.optional_package(define_colorizin_formatter, nil)
|
98
|
-
|
99
|
-
end
|
1
|
+
require 'cxxproject/utils/optional'
|
2
|
+
|
3
|
+
module Cxxproject
|
4
|
+
include Utils
|
5
|
+
|
6
|
+
class ColorizingFormatter
|
7
|
+
class << self
|
8
|
+
attr_accessor :enabled
|
9
|
+
end
|
10
|
+
def enabled?
|
11
|
+
false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
define_colorizin_formatter = lambda do
|
16
|
+
require 'colored'
|
17
|
+
|
18
|
+
# simple class to colorize compiler output
|
19
|
+
# the class depends on the rainbow gem
|
20
|
+
class ColorizingFormatter
|
21
|
+
|
22
|
+
# colors are not instance vars due to caching the building blocks
|
23
|
+
def self.setColorScheme(scheme)
|
24
|
+
if scheme == :black
|
25
|
+
@@warning_color = :yellow
|
26
|
+
@@error_color = :red
|
27
|
+
@@info_color = :white
|
28
|
+
@@additional_info_color = :cyan
|
29
|
+
@@success_color = :green
|
30
|
+
elsif scheme == :white
|
31
|
+
@@warning_color = :magenta
|
32
|
+
@@error_color = :red
|
33
|
+
@@info_color = :black
|
34
|
+
@@additional_info_color = :blue
|
35
|
+
@@success_color = :green
|
36
|
+
end
|
37
|
+
end
|
38
|
+
ColorizingFormatter.setColorScheme(:black) # default
|
39
|
+
|
40
|
+
def printError(str)
|
41
|
+
[@@error_color,:bold].inject(str) {|m,x| m.send(x)}
|
42
|
+
end
|
43
|
+
|
44
|
+
def printWarning(str)
|
45
|
+
[@@warning_color,:bold].inject(str) {|m,x| m.send(x)}
|
46
|
+
end
|
47
|
+
|
48
|
+
def printInfo(str)
|
49
|
+
[@@info_color,:bold].inject(str) {|m,x| m.send(x)}
|
50
|
+
end
|
51
|
+
|
52
|
+
def printAdditionalInfo(str)
|
53
|
+
[@@additional_info_color,:bold].inject(str) {|m,x| m.send(x)}
|
54
|
+
end
|
55
|
+
|
56
|
+
def printSuccess(str)
|
57
|
+
[@@success_color,:bold].inject(str) {|m,x| m.send(x)}
|
58
|
+
end
|
59
|
+
|
60
|
+
# formats several lines of usually compiler output
|
61
|
+
def format(compiler_output, error_descs, error_parser)
|
62
|
+
return compiler_output if not enabled?
|
63
|
+
res = ""
|
64
|
+
begin
|
65
|
+
zipped = compiler_output.split($/).zip(error_descs)
|
66
|
+
zipped.each do |l,desc|
|
67
|
+
if desc.severity != 255
|
68
|
+
coloring = {}
|
69
|
+
if desc.severity == ErrorParser::SEVERITY_WARNING
|
70
|
+
res << printWarning(l)
|
71
|
+
elsif desc.severity == ErrorParser::SEVERITY_ERROR
|
72
|
+
res << printError(l)
|
73
|
+
else
|
74
|
+
res << printInfo(l)
|
75
|
+
end
|
76
|
+
else
|
77
|
+
res << l
|
78
|
+
end
|
79
|
+
res << "\n"
|
80
|
+
end
|
81
|
+
rescue Exception => e
|
82
|
+
puts "Error while parsing compiler output: #{e}"
|
83
|
+
return compiler_output
|
84
|
+
end
|
85
|
+
res
|
86
|
+
end
|
87
|
+
|
88
|
+
# getter to access the static variable with an instance
|
89
|
+
def enabled?
|
90
|
+
return ColorizingFormatter.enabled
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
Utils.optional_package(define_colorizin_formatter, nil)
|
98
|
+
|
99
|
+
end
|
@@ -15,7 +15,7 @@ module Cxxproject
|
|
15
15
|
:OBJECT_FILE_FLAG => "-o ",
|
16
16
|
:INCLUDE_PATH_FLAG => "-I",
|
17
17
|
:COMPILE_FLAGS => "-c",
|
18
|
-
:DEP_FLAGS => "-Xmake-dependency=
|
18
|
+
:DEP_FLAGS => "-Xmake-dependency=6 -Xmake-dependency-savefile=",
|
19
19
|
:DEP_FLAGS_SPACE => false,
|
20
20
|
:PREPRO_FLAGS => "-P"
|
21
21
|
})
|
@@ -1,143 +1,131 @@
|
|
1
|
-
require 'cxxproject/toolchain/colorizing_formatter'
|
2
|
-
|
3
|
-
module Cxxproject
|
4
|
-
module Toolchain
|
5
|
-
|
6
|
-
class Provider
|
7
|
-
@@settings = {}
|
8
|
-
@@default = {
|
9
|
-
:COMPILER =>
|
10
|
-
{
|
11
|
-
:CPP => {
|
12
|
-
:COMMAND => "",
|
13
|
-
:DEFINE_FLAG => "",
|
14
|
-
:OBJECT_FILE_FLAG => "",
|
15
|
-
:INCLUDE_PATH_FLAG => "",
|
16
|
-
:COMPILE_FLAGS => "",
|
17
|
-
:DEFINES => [],
|
18
|
-
:FLAGS => "",
|
19
|
-
:SOURCE_FILE_ENDINGS => [".cxx", ".cpp", ".c++", ".cc", ".C"],
|
20
|
-
:DEP_FLAGS => "",
|
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
|
-
@@settings[
|
102
|
-
chain
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
end
|
133
|
-
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
require 'cxxproject/toolchain/diab'
|
138
|
-
require 'cxxproject/toolchain/gcc'
|
139
|
-
require 'cxxproject/toolchain/gcc_lint'
|
140
|
-
require 'cxxproject/toolchain/clang'
|
141
|
-
require 'cxxproject/toolchain/ti'
|
142
|
-
require 'cxxproject/toolchain/greenhills'
|
143
|
-
require 'cxxproject/toolchain/keil'
|
1
|
+
require 'cxxproject/toolchain/colorizing_formatter'
|
2
|
+
|
3
|
+
module Cxxproject
|
4
|
+
module Toolchain
|
5
|
+
|
6
|
+
class Provider
|
7
|
+
@@settings = {}
|
8
|
+
@@default = {
|
9
|
+
:COMPILER =>
|
10
|
+
{
|
11
|
+
:CPP => {
|
12
|
+
:COMMAND => "",
|
13
|
+
:DEFINE_FLAG => "",
|
14
|
+
:OBJECT_FILE_FLAG => "",
|
15
|
+
:INCLUDE_PATH_FLAG => "",
|
16
|
+
:COMPILE_FLAGS => "",
|
17
|
+
:DEFINES => [],
|
18
|
+
:FLAGS => "",
|
19
|
+
:SOURCE_FILE_ENDINGS => [".cxx", ".cpp", ".c++", ".cc", ".C"],
|
20
|
+
:DEP_FLAGS => "",
|
21
|
+
:DEP_FLAGS => true,
|
22
|
+
:ERROR_PARSER => nil,
|
23
|
+
:PREPRO_FLAGS => ""
|
24
|
+
},
|
25
|
+
:C => {
|
26
|
+
:COMMAND => "",
|
27
|
+
:DEFINE_FLAG => "",
|
28
|
+
:OBJECT_FILE_FLAG => "",
|
29
|
+
:INCLUDE_PATH_FLAG => "",
|
30
|
+
:COMPILE_FLAGS => "",
|
31
|
+
:DEFINES => [],
|
32
|
+
:FLAGS => "",
|
33
|
+
:SOURCE_FILE_ENDINGS => [".c"],
|
34
|
+
:DEP_FLAGS => "",
|
35
|
+
:ERROR_PARSER => nil,
|
36
|
+
:PREPRO_FLAGS => ""
|
37
|
+
},
|
38
|
+
:ASM => {
|
39
|
+
:COMMAND => "",
|
40
|
+
:DEFINE_FLAG => "",
|
41
|
+
:OBJECT_FILE_FLAG => "",
|
42
|
+
:INCLUDE_PATH_FLAG => "",
|
43
|
+
:COMPILE_FLAGS => "",
|
44
|
+
:DEFINES => [],
|
45
|
+
:FLAGS => "",
|
46
|
+
:SOURCE_FILE_ENDINGS => [".asm", ".s", ".S"],
|
47
|
+
:DEP_FLAGS => "",
|
48
|
+
:ERROR_PARSER => nil,
|
49
|
+
:PREPRO_FLAGS => ""
|
50
|
+
}
|
51
|
+
},
|
52
|
+
|
53
|
+
:ARCHIVER =>
|
54
|
+
{
|
55
|
+
:COMMAND => "",
|
56
|
+
:ARCHIVE_FLAGS => "",
|
57
|
+
:FLAGS => "",
|
58
|
+
:ERROR_PARSER => nil
|
59
|
+
},
|
60
|
+
|
61
|
+
:LINKER =>
|
62
|
+
{
|
63
|
+
:COMMAND => "",
|
64
|
+
:MUST_FLAGS => "",
|
65
|
+
:SCRIPT => "",
|
66
|
+
:USER_LIB_FLAG => "",
|
67
|
+
:EXE_FLAG => "",
|
68
|
+
:LIB_FLAG => "",
|
69
|
+
:LIB_PATH_FLAG => "",
|
70
|
+
:LIB_PREFIX_FLAGS => "", # "-Wl,--whole-archive",
|
71
|
+
:LIB_POSTFIX_FLAGS => "", # "-Wl,--no-whole-archive",
|
72
|
+
:FLAGS => "",
|
73
|
+
:MAP_FILE_FLAG => "",
|
74
|
+
:OUTPUT_ENDING => ".exe", # or .elf
|
75
|
+
:ERROR_PARSER => nil
|
76
|
+
},
|
77
|
+
|
78
|
+
:MAKE =>
|
79
|
+
{
|
80
|
+
:COMMAND => "make",
|
81
|
+
:FLAGS => "-j",
|
82
|
+
:FILE_FLAG => "-f",
|
83
|
+
:DIR_FLAG => "-C",
|
84
|
+
:CLEAN => "clean"
|
85
|
+
},
|
86
|
+
|
87
|
+
:CONSOLE_HIGHLIGHTER => ColorizingFormatter.new
|
88
|
+
}
|
89
|
+
|
90
|
+
def self.add(name, basedOn = nil)
|
91
|
+
chain = Marshal.load(Marshal.dump(basedOn.nil? ? @@default : @@settings[basedOn]))
|
92
|
+
@@settings[name] = chain
|
93
|
+
chain
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.default
|
97
|
+
@@default
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.modify_cpp_compiler(based_on, h)
|
101
|
+
chain = Marshal.load(Marshal.dump(@@settings[based_on]))
|
102
|
+
chain[:COMPILER][:CPP].update(h)
|
103
|
+
chain
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.[](name)
|
107
|
+
|
108
|
+
if name == "TI"
|
109
|
+
if not ENV['TI_HOME']
|
110
|
+
Printer.printError "Error: Please set TI_HOME"
|
111
|
+
ExitHelper.exit(1)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
return @@settings[name] if @@settings.include? name
|
116
|
+
nil
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.list
|
120
|
+
return @@settings
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
require 'cxxproject/toolchain/diab'
|
129
|
+
require 'cxxproject/toolchain/gcc'
|
130
|
+
require 'cxxproject/toolchain/clang'
|
131
|
+
require 'cxxproject/toolchain/ti'
|
@@ -1,38 +1,38 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
class Hash
|
4
|
-
def method_missing(m, *args, &block)
|
5
|
-
if m.to_s =~ /(.*)=$/ # was assignment
|
6
|
-
self[$1] = args[0]
|
7
|
-
else
|
8
|
-
fetch(m.to_s, nil)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
def recursive_merge(h)
|
12
|
-
self.merge!(h) {|key, _old, _new| if _old.class == Hash then _old.recursive_merge(_new) else _new end }
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
class Toolchain
|
18
|
-
attr_reader :toolchain
|
19
|
-
def initialize(toolchain_file)
|
20
|
-
@toolchain = YAML::load(File.open(toolchain_file))
|
21
|
-
if @toolchain.base
|
22
|
-
@based_on = @toolchain.base
|
23
|
-
else
|
24
|
-
@based_on = "base"
|
25
|
-
end
|
26
|
-
basechain = YAML::load(File.open(File.join(File.dirname(__FILE__),"#{@based_on}.json")))
|
27
|
-
@toolchain = basechain.recursive_merge(@toolchain)
|
28
|
-
end
|
29
|
-
def method_missing(m, *args, &block)
|
30
|
-
if @toolchain[m.to_s]
|
31
|
-
self.class.send(:define_method, m) { @toolchain[m.to_s] }
|
32
|
-
@toolchain[m.to_s]
|
33
|
-
else
|
34
|
-
return super
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
class Hash
|
4
|
+
def method_missing(m, *args, &block)
|
5
|
+
if m.to_s =~ /(.*)=$/ # was assignment
|
6
|
+
self[$1] = args[0]
|
7
|
+
else
|
8
|
+
fetch(m.to_s, nil)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
def recursive_merge(h)
|
12
|
+
self.merge!(h) {|key, _old, _new| if _old.class == Hash then _old.recursive_merge(_new) else _new end }
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
class Toolchain
|
18
|
+
attr_reader :toolchain
|
19
|
+
def initialize(toolchain_file)
|
20
|
+
@toolchain = YAML::load(File.open(toolchain_file))
|
21
|
+
if @toolchain.base
|
22
|
+
@based_on = @toolchain.base
|
23
|
+
else
|
24
|
+
@based_on = "base"
|
25
|
+
end
|
26
|
+
basechain = YAML::load(File.open(File.join(File.dirname(__FILE__),"#{@based_on}.json")))
|
27
|
+
@toolchain = basechain.recursive_merge(@toolchain)
|
28
|
+
end
|
29
|
+
def method_missing(m, *args, &block)
|
30
|
+
if @toolchain[m.to_s]
|
31
|
+
self.class.send(:define_method, m) { @toolchain[m.to_s] }
|
32
|
+
@toolchain[m.to_s]
|
33
|
+
else
|
34
|
+
return super
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|