rakeoe 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9717944f0f38cc7be538370c7f19245a4dc9a05f
4
- data.tar.gz: 06a0a2466d02d5afb248dd0e378d87e631aedf6d
3
+ metadata.gz: 2fbe6da29cfe5dab5316240a65e92968b05474db
4
+ data.tar.gz: afaab703e8c86e60895de7ba6dc67029a1217755
5
5
  SHA512:
6
- metadata.gz: 0e65408d603b81beb5fb4b4cb392fe49013eb38b6044d689124f92616d78f81e9626ebff16c825d2a3abb5838d4d74652efc53e7db16e3e68d8a7d0c17c5bcb9
7
- data.tar.gz: 6929a06b98572b38e3314c7f5c2fd9c49cc3a88e57ab3a4ff386995439c98a261a221604293c735e28d76cd87d0b61fa26c7015a6eee61033342f7c150d69c50
6
+ metadata.gz: e70fd91f6c122104d154ea3337a90235dd3a5c2f52d721fae846380d272e75a6b0b8b782330074e6cdb7e36c328558582e18cf47f3504379c21eaa63ac7bb0b4
7
+ data.tar.gz: 541a1010dbed2d44915fbcada5c10f376f34372870410dfe20c1a772abd13fc8c99d3e16e6ec7755850ef6fac179c0adede5a24f2df4807167a3f89298af4a03
@@ -82,7 +82,7 @@ module RakeOE
82
82
  end
83
83
 
84
84
  @test_binary = "#{bin_dir}/#{name}-test"
85
- @test_inc_dirs = @test_fw.include
85
+ @test_inc_dirs = @test_fw.include.join(' ')
86
86
 
87
87
  handle_prj_type
88
88
  handle_qt if '1' == @settings['USE_QT']
@@ -378,115 +378,111 @@ module RakeOE
378
378
 
379
379
  # map object to source file and make it dependent on creation of all object directories
380
380
  rule /#{build_dir}\/.*\.o/ => [ proc {|tn| obj_to_source(tn, src_dir, build_dir)}] + obj_dirs do |t|
381
+ if t.name =~ /\/tests\//
382
+ # test framework additions
383
+ incs << @test_inc_dirs unless incs.include?(@test_inc_dirs)
384
+ @settings['ADD_CXXFLAGS'] += @test_fw.cflags
385
+ @settings['ADD_CFLAGS'] += @test_fw.cflags
386
+ end
381
387
 
382
-
383
- if t.name =~ /\/tests\//
384
- # test framework additions
385
- incs += [@test_fw.include]
386
- @settings['ADD_CXXFLAGS'] += @test_fw.cflags
387
- @settings['ADD_CFLAGS'] += @test_fw.cflags
388
+ tc.obj(:source => t.source,
389
+ :object => t.name,
390
+ :settings => @settings,
391
+ :includes => incs.uniq)
388
392
  end
389
393
 
390
- tc.obj(:source => t.source,
391
- :object => t.name,
392
- :settings => @settings,
393
- :includes => incs)
394
- end
394
+ # map dependency to source file and make it dependent on creation of all object directories
395
+ rule /#{build_dir}\/.*\.d/ => [ proc {|tn| dep_to_source(tn, src_dir, build_dir)}] + obj_dirs do |t|
396
+ # don't generate dependencies for assembler files XXX DS: use tc.file_extensions[:as_sources]
397
+ if (t.source.end_with?('.S') || t.source.end_with?('.s'))
398
+ tc.touch(t.name)
399
+ next
400
+ end
395
401
 
396
- # map dependency to source file and make it dependent on creation of all object directories
397
- rule /#{build_dir}\/.*\.d/ => [ proc {|tn| dep_to_source(tn, src_dir, build_dir)}] + obj_dirs do |t|
402
+ if t.name =~ /\/tests\//
403
+ # test framework additions
404
+ incs << @test_inc_dirs unless incs.include?(@test_inc_dirs)
405
+ @settings['ADD_CXXFLAGS'] += @test_fw.cflags
406
+ @settings['ADD_CFLAGS'] += @test_fw.cflags
407
+ end
398
408
 
399
- # don't generate dependencies for assembler files XXX DS: use tc.file_extensions[:as_sources]
400
- if (t.source.end_with?('.S') || t.source.end_with?('.s'))
401
- tc.touch(t.name)
402
- next
403
- end
409
+ tc.dep(:source => t.source,
410
+ :dep => t.name,
411
+ :settings => @settings,
412
+ :includes => incs.uniq)
413
+ end
404
414
 
405
- if t.name =~ /\/tests\//
406
- # test framework additions
407
- incs += [@test_fw.include]
408
- @settings['ADD_CXXFLAGS'] += @test_fw.cflags
409
- @settings['ADD_CFLAGS'] += @test_fw.cflags
415
+ # make moc source file dependent on corresponding header file, XXX DS: only if project uses QT
416
+ rule /#{src_dir}\/.*moc_.*#{Regexp.escape(tc.moc_source)}$/ => [ proc {|tn| tn.gsub(/moc_/, '').ext(tc.moc_header_extension) } ] do |t|
417
+ tc.moc(:source => t.source,
418
+ :moc => t.name,
419
+ :settings => @settings)
420
+ end
410
421
  end
411
422
 
412
- tc.dep(:source => t.source,
413
- :dep => t.name,
414
- :settings => @settings,
415
- :includes => incs)
416
- end
417
-
418
- # make moc source file dependent on corresponding header file, XXX DS: only if project uses QT
419
- rule /#{src_dir}\/.*moc_.*#{Regexp.escape(tc.moc_source)}$/ => [ proc {|tn| tn.gsub(/moc_/, '').ext(tc.moc_header_extension) } ] do |t|
420
- tc.moc(:source => t.source,
421
- :moc => t.name,
422
- :settings => @settings)
423
- end
424
- end
423
+ # Search dependent libraries as specified in ADD_LIBS setting
424
+ # of prj.rake file
425
+ #
426
+ # @param [String] settings The project settings definition
427
+ #
428
+ # @return [Hash] Containing the following components mapped to an array:
429
+ # @option return [Array] :local local libs found by toolchain
430
+ # @option return [Array] :all local + external libs
431
+ #
432
+ def search_libs(settings)
433
+ # get all libs specified in ADD_LIBS
434
+ libs = settings['ADD_LIBS'].split
425
435
 
426
- # Search dependent libraries as specified in ADD_LIBS setting
427
- # of prj.rake file
428
- #
429
- # @param [String] settings The project settings definition
430
- #
431
- # @return [Hash] Containing the following components mapped to an array:
432
- # @option return [Array] :local local libs found by toolchain
433
- # @option return [Array] :all local + external libs
434
- #
435
- def search_libs(settings)
436
- # get all libs specified in ADD_LIBS
437
- libs = settings['ADD_LIBS'].split
438
-
439
- # match libs found by toolchain
440
- local_libs = libs.each_with_object(Array.new) do |lib, arr|
441
- arr << lib if (PrjFileCache.contain?('LIB', lib) || PrjFileCache.contain?('SOLIB', lib))
442
- end
436
+ # match libs found by toolchain
437
+ local_libs = libs.each_with_object(Array.new) do |lib, arr|
438
+ arr << lib if (PrjFileCache.contain?('LIB', lib) || PrjFileCache.contain?('SOLIB', lib))
439
+ end
443
440
 
444
- # return value is a hash
445
- {
446
- :local => local_libs,
447
- :all => libs
448
- }
449
- end
441
+ # return value is a hash
442
+ {
443
+ :local => local_libs,
444
+ :all => libs
445
+ }
446
+ end
450
447
 
451
- # Iterate over each local library and execute given block
452
- #
453
- # @param [Block] block The block that is executed
454
- #
455
- def each_local_lib(&block)
456
- libs = search_libs(@settings)
457
- libs[:local].each do |lib|
458
- yield(lib)
459
- end
460
- end
448
+ # Iterate over each local library and execute given block
449
+ #
450
+ # @param [Block] block The block that is executed
451
+ #
452
+ def each_local_lib(&block)
453
+ libs = search_libs(@settings)
454
+ libs[:local].each do |lib|
455
+ yield(lib)
456
+ end
457
+ end
461
458
 
462
- #
463
- # Returns absolute paths to dependend local libraries, i.e. libraries
464
- # of the current project.
465
- #
466
- def paths_of_local_libs
467
- local_libs = Array.new
468
-
469
- each_local_lib() do |lib|
470
- if PrjFileCache.contain?('LIB', lib)
471
- local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.a"
472
- elsif PrjFileCache.contain?('SOLIB', lib)
473
- local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.so"
474
- end
475
- end
459
+ #
460
+ # Returns absolute paths to dependend local libraries, i.e. libraries
461
+ # of the current project.
462
+ #
463
+ def paths_of_local_libs
464
+ local_libs = Array.new
476
465
 
477
- local_libs
478
- end
466
+ each_local_lib() do |lib|
467
+ if PrjFileCache.contain?('LIB', lib)
468
+ local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.a"
469
+ elsif PrjFileCache.contain?('SOLIB', lib)
470
+ local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.so"
471
+ end
472
+ end
479
473
 
480
- # Greps for a string in a file
481
- #
482
- # @param [String] file Filename to be used for operation
483
- # @param [String] string String to be searched for in file
484
- #
485
- # @return [boolean] true if string found inside file, false otherwise
486
- #
487
- def fgrep(file, string)
488
- open(file) { |f| f.grep(/#{string}/) }
489
- end
490
- end
474
+ local_libs
475
+ end
491
476
 
477
+ # Greps for a string in a file
478
+ #
479
+ # @param [String] file Filename to be used for operation
480
+ # @param [String] string String to be searched for in file
481
+ #
482
+ # @return [boolean] true if string found inside file, false otherwise
483
+ #
484
+ def fgrep(file, string)
485
+ open(file).grep(/#{string}/).any?
486
+ end
487
+ end
492
488
  end
@@ -19,7 +19,8 @@ module RakeOE
19
19
  DEFAULT_DIRS = {
20
20
  :apps => %w[src/app],
21
21
  :libs => %w[src/lib src/3rdparty],
22
- :build => 'build'
22
+ :build => 'build',
23
+ :deploy => 'deploy'
23
24
  }
24
25
 
25
26
  # Default release mode used for the project if no such parameter given via Rakefile
@@ -27,6 +27,8 @@ module RakeOE
27
27
 
28
28
  # Returns test framework include path
29
29
  def include
30
+ raise 'No test framework include directory exported!' if @params[:include_dir].empty?
31
+
30
32
  @params[:include_dir]
31
33
  end
32
34
 
@@ -68,7 +68,7 @@ class Toolchain
68
68
 
69
69
  # returns the build directory
70
70
  def build_dir
71
- @config.directories[:build]
71
+ "#{@config.directories[:build]}/#{@target}/#{@config.release}"
72
72
  end
73
73
 
74
74
 
@@ -200,10 +200,12 @@ class Toolchain
200
200
  @settings['LIB_SRC_DIR'] = 'src/lib'
201
201
 
202
202
  # derived settings
203
- @settings['BUILD_DIR'] = "#{build_dir}/#{@target}/#{@config.release}"
203
+ @settings['BUILD_DIR'] = "#{build_dir}"
204
204
  @settings['LIB_OUT'] = "#{@settings['BUILD_DIR']}/libs"
205
205
  @settings['APP_OUT'] = "#{@settings['BUILD_DIR']}/apps"
206
- @settings['SYS_LFLAGS'] = "-L#{@settings['OECORE_TARGET_SYSROOT']}/lib -L#{@settings['OECORE_TARGET_SYSROOT']}/usr/lib"
206
+ unless @settings['OECORE_TARGET_SYSROOT'].nil? || @settings['OECORE_TARGET_SYSROOT'].empty?
207
+ @settings['SYS_LFLAGS'] = "-L#{@settings['OECORE_TARGET_SYSROOT']}/lib -L#{@settings['OECORE_TARGET_SYSROOT']}/usr/lib"
208
+ end
207
209
 
208
210
  # set LD_LIBRARY_PATH
209
211
  @settings['LD_LIBRARY_PATH'] = @settings['LIB_OUT']
@@ -333,13 +335,7 @@ class Toolchain
333
335
  object = params[:object]
334
336
  source = params[:source]
335
337
  incs = compiler_incs_for(params[:includes]) + " #{@settings['LIB_INC']}"
336
- =begin
337
- puts
338
- puts "incs for #{object}: #{incs}"
339
- puts
340
- puts "params[:includes]:#{params[:includes]}"
341
- puts
342
- =end
338
+
343
339
  case
344
340
  when cpp_source_extensions.include?(extension)
345
341
  flags = @settings['CXXFLAGS'] + ' ' + params[:settings]['ADD_CXXFLAGS']
@@ -1,3 +1,3 @@
1
1
  module RakeOE
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/rakeoe.rb CHANGED
@@ -22,6 +22,7 @@ module RakeOE
22
22
  #
23
23
  # @param config [RakeOE::Config] Configuration as provided by project Rakefile
24
24
  #
25
+ # @return [RakeOE::Toolchain] Toolchain object
25
26
  def init(config)
26
27
 
27
28
  RakeOE::PrjFileCache.sweep_recursive(config.directories[:apps] + config.directories[:libs])
@@ -71,7 +72,30 @@ module RakeOE
71
72
  end
72
73
  end
73
74
 
74
- desc 'Dumps configuration & toolchain variables'
75
+ desc 'Deploys apps and dynamic objects to deploy_dir/bin, deploy_dir/lib'
76
+ task :deploy, [:deploy_dir] => :all do |t, args|
77
+ args.with_defaults(:deploy_dir => config.directories[:deploy])
78
+ puts "Copy binaries from #{toolchain.build_dir} => #{args.deploy_dir}"
79
+ begin
80
+ FileUtils.mkdir_p("#{args.deploy_dir}/bin")
81
+ FileUtils.mkdir_p("#{args.deploy_dir}/lib")
82
+ rescue
83
+ raise
84
+ end
85
+
86
+ # deploy binaries
87
+ Dir.glob("#{toolchain.build_dir}/apps/*").each do |file|
88
+ next if file.end_with?('.bin')
89
+ FileUtils.cp(file, "#{args.deploy_dir}/bin/#{File.basename(file)}") if File.executable?(file)
90
+ end
91
+ # deploy dynamic libraries
92
+ Dir.glob("#{toolchain.build_dir}/libs/*.so").each do |file|
93
+ next if file.end_with?('.bin')
94
+ FileUtils.cp(file, "#{args.deploy_dir}/lib/")
95
+ end
96
+ end
97
+
98
+ desc 'Dump configuration & toolchain variables'
75
99
  task :dump do
76
100
  puts
77
101
  config.dump
@@ -88,6 +112,8 @@ module RakeOE
88
112
 
89
113
  # kind of mrproper/realclean
90
114
  CLOBBER.include('*.tmp', "#{config.directories[:build]}/*")
115
+
116
+ toolchain
91
117
  end
92
118
  end
93
119
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakeoe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schnell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2014-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler