Mxx_ru 1.6.10.1 → 1.6.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS +17 -0
- data/lib/mxx_ru/cpp.rb +3 -1
- data/lib/mxx_ru/cpp/ext_cmake_project.rb +473 -0
- data/lib/mxx_ru/cpp/obj_placement.rb +69 -1
- data/lib/mxx_ru/cpp/target.rb +8 -4
- data/lib/mxx_ru/cpp/toolset.rb +25 -1
- data/lib/mxx_ru/cpp/toolsets/clang_family.rb +17 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +17 -0
- data/lib/mxx_ru/cpp/toolsets/vc_family.rb +24 -0
- data/lib/mxx_ru/externals.rb +31 -17
- data/lib/mxx_ru/generators/ext-cmake-prj/g.rb +181 -0
- data/lib/mxx_ru/generators/ext-cmake-prj/template.erb +24 -0
- data/lib/mxx_ru/generators/externals/g.rb +172 -0
- data/lib/mxx_ru/generators/externals/template.erb +60 -0
- data/lib/mxx_ru/helpers.rb +46 -0
- data/lib/mxx_ru/version.rb +2 -2
- data/tests/cmake/build.rb +16 -0
- data/tests/cmake/hello_shared/CMakeLists.txt +18 -0
- data/tests/cmake/hello_shared/include/hello_shared.hpp +20 -0
- data/tests/cmake/hello_shared/src/hello_shared.cpp +10 -0
- data/tests/cmake/hello_shared_cmake_wrapper.rb +8 -0
- data/tests/cmake/hello_static/CMakeLists.txt +16 -0
- data/tests/cmake/hello_static/include/hello_static.hpp +9 -0
- data/tests/cmake/hello_static/src/hello_static.cpp +9 -0
- data/tests/cmake/hello_static_cmake_wrapper.rb +7 -0
- data/tests/cmake/main_app.cpp +9 -0
- data/tests/cmake/main_app.rb +15 -0
- data/tests/cmake/tc_cmake_build.rb +29 -0
- data/tests/mxx_ru/vc8/tc_default_manifest.rb +1 -1
- data/tests/mxx_ru/vc8/ts_vc8.rb +1 -1
- metadata +20 -2
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
gem 'Mxx_ru', '>= 1.6.11'
|
4
|
+
|
5
|
+
require 'mxx_ru/cpp'
|
6
|
+
|
7
|
+
MxxRu::Cpp::ext_cmake_project {
|
8
|
+
where '<%= where %>'
|
9
|
+
|
10
|
+
# Add some CMake-related definitions.
|
11
|
+
# Something like WITH_BOOST: 'ON'.
|
12
|
+
#with NAME1: 'VALUE1', NAME2: 'VALUE2'
|
13
|
+
|
14
|
+
# Specify install dir for headers.
|
15
|
+
#include_installdir 'some_path'
|
16
|
+
|
17
|
+
# Specify one or more subfolders in include directory.
|
18
|
+
# Something like 'some_project/interface', 'some_project/backends'...
|
19
|
+
#includedir_subfolders 'subpath1', 'subpath2'
|
20
|
+
|
21
|
+
# Specify some library to be linked to all dependent projets.
|
22
|
+
#lib 'some_library'
|
23
|
+
}
|
24
|
+
|
@@ -0,0 +1,172 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
3
|
+
# Copyright (c) 2004-2006, JSC Intervale
|
4
|
+
# Copyright (c) 2006-2016, The Mxx_ru Project
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
8
|
+
# are permitted provided that the following conditions are met:
|
9
|
+
#
|
10
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer.
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
14
|
+
# and/or other materials provided with the distribution.
|
15
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
16
|
+
# from this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
19
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
21
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
22
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
26
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
#++
|
28
|
+
|
29
|
+
# Since v.1.6.11
|
30
|
+
#
|
31
|
+
# Implementation of stabs generation for MxxRu::externals file
|
32
|
+
|
33
|
+
require 'erb'
|
34
|
+
require 'optparse'
|
35
|
+
|
36
|
+
require 'mxx_ru/generators/impl/std_receiver'
|
37
|
+
|
38
|
+
module MxxRu
|
39
|
+
|
40
|
+
module Generators
|
41
|
+
|
42
|
+
module Externals
|
43
|
+
|
44
|
+
# Class for storing command-line arguments as options.
|
45
|
+
#
|
46
|
+
# Usage:
|
47
|
+
# options = Options.parse( args, banner )
|
48
|
+
#
|
49
|
+
class Options
|
50
|
+
# Name of output file (-o, --output-file). nil if missing.
|
51
|
+
attr_accessor :output_file
|
52
|
+
|
53
|
+
# Parsing command-line arguments and returning Options instance.
|
54
|
+
#
|
55
|
+
# Calls exit(1) if --help present in _args_.
|
56
|
+
#
|
57
|
+
def Options.parse( args, banner )
|
58
|
+
parser = OptionParser.new
|
59
|
+
|
60
|
+
result = Options.new
|
61
|
+
|
62
|
+
parser.banner = banner
|
63
|
+
|
64
|
+
parser.on( '-o', '--output-file FILE', 'Output file name' ) do |p|
|
65
|
+
result.output_file = p
|
66
|
+
end
|
67
|
+
|
68
|
+
parser.on_tail( '-h', '--help', 'Show this message' ) do
|
69
|
+
puts parser
|
70
|
+
exit(1)
|
71
|
+
end
|
72
|
+
|
73
|
+
parser.parse!( args )
|
74
|
+
result
|
75
|
+
end
|
76
|
+
end # class Options
|
77
|
+
|
78
|
+
# Class to be used in ERb template generation.
|
79
|
+
#
|
80
|
+
# Usage:
|
81
|
+
# template_params = TemplateParams.new( target_type, options )
|
82
|
+
# template = ERb.new( IO.read( some_template_file ) )
|
83
|
+
# result = template.generate( template.get_binding )
|
84
|
+
#
|
85
|
+
class TemplateParams
|
86
|
+
# For a case when output_file is undetectable.
|
87
|
+
DEFAULT_FILE = 'externals.rb'
|
88
|
+
|
89
|
+
# Name of externals file
|
90
|
+
attr_reader :externals_file
|
91
|
+
|
92
|
+
def initialize( options )
|
93
|
+
@externals_file = try_detect_externals_file( options )
|
94
|
+
end
|
95
|
+
|
96
|
+
# Returns binding to use in ERb generation.
|
97
|
+
def get_binding
|
98
|
+
binding
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
# Try to setup name of externals file.
|
103
|
+
#
|
104
|
+
# If --output-file specified then its value used.
|
105
|
+
# Otherwise value 'externals.rb' is used.
|
106
|
+
#
|
107
|
+
def try_detect_externals_file( options )
|
108
|
+
options.output_file ?
|
109
|
+
File.basename( options.output_file ) :
|
110
|
+
DEFAULT_FILE
|
111
|
+
end
|
112
|
+
|
113
|
+
end # class TemplateParams
|
114
|
+
|
115
|
+
# Main class for code generation of binary unit test projects.
|
116
|
+
#
|
117
|
+
# Usage:
|
118
|
+
# receiver = StdReceiver.new
|
119
|
+
# generator = Generator.new( args, receiver )
|
120
|
+
# generator.run
|
121
|
+
#
|
122
|
+
class Generator
|
123
|
+
def initialize( args, receiver )
|
124
|
+
@args = args
|
125
|
+
@receiver = receiver
|
126
|
+
end
|
127
|
+
|
128
|
+
def run
|
129
|
+
options = Options.parse( @args,
|
130
|
+
"Stubs for C++ build root file generator\n\n" +
|
131
|
+
"Usage:\n" +
|
132
|
+
"mxxrugen [<mxxrugen-options>] cpp-build-root [<options>]\n\n" )
|
133
|
+
result = do_generation( options )
|
134
|
+
@receiver.receive( result, options.output_file )
|
135
|
+
end
|
136
|
+
|
137
|
+
private
|
138
|
+
# Performs main generation actions.
|
139
|
+
#
|
140
|
+
# Returns generation result as String.
|
141
|
+
def do_generation( options )
|
142
|
+
template = IO.read( File.join( File.dirname( __FILE__ ), 'template.erb' ) )
|
143
|
+
generator = ERB.new( template )
|
144
|
+
|
145
|
+
params = TemplateParams.new( options )
|
146
|
+
generator.result( params.get_binding ).gsub( /\n\n\n+/, "\n\n" )
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# Helper method for generation.
|
151
|
+
#
|
152
|
+
# Usage:
|
153
|
+
# # For using StdReceiver.
|
154
|
+
# generate_for( ARGV )
|
155
|
+
#
|
156
|
+
# # For using custom Receiver.
|
157
|
+
# generate_for( ARGV, CustomReceiver.new )
|
158
|
+
#
|
159
|
+
def Externals.generate_for( args, receiver = nil )
|
160
|
+
generator = Generator.new( args,
|
161
|
+
receiver ? receiver : MxxRu::Generators::Impl::StdReceiver.new )
|
162
|
+
generator.run
|
163
|
+
end
|
164
|
+
|
165
|
+
end # module Externals
|
166
|
+
|
167
|
+
end # module Generators
|
168
|
+
|
169
|
+
end # module MxxRu
|
170
|
+
|
171
|
+
MxxRu::Generators::Externals::generate_for( ARGV )
|
172
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Stub for externals from Git.
|
2
|
+
=begin
|
3
|
+
MxxRu::git_externals :extname do |e|
|
4
|
+
e.url 'https://github.com/...' # URL to Git repository.
|
5
|
+
|
6
|
+
# Uncomment to get a specific tag.
|
7
|
+
#e.tag 'tag-name'
|
8
|
+
|
9
|
+
# Uncomment to get a specific commit.
|
10
|
+
#e.commit 'commint-id'
|
11
|
+
|
12
|
+
e.map_dir 'src-dir' => 'dest-dir'
|
13
|
+
|
14
|
+
# Uncomment to map a specific file.
|
15
|
+
#e.map_file 'src-name' => 'dest-dir/*'
|
16
|
+
}
|
17
|
+
=end
|
18
|
+
|
19
|
+
# Stub for externals from Mercurial.
|
20
|
+
=begin
|
21
|
+
MxxRu::hg_externals :extname do |e|
|
22
|
+
e.url 'https://bitbucket.org/...' # URL to Hg repository.
|
23
|
+
|
24
|
+
# Uncomment to get a specific tag.
|
25
|
+
#e.tag 'tag-name'
|
26
|
+
|
27
|
+
e.map_dir 'src-dir' => 'dest-dir'
|
28
|
+
|
29
|
+
# Uncomment to map a specific file.
|
30
|
+
#e.map_file 'src-name' => 'dest-dir/*'
|
31
|
+
}
|
32
|
+
=end
|
33
|
+
|
34
|
+
# Stub for externals from Subversion.
|
35
|
+
=begin
|
36
|
+
MxxRu::svn_externals :extname do |e|
|
37
|
+
e.url 'https://..." # URL to Svn repository.
|
38
|
+
|
39
|
+
# Some useful defaults.
|
40
|
+
e.option '-q'
|
41
|
+
e.option '--native-eol', 'LF'
|
42
|
+
|
43
|
+
e.map_dir 'src-dir' => 'dest-dir'
|
44
|
+
|
45
|
+
# Uncomment to map a specific file.
|
46
|
+
#e.map_file 'src-name' => 'dest-dir/*'
|
47
|
+
end
|
48
|
+
=end
|
49
|
+
|
50
|
+
# Stub for externals from some downloadable archive.
|
51
|
+
=begin
|
52
|
+
MxxRu::arch_externals :soci do |e|
|
53
|
+
e.url 'http://..." # URL to archive with source code.
|
54
|
+
|
55
|
+
e.map_dir 'src-dir' => 'dest-dir'
|
56
|
+
|
57
|
+
# Uncomment to map a specific file.
|
58
|
+
#e.map_file 'src-name' => 'dest-dir/*'
|
59
|
+
end
|
60
|
+
=end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
3
|
+
# Copyright (c) 2004-2006, JSC Intervale
|
4
|
+
# Copyright (c) 2006-2016, The Mxx_ru Project
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
8
|
+
# are permitted provided that the following conditions are met:
|
9
|
+
#
|
10
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer.
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
14
|
+
# and/or other materials provided with the distribution.
|
15
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
16
|
+
# from this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
19
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
21
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
22
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
26
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
#++
|
28
|
+
|
29
|
+
module MxxRu
|
30
|
+
|
31
|
+
module Helpers
|
32
|
+
# Return nil if tool not found.
|
33
|
+
# Return version if tool is found.
|
34
|
+
def Helpers.external_tool_version_probe(cmd_line, version_re)
|
35
|
+
ver = nil
|
36
|
+
IO.popen(cmd_line, :err => [:child, :out]).grep(version_re) do |s|
|
37
|
+
ver = version_re.match(s)[1]
|
38
|
+
end
|
39
|
+
ver
|
40
|
+
rescue
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
end # module Helpers
|
44
|
+
|
45
|
+
end # module MxxRu
|
46
|
+
|
data/lib/mxx_ru/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#--
|
2
2
|
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
3
3
|
# Copyright (c) 2004-2006, JSC Intervale
|
4
|
-
# Copyright (c) 2006-
|
4
|
+
# Copyright (c) 2006-2016, The Mxx_ru Project
|
5
5
|
# All rights reserved.
|
6
6
|
#
|
7
7
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -34,4 +34,4 @@
|
|
34
34
|
#
|
35
35
|
# puts 'Mxx_ru version is: ' + MXX_RU_VERSION
|
36
36
|
#
|
37
|
-
MXX_RU_VERSION = '1.6.
|
37
|
+
MXX_RU_VERSION = '1.6.11'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'mxx_ru/cpp'
|
3
|
+
|
4
|
+
MxxRu::Cpp::composite_target( MxxRu::BUILD_ROOT ) {
|
5
|
+
|
6
|
+
default_rtl_mode( MxxRu::Cpp::RTL_SHARED )
|
7
|
+
default_runtime_mode( MxxRu::Cpp::RUNTIME_RELEASE )
|
8
|
+
|
9
|
+
MxxRu::enable_show_brief
|
10
|
+
global_obj_placement MxxRu::Cpp::ToolsetRuntimeSubdirObjPlacement.new(
|
11
|
+
"builds" )
|
12
|
+
|
13
|
+
ENV[ 'LD_LIBRARY_PATH' ] = mxx_obj_placement.get_dll('.', toolset, self)
|
14
|
+
|
15
|
+
required_prj 'main_app.rb'
|
16
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
cmake_minimum_required(VERSION 2.8)
|
2
|
+
project(hello_shared)
|
3
|
+
|
4
|
+
add_definitions(-DHELLO_SHARED_PRJ)
|
5
|
+
|
6
|
+
set(LIBDIR lib CACHE path "Destination for library")
|
7
|
+
set(INCLUDEDIR include CACHE path "Destination for headers")
|
8
|
+
|
9
|
+
set(hello_shared_src src/hello_shared.cpp)
|
10
|
+
set(hello_shared_hdr include/hello_shared.hpp)
|
11
|
+
|
12
|
+
include_directories(include)
|
13
|
+
|
14
|
+
add_library(hello_shared SHARED ${hello_shared_src})
|
15
|
+
|
16
|
+
install(TARGETS hello_shared DESTINATION ${LIBDIR})
|
17
|
+
install(FILES ${hello_shared_hdr} DESTINATION ${INCLUDEDIR})
|
18
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#if !defined( HELLO_SHARED_HPP )
|
2
|
+
#define HELLO_SHARED_HPP
|
3
|
+
|
4
|
+
#include <string>
|
5
|
+
|
6
|
+
#if defined( _MSC_VER )
|
7
|
+
#if !defined( HELLO_SHARED_PRJ )
|
8
|
+
#define EXPORT __declspec(dllimport)
|
9
|
+
#else
|
10
|
+
#define EXPORT __declspec(dllexport)
|
11
|
+
#endif
|
12
|
+
#else
|
13
|
+
#define EXPORT
|
14
|
+
#endif
|
15
|
+
|
16
|
+
EXPORT
|
17
|
+
void hello_shared( const std::string & w );
|
18
|
+
|
19
|
+
#endif
|
20
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
cmake_minimum_required(VERSION 2.8)
|
2
|
+
project(hello_static)
|
3
|
+
|
4
|
+
set(LIBDIR lib CACHE path "Destination for library")
|
5
|
+
set(INCLUDEDIR include CACHE path "Destination for headers")
|
6
|
+
|
7
|
+
set(hello_static_src src/hello_static.cpp)
|
8
|
+
set(hello_static_hdr include/hello_static.hpp)
|
9
|
+
|
10
|
+
include_directories(include)
|
11
|
+
|
12
|
+
add_library(hello_static STATIC ${hello_static_src})
|
13
|
+
|
14
|
+
install(TARGETS hello_static DESTINATION ${LIBDIR})
|
15
|
+
install(FILES ${hello_static_hdr} DESTINATION ${INCLUDEDIR})
|
16
|
+
|