Mxx_ru 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +38 -0
- data/Rakefile +29 -2
- data/examples/exe_dll_lib_2/build.rb +4 -1
- data/examples/exe_dll_lib_2/inout/prj.rb +1 -1
- data/examples/exe_dll_lib_2/main/prj.rb +1 -1
- data/examples/exe_dll_lib_2/say/prj.rb +1 -1
- data/lib/mxx_ru/abstract_target.rb +71 -49
- data/lib/mxx_ru/binary_library.rb +106 -0
- data/lib/mxx_ru/binary_target.rb +91 -7
- data/lib/mxx_ru/binary_unittest.rb +30 -17
- data/lib/mxx_ru/compat.rb +33 -0
- data/lib/mxx_ru/cpp/analyzer.rb +16 -9
- data/lib/mxx_ru/cpp/composite.rb +24 -13
- data/lib/mxx_ru/cpp/detect_toolset.rb +7 -7
- data/lib/mxx_ru/cpp/mode.rb +11 -6
- data/lib/mxx_ru/cpp/obj_placement.rb +42 -33
- data/lib/mxx_ru/cpp/obj_placements/custom_subdir.rb +155 -0
- data/lib/mxx_ru/cpp/qt.rb +97 -68
- data/lib/mxx_ru/cpp/rucodegen.rb +56 -19
- data/lib/mxx_ru/cpp/source_file.rb +14 -6
- data/lib/mxx_ru/cpp/target.rb +341 -226
- data/lib/mxx_ru/cpp/toolset.rb +188 -145
- data/lib/mxx_ru/cpp/toolsets/bcc_win32_5.rb +5 -4
- data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +42 -35
- data/lib/mxx_ru/cpp/toolsets/c89_etk_nsk.rb +8 -5
- data/lib/mxx_ru/cpp/toolsets/c89_nsk.rb +8 -5
- data/lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb +24 -20
- data/lib/mxx_ru/cpp/toolsets/gcc_cygwin.rb +9 -5
- data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +61 -38
- data/lib/mxx_ru/cpp/toolsets/gcc_linux.rb +10 -6
- data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +17 -15
- data/lib/mxx_ru/cpp/toolsets/gcc_sparc_solaris.rb +11 -7
- data/lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb +84 -0
- data/lib/mxx_ru/cpp/toolsets/vc7.rb +4 -4
- data/lib/mxx_ru/cpp/toolsets/vc8.rb +33 -30
- data/lib/mxx_ru/cpp/toolsets/vc_family.rb +70 -50
- data/lib/mxx_ru/cpp.rb +3 -1
- data/lib/mxx_ru/ex.rb +44 -13
- data/lib/mxx_ru/makestyle_generator.rb +17 -12
- data/lib/mxx_ru/textfile_unittest.rb +46 -27
- data/lib/mxx_ru/util.rb +51 -26
- data/tests/cpp/cpp_sources_glob/tc_cpp_sources_glob.rb +18 -0
- data/tests/cpp/mswin_res_dll/tc_mswin_res_dll.rb +18 -0
- data/tests/cpp/mswin_res_exe/tc_mswin_res_exe.rb +18 -0
- data/tests/cpp/rucodegen/prj.rb +1 -2
- data/tests/cpp/rucodegen/tc_rucodegen.rb +18 -0
- data/tests/cpp/rucodegen.embedded/host_config.cpp +32 -0
- data/tests/cpp/rucodegen.embedded/impl/conn_params.cpp +7 -0
- data/tests/cpp/rucodegen.embedded/impl/conn_params.rb +14 -0
- data/tests/cpp/rucodegen.embedded/impl/h/conn_params.hpp +10 -0
- data/tests/cpp/rucodegen.embedded/prj.rb +16 -0
- data/tests/cpp/rucodegen.embedded/tc_rucodegen.rb +18 -0
- data/tests/cpp/textfile_unittest/tc_textfile_unittest.rb +18 -0
- data/tests/cpp/vc_cleanup/tc_vc_cleanup.rb +7 -44
- data/tests/mxx_ru/binary_library/tc_binary_library.rb +57 -0
- data/tests/mxx_ru/binary_library/tc_binary_target_lib_methods.rb +114 -0
- data/tests/mxx_ru/lib_path/build.rb +8 -0
- data/tests/mxx_ru/lib_path/bye.c +3 -0
- data/tests/mxx_ru/lib_path/bye.rb +8 -0
- data/tests/mxx_ru/lib_path/hi.c +3 -0
- data/tests/mxx_ru/lib_path/hi.rb +8 -0
- data/tests/mxx_ru/lib_path/main.c +9 -0
- data/tests/mxx_ru/lib_path/main.rb +12 -0
- data/tests/mxx_ru/lib_path/tc_lib_path.rb +18 -0
- data/tests/mxx_ru/obj_placements/tc_custom_subdir.rb +58 -0
- data/tests/mxx_ru/opt_lib_ext/build.rb +7 -0
- data/tests/mxx_ru/opt_lib_ext/hi.c +3 -0
- data/tests/mxx_ru/opt_lib_ext/hi.h +1 -0
- data/tests/mxx_ru/opt_lib_ext/hi.rb +7 -0
- data/tests/mxx_ru/opt_lib_ext/main.c +7 -0
- data/tests/mxx_ru/opt_lib_ext/tc_opt_lib_ext.rb +18 -0
- data/tests/mxx_ru/opt_lib_ext/test-no-ext.rb +9 -0
- data/tests/mxx_ru/opt_lib_ext/test-with-ext.rb +13 -0
- data/tests/mxx_ru/qt_gen/tc_uic_result_subdir.rb +76 -0
- data/tests/mxx_ru/target_ext/dll_hi.cpp +1 -0
- data/tests/mxx_ru/target_ext/exe_hi.cpp +4 -0
- data/tests/mxx_ru/target_ext/lib_hi.cpp +1 -0
- data/tests/mxx_ru/target_ext/prj_dll.rb +8 -0
- data/tests/mxx_ru/target_ext/prj_exe.rb +8 -0
- data/tests/mxx_ru/target_ext/prj_lib.rb +8 -0
- data/tests/mxx_ru/target_ext/tc_target_ext.rb +24 -0
- data/tests/qt/toplevel/prj.rb +1 -0
- data/tests/test_with_compilation.rb +110 -0
- data/tests/unix/lib_linking_mode/a.hpp +12 -0
- data/tests/unix/lib_linking_mode/a_shared.cpp +8 -0
- data/tests/unix/lib_linking_mode/a_shared.rb +7 -0
- data/tests/unix/lib_linking_mode/a_static.cpp +7 -0
- data/tests/unix/lib_linking_mode/a_static.rb +7 -0
- data/tests/unix/lib_linking_mode/etalon/shared.txt +2 -0
- data/tests/unix/lib_linking_mode/etalon/static.txt +2 -0
- data/tests/unix/lib_linking_mode/main.impl.cpp +7 -0
- data/tests/unix/lib_linking_mode/main_conflict.cpp +2 -0
- data/tests/unix/lib_linking_mode/main_conflict.rb +12 -0
- data/tests/unix/lib_linking_mode/main_conflict_2.rb +11 -0
- data/tests/unix/lib_linking_mode/main_shared.cpp +2 -0
- data/tests/unix/lib_linking_mode/main_shared.rb +9 -0
- data/tests/unix/lib_linking_mode/main_shared.ut.rb +11 -0
- data/tests/unix/lib_linking_mode/main_shared_2.cpp +2 -0
- data/tests/unix/lib_linking_mode/main_shared_2.rb +10 -0
- data/tests/unix/lib_linking_mode/main_shared_2.ut.rb +11 -0
- data/tests/unix/lib_linking_mode/main_static.cpp +2 -0
- data/tests/unix/lib_linking_mode/main_static.rb +9 -0
- data/tests/unix/lib_linking_mode/main_static.ut.rb +11 -0
- data/tests/unix/lib_linking_mode/main_static_2.cpp +2 -0
- data/tests/unix/lib_linking_mode/main_static_2.rb +10 -0
- data/tests/unix/lib_linking_mode/main_static_2.ut.rb +11 -0
- data/tests/unix/lib_linking_mode/tc_conflicted_build.rb +18 -0
- data/tests/unix/lib_linking_mode/tc_normal_build.rb +18 -0
- metadata +90 -11
- data/tests/cpp/vc_cleanup/cout.log +0 -72
- data/tests/qt/toplevel/options.ui.h +0 -98
@@ -0,0 +1,32 @@
|
|
1
|
+
#include <string>
|
2
|
+
|
3
|
+
#include "impl/h/conn_params.hpp"
|
4
|
+
|
5
|
+
/* RuCodeGen::Embedded::begin
|
6
|
+
cpp_value_incapsulator :host_config_t do |c|
|
7
|
+
c.decl_file :script_relative => "h/host_config.impl.hpp"
|
8
|
+
c.impl_file :script_relative => "host_config.impl.cpp"
|
9
|
+
|
10
|
+
c.attr_suffix "_"
|
11
|
+
|
12
|
+
c.attr :host, "std::string", :default => "localhost"
|
13
|
+
c.attr :port, "short", :default => 8080
|
14
|
+
c.attr :conn_params, "impl::conn_params_t", :getter_returns_value => true
|
15
|
+
end
|
16
|
+
RuCodeGen::Embedded::end */
|
17
|
+
|
18
|
+
#include "h/host_config.impl.hpp"
|
19
|
+
#include "host_config.impl.cpp"
|
20
|
+
|
21
|
+
int
|
22
|
+
main()
|
23
|
+
{
|
24
|
+
impl::conn_params_t params;
|
25
|
+
params.attempts( 8 );
|
26
|
+
|
27
|
+
host_config_t cfg;
|
28
|
+
|
29
|
+
cfg.host( "eao197.narod.ru" );
|
30
|
+
cfg.port( 80 );
|
31
|
+
cfg.conn_params( params );
|
32
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require_gem 'RuCodeGen'
|
3
|
+
|
4
|
+
cpp_value_incapsulator :conn_params_t do |c|
|
5
|
+
c.decl_file :script_relative => "h/conn_params.impl.hpp"
|
6
|
+
c.impl_file :script_relative => "conn_params.impl.cpp"
|
7
|
+
|
8
|
+
c.attr_suffix "_"
|
9
|
+
|
10
|
+
c.attr :attempts, "int", :default => 3
|
11
|
+
c.attr :reconnect_timeout, "int", :default => 10
|
12
|
+
c.attr :restore_timeout, "int", :default => 5
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'mxx_ru/cpp'
|
2
|
+
require 'mxx_ru/cpp/rucodegen'
|
3
|
+
|
4
|
+
Mxx_ru::Cpp::exe_target {
|
5
|
+
target "host_config"
|
6
|
+
|
7
|
+
rucodegen = generator Mxx_ru::Cpp::RuCodeGen.new( self )
|
8
|
+
|
9
|
+
cpp_source "host_config.cpp"
|
10
|
+
rucodegen.add_embedded "host_config.cpp"
|
11
|
+
|
12
|
+
sources_root( "impl" ) {
|
13
|
+
cpp_source "conn_params.cpp"
|
14
|
+
rucodegen.add "conn_params.rb"
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require File.dirname( __FILE__ ) + '/../../test_with_compilation'
|
4
|
+
|
5
|
+
class TC_RuCodeGenEmbedded < Test::Unit::TestCase
|
6
|
+
include TestWithCompilation
|
7
|
+
|
8
|
+
test_path 'tests/cpp/rucodegen'
|
9
|
+
|
10
|
+
test_case :successful_compile_and_link do
|
11
|
+
assert_nothing_raised {
|
12
|
+
build( 'prj.rb' )
|
13
|
+
clean( 'prj.rb' )
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require File.dirname( __FILE__ ) + '/../../test_with_compilation'
|
4
|
+
|
5
|
+
class TC_TextFileUnitTest < Test::Unit::TestCase
|
6
|
+
include TestWithCompilation
|
7
|
+
|
8
|
+
test_path 'tests/cpp/textfile_unittest'
|
9
|
+
|
10
|
+
test_case :successful_compile_and_link do
|
11
|
+
assert_nothing_raised {
|
12
|
+
build( 'build.rb' )
|
13
|
+
clean( 'build.rb' )
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
@@ -1,31 +1,17 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
|
3
|
-
|
4
|
-
TEST_FOLDER = 'tests/cpp/vc_cleanup'
|
5
|
-
RUBYLIB_FOLDER = '../../../lib'
|
6
|
-
|
7
|
-
def initialize( test_case_name )
|
8
|
-
super( test_case_name )
|
3
|
+
require File.dirname( __FILE__ ) + '/../../test_with_compilation'
|
9
4
|
|
10
|
-
|
11
|
-
|
12
|
-
# we need no change current work directory.
|
13
|
-
@need_change_cwd = !File.exists?( File.basename( __FILE__ ) )
|
14
|
-
end
|
5
|
+
class TC_VcCleanup < Test::Unit::TestCase
|
6
|
+
include TestWithCompilation
|
15
7
|
|
16
|
-
|
17
|
-
if @need_change_cwd
|
18
|
-
Dir.chdir( TEST_FOLDER ) do do_test end
|
19
|
-
else
|
20
|
-
do_test
|
21
|
-
end
|
22
|
-
end
|
8
|
+
test_path 'tests/cpp/vc_cleanup'
|
23
9
|
|
24
|
-
|
10
|
+
test_case :build_and_clean do
|
25
11
|
project_files = Dir[ 'prj_*.rb' ]
|
26
12
|
|
27
|
-
|
28
|
-
|
13
|
+
build( *project_files )
|
14
|
+
clean( *project_files )
|
29
15
|
|
30
16
|
garbage_files = Dir.glob( "**/*.{ilk,pdb,lib,exp}" )
|
31
17
|
|
@@ -33,28 +19,5 @@ class TC_VcCleanup < Test::Unit::TestCase
|
|
33
19
|
assert_equal( 0, garbage_files.size )
|
34
20
|
end
|
35
21
|
|
36
|
-
def build_all_targets( project_files )
|
37
|
-
# Running all projects to build targets.
|
38
|
-
project_files.each do |prj|
|
39
|
-
command = "ruby -I#{RUBYLIB_FOLDER} #{prj} --mxx-cpp-debug"
|
40
|
-
run_and_check_command( command )
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def clean_all_targets( project_files )
|
45
|
-
# Running all projects to clean up targets.
|
46
|
-
project_files.each do |prj|
|
47
|
-
command = "ruby -I#{RUBYLIB_FOLDER} #{prj} --mxx-clean"
|
48
|
-
run_and_check_command( command )
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def run_and_check_command( command )
|
53
|
-
started = system( command )
|
54
|
-
assert(
|
55
|
-
started && $? == 0,
|
56
|
-
"some problems in running #{command}: " +
|
57
|
-
"started: #{started}, exit status: #{$?}" )
|
58
|
-
end
|
59
22
|
end
|
60
23
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'mxx_ru/binary_library'
|
4
|
+
|
5
|
+
class TC_BinaryLibrary < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_creation
|
8
|
+
static = Mxx_ru::BinaryLibrary.new(
|
9
|
+
'static', Mxx_ru::BinaryLibrary::STATIC )
|
10
|
+
assert_equal( 'static', static.name )
|
11
|
+
assert_equal( Mxx_ru::BinaryLibrary::STATIC, static.type )
|
12
|
+
|
13
|
+
shared = Mxx_ru::BinaryLibrary.new(
|
14
|
+
'shared', Mxx_ru::BinaryLibrary::SHARED )
|
15
|
+
assert_equal( 'shared', shared.name )
|
16
|
+
assert_equal( Mxx_ru::BinaryLibrary::SHARED, shared.type )
|
17
|
+
|
18
|
+
any = Mxx_ru::BinaryLibrary.new(
|
19
|
+
'any', Mxx_ru::BinaryLibrary::ANY )
|
20
|
+
assert_equal( 'any', any.name )
|
21
|
+
assert_equal( Mxx_ru::BinaryLibrary::ANY, any.type )
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_incorrect_type
|
25
|
+
assert_nothing_raised {
|
26
|
+
b = Mxx_ru::BinaryLibrary.new( 'a', Mxx_ru::BinaryLibrary::STATIC )
|
27
|
+
}
|
28
|
+
|
29
|
+
assert_raise( Mxx_ru::InvalidValueEx ) {
|
30
|
+
b = Mxx_ru::BinaryLibrary.new( 'b', :dynamic )
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_array_of_lib_equality
|
35
|
+
a = [
|
36
|
+
Mxx_ru::BinaryLibrary.new( 'A', Mxx_ru::BinaryLibrary::STATIC ),
|
37
|
+
Mxx_ru::BinaryLibrary.new( 'B', Mxx_ru::BinaryLibrary::SHARED ),
|
38
|
+
Mxx_ru::BinaryLibrary.new( 'C', Mxx_ru::BinaryLibrary::ANY ) ]
|
39
|
+
b = [
|
40
|
+
Mxx_ru::BinaryLibrary.new( 'A', Mxx_ru::BinaryLibrary::STATIC ),
|
41
|
+
Mxx_ru::BinaryLibrary.new( 'B', Mxx_ru::BinaryLibrary::SHARED ),
|
42
|
+
Mxx_ru::BinaryLibrary.new( 'C', Mxx_ru::BinaryLibrary::ANY ) ]
|
43
|
+
|
44
|
+
assert_equal( a, b )
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_array_of_lib_uniq
|
48
|
+
a = [
|
49
|
+
Mxx_ru::BinaryLibrary.new( 'A', Mxx_ru::BinaryLibrary::STATIC ),
|
50
|
+
Mxx_ru::BinaryLibrary.new( 'B', Mxx_ru::BinaryLibrary::SHARED ),
|
51
|
+
Mxx_ru::BinaryLibrary.new( 'C', Mxx_ru::BinaryLibrary::ANY ) ]
|
52
|
+
b = a.uniq
|
53
|
+
|
54
|
+
assert_equal( a, b )
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'mxx_ru/binary_target'
|
4
|
+
|
5
|
+
class TC_BinaryTargetLibMethods < Test::Unit::TestCase
|
6
|
+
def make_static_lib( name )
|
7
|
+
Mxx_ru::BinaryLibrary.new( name, Mxx_ru::BinaryLibrary::STATIC )
|
8
|
+
end
|
9
|
+
|
10
|
+
def make_shared_lib( name )
|
11
|
+
Mxx_ru::BinaryLibrary.new( name, Mxx_ru::BinaryLibrary::SHARED )
|
12
|
+
end
|
13
|
+
|
14
|
+
def make_any_lib( name )
|
15
|
+
Mxx_ru::BinaryLibrary.new( name, Mxx_ru::BinaryLibrary::ANY )
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_add_libs
|
19
|
+
target = Mxx_ru::BinaryTarget.new( 'test_add_libs' )
|
20
|
+
|
21
|
+
target.lib( 'A' )
|
22
|
+
target.lib_static( 'B' )
|
23
|
+
target.lib_shared( 'C' )
|
24
|
+
|
25
|
+
assert_equal(
|
26
|
+
[ make_any_lib( 'A' ),
|
27
|
+
make_static_lib( 'B' ),
|
28
|
+
make_shared_lib( 'C' ) ],
|
29
|
+
target.mxx_required_libs )
|
30
|
+
assert_equal( [], target.mxx_required_lib_paths )
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_add_libs_with_paths
|
34
|
+
target = Mxx_ru::BinaryTarget.new( 'test_add_libs_with_paths' )
|
35
|
+
|
36
|
+
target.lib( 'A', 'lib' )
|
37
|
+
target.lib_static( 'B', '/usr/lib' )
|
38
|
+
target.lib_shared( 'C', '/usr/local/lib' )
|
39
|
+
|
40
|
+
assert_equal(
|
41
|
+
[ make_any_lib( 'A' ),
|
42
|
+
make_static_lib( 'B' ),
|
43
|
+
make_shared_lib( 'C' ) ],
|
44
|
+
target.mxx_required_libs )
|
45
|
+
assert_equal(
|
46
|
+
[ 'lib',
|
47
|
+
'/usr/lib',
|
48
|
+
'/usr/local/lib' ],
|
49
|
+
target.mxx_required_lib_paths )
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_lib_no_conflict
|
53
|
+
target = Mxx_ru::BinaryTarget.new( 'test_lib_no_conflict' )
|
54
|
+
|
55
|
+
target.lib( 'A' )
|
56
|
+
target.lib_static( 'A' )
|
57
|
+
target.lib( 'A' )
|
58
|
+
|
59
|
+
assert_nothing_raised {
|
60
|
+
target.mxx_required_libs
|
61
|
+
}
|
62
|
+
|
63
|
+
target.lib_shared( 'B' )
|
64
|
+
target.lib( 'B' )
|
65
|
+
|
66
|
+
assert_nothing_raised {
|
67
|
+
target.mxx_required_libs
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_lib_conflict
|
72
|
+
target = Mxx_ru::BinaryTarget.new( 'test_lib_conflict' )
|
73
|
+
|
74
|
+
target.lib_static( 'C' )
|
75
|
+
target.lib( 'C' )
|
76
|
+
target.lib_shared( 'C' )
|
77
|
+
target.lib( 'C' )
|
78
|
+
|
79
|
+
assert_raise( Mxx_ru::BinaryLibraryTypeConflictEx ) {
|
80
|
+
target.mxx_required_libs
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_lib_conflict_ex_data
|
85
|
+
target = Mxx_ru::BinaryTarget.new( 'test_lib_conflict_ex_data' )
|
86
|
+
|
87
|
+
target.lib( 'A' )
|
88
|
+
target.lib_static( 'A' )
|
89
|
+
target.lib( 'A' )
|
90
|
+
|
91
|
+
target.lib_static( 'C' )
|
92
|
+
target.lib( 'C' )
|
93
|
+
target.lib_shared( 'C' )
|
94
|
+
target.lib( 'C' )
|
95
|
+
|
96
|
+
target.lib_shared( 'B' )
|
97
|
+
target.lib( 'B' )
|
98
|
+
|
99
|
+
exception_raised = false
|
100
|
+
|
101
|
+
begin
|
102
|
+
target.mxx_required_libs
|
103
|
+
rescue Mxx_ru::BinaryLibraryTypeConflictEx => x
|
104
|
+
exception_raised = true
|
105
|
+
|
106
|
+
# Name of conflicted library must be in message.
|
107
|
+
assert( x.message =~ /'C'/ )
|
108
|
+
end
|
109
|
+
|
110
|
+
assert_equal( true, exception_raised )
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require File.dirname( __FILE__ ) + '/../../test_with_compilation'
|
4
|
+
|
5
|
+
class TC_LibPath < Test::Unit::TestCase
|
6
|
+
include TestWithCompilation
|
7
|
+
|
8
|
+
test_path 'tests/mxx_ru/lib_path'
|
9
|
+
|
10
|
+
test_case :successful_compile_and_link do
|
11
|
+
assert_nothing_raised {
|
12
|
+
build( 'build.rb' )
|
13
|
+
clean( 'build.rb' )
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
require 'mxx_ru/cpp/obj_placements/custom_subdir'
|
5
|
+
|
6
|
+
class TC_CustomSubdirObjPlacement < Test::Unit::TestCase
|
7
|
+
FINAL_PATH = 'bin'
|
8
|
+
INTERMEDIATE_PATH = 'intermediate'
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
FileUtils.rm_r( FINAL_PATH ) if File.directory?( FINAL_PATH )
|
12
|
+
FileUtils.rm_r( INTERMEDIATE_PATH ) if File.directory?( INTERMEDIATE_PATH )
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_final_path
|
16
|
+
p = Mxx_ru::Cpp::CustomSubdirObjPlacement.new(
|
17
|
+
FINAL_PATH, INTERMEDIATE_PATH )
|
18
|
+
|
19
|
+
r = p.get_exe( '', nil, nil )
|
20
|
+
check_name_and_path( FINAL_PATH + '/', r )
|
21
|
+
r = p.get_exe( 'exe', nil, nil )
|
22
|
+
check_name_and_path( FINAL_PATH + '/exe', r )
|
23
|
+
|
24
|
+
r = p.get_dll( '', nil, nil )
|
25
|
+
check_name_and_path( FINAL_PATH + '/', r )
|
26
|
+
r = p.get_dll( 'dll', nil, nil )
|
27
|
+
check_name_and_path( FINAL_PATH + '/dll', r )
|
28
|
+
|
29
|
+
r = p.get_lib( '', nil, nil )
|
30
|
+
check_name_and_path( FINAL_PATH + '/', r )
|
31
|
+
r = p.get_lib( 'lib', nil, nil )
|
32
|
+
check_name_and_path( FINAL_PATH + '/lib', r )
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_intermediate_path
|
36
|
+
p = Mxx_ru::Cpp::CustomSubdirObjPlacement.new(
|
37
|
+
FINAL_PATH, INTERMEDIATE_PATH )
|
38
|
+
|
39
|
+
r = p.get_obj( nil, nil, nil )
|
40
|
+
check_name_and_path( INTERMEDIATE_PATH, r )
|
41
|
+
|
42
|
+
r = p.get_obj( '', nil, nil )
|
43
|
+
check_name_and_path( INTERMEDIATE_PATH, r )
|
44
|
+
|
45
|
+
r = p.get_obj( '.', nil, nil )
|
46
|
+
check_name_and_path( INTERMEDIATE_PATH, r )
|
47
|
+
|
48
|
+
r = p.get_obj( 'prj_1/src', nil, nil )
|
49
|
+
check_name_and_path( File.join( INTERMEDIATE_PATH, 'prj_1/src' ), r )
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
def check_name_and_path( expected, actual )
|
54
|
+
assert_equal( expected, actual )
|
55
|
+
assert( File.directory?( expected ) )
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
void hi();
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require File.dirname( __FILE__ ) + '/../../test_with_compilation'
|
4
|
+
|
5
|
+
class TC_OptLibPath < Test::Unit::TestCase
|
6
|
+
include TestWithCompilation
|
7
|
+
|
8
|
+
test_path 'tests/mxx_ru/opt_lib_ext'
|
9
|
+
|
10
|
+
test_case :successful_compile_and_link do
|
11
|
+
assert_nothing_raised {
|
12
|
+
build( 'build.rb' )
|
13
|
+
clean( 'build.rb' )
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'mxx_ru/cpp/qt'
|
4
|
+
|
5
|
+
class CustomQtGen < Mxx_ru::Cpp::QtGen
|
6
|
+
public :names_from_ui
|
7
|
+
end
|
8
|
+
|
9
|
+
class TC_UicResultSubdir < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_in_cwd_no_uic_result_subdir
|
12
|
+
target = create_target( 'no_uic_result_subdir.rb' )
|
13
|
+
qt = create_qt_gen( target )
|
14
|
+
|
15
|
+
ui_names = qt.names_from_ui( "dlg.ui", target )
|
16
|
+
assert_equal( "dlg.hpp", ui_names.header )
|
17
|
+
assert_equal( "dlg.cpp", ui_names.source )
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_in_subdir_no_uic_result_subdir
|
21
|
+
target = create_target( 'some/path/no_uic_result_subdir.rb' )
|
22
|
+
qt = create_qt_gen( target )
|
23
|
+
|
24
|
+
path = 'some/path'
|
25
|
+
|
26
|
+
ui_names = qt.names_from_ui( "#{path}/dlg.ui", target )
|
27
|
+
assert_equal( "#{path}/dlg.hpp", ui_names.header )
|
28
|
+
assert_equal( "#{path}/dlg.cpp", ui_names.source )
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_in_cwd_with_uic_result_subdir
|
32
|
+
target = create_target( 'with_uic_result_subdir.rb' )
|
33
|
+
qt = create_qt_gen( target )
|
34
|
+
qt.uic_result_subdir = 'uic'
|
35
|
+
|
36
|
+
ui_names = qt.names_from_ui( "dlg.ui", target )
|
37
|
+
assert_equal( "./uic/dlg.hpp", ui_names.header )
|
38
|
+
assert_equal( "./uic/dlg.cpp", ui_names.source )
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_in_subdir_with_uic_result_subdir
|
42
|
+
target = create_target( 'some/path/with_uic_result_subdir.rb' )
|
43
|
+
qt = create_qt_gen( target )
|
44
|
+
qt.uic_result_subdir = 'uic'
|
45
|
+
|
46
|
+
path = 'some/path'
|
47
|
+
|
48
|
+
ui_names = qt.names_from_ui( "#{path}/dlg.ui", target )
|
49
|
+
assert_equal( "#{path}/uic/dlg.hpp", ui_names.header )
|
50
|
+
assert_equal( "#{path}/uic/dlg.cpp", ui_names.source )
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_target_include_path
|
54
|
+
target = create_target( 'some/path/with_uic_result_subdir.rb' )
|
55
|
+
qt = create_qt_gen( target )
|
56
|
+
qt.uic_result_subdir = 'uic'
|
57
|
+
qt.ui( 'dlg.ui' )
|
58
|
+
qt.ui( 'mainwnd/mainwnd.ui' )
|
59
|
+
|
60
|
+
assert( target.mxx_all_include_paths.include?( 'some/path/uic' ) )
|
61
|
+
assert( target.mxx_all_include_paths.include?( 'some/path/mainwnd/uic' ) )
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
def create_target( prj_alias )
|
66
|
+
Mxx_ru::Cpp::ExeTarget.new( prj_alias )
|
67
|
+
end
|
68
|
+
|
69
|
+
def create_qt_gen( target )
|
70
|
+
qt = CustomQtGen.new( target )
|
71
|
+
qt.hpp_ext = '.hpp'
|
72
|
+
qt.cpp_ext = '.cpp'
|
73
|
+
qt
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
void hi() {}
|
@@ -0,0 +1 @@
|
|
1
|
+
void hi() {}
|