rakeoe 0.0.4 → 0.0.5

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: e5b4889f8d03d07ad15a14a56daace5e4ff4022e
4
- data.tar.gz: 1b73e5c46b144fc90f2c2d8ba348cc0eabc4f49f
3
+ metadata.gz: 16889146f1dfe6b18c54134600a1bb0d50cbcb73
4
+ data.tar.gz: 16f665ef351341f58ac49a24ba606ae5076347c8
5
5
  SHA512:
6
- metadata.gz: 710af6324c7c75ecbf7f72165b6141e1a3613a4df8c2c62c3eac4f94d5e9819990ea3700cc246e643919ca55a75c1fe7b1b1b574c0832d00c15c3320af3c0b81
7
- data.tar.gz: 9dfd5d613c237b0068a52aa349cf66cf1994b6c6fc9cf2ef937d22ba814ba8cb84577604913dd554f40a991e8de76abd4a43449094c234c337c0ac76728d1525
6
+ metadata.gz: 1799f93d02f059d70422b2ab668d7e9f25a2fcbcec36d34b6be561407ff4d826537bb4c492ec42e2b26d03696c8b2e971208d77947bbd7b8eafa9fbcc8551fd8
7
+ data.tar.gz: 0b4bafea9ed296b87b908bd993102d8ba65da52edb1dabf80ee3af10f5d115a2e5d0e470345f10a54be6b258606ec6f02594aaf46bc6e9276418edcb20d4a525
@@ -366,21 +366,9 @@ module RakeOE
366
366
  # Create build rules for generating an object. Dependency to corresponding source file is made via proc
367
367
  # object
368
368
  def create_build_rules
369
+ platform_flags_fixup(search_libs(@settings))
369
370
 
370
371
  incs = inc_dirs
371
- # find platform specific resource flags
372
- libs = search_libs(@settings)
373
- libs[:all].each do |name|
374
- platform_settings = tc.res_platform_settings(name)
375
- unless platform_settings.empty?
376
- @settings['ADD_CFLAGS'] += " #{platform_settings[:CFLAGS]}" if platform_settings[:CFLAGS]
377
- @settings['ADD_CXXFLAGS'] += " #{platform_settings[:CXXFLAGS]}" if platform_settings[:CXXFLAGS]
378
- # platform_settings[:LDFLAGS] is set in Toolchain#linker_line_for
379
- # XXX: remove all -lXX settings from platform_settings[:LDFLAGS] and add rest to @settings['ADD_LDFLAGS'],
380
- # XXX: use all -lXX in Toolchain#linker_line_for
381
- end
382
- end
383
-
384
372
  # map object to source file and make it dependent on creation of all object directories
385
373
  rule /#{build_dir}\/.*\.o/ => [ proc {|tn| obj_to_source(tn, src_dir, build_dir)}] + obj_dirs do |t|
386
374
  if t.name =~ /\/tests\//
@@ -391,9 +379,9 @@ module RakeOE
391
379
  end
392
380
 
393
381
  tc.obj(:source => t.source,
394
- :object => t.name,
395
- :settings => @settings,
396
- :includes => incs.uniq)
382
+ :object => t.name,
383
+ :settings => @settings,
384
+ :includes => incs.uniq)
397
385
  end
398
386
 
399
387
  # map dependency to source file and make it dependent on creation of all object directories
@@ -412,16 +400,34 @@ module RakeOE
412
400
  end
413
401
 
414
402
  tc.dep(:source => t.source,
415
- :dep => t.name,
416
- :settings => @settings,
417
- :includes => incs.uniq)
403
+ :dep => t.name,
404
+ :settings => @settings,
405
+ :includes => incs.uniq)
418
406
  end
419
407
 
420
408
  # make moc source file dependent on corresponding header file, XXX DS: only if project uses QT
421
409
  rule /#{src_dir}\/.*moc_.*#{Regexp.escape(tc.moc_source)}$/ => [ proc {|tn| tn.gsub(/moc_/, '').ext(tc.moc_header_extension) } ] do |t|
422
410
  tc.moc(:source => t.source,
423
- :moc => t.name,
424
- :settings => @settings)
411
+ :moc => t.name,
412
+ :settings => @settings)
413
+ end
414
+ end
415
+
416
+ # Change ADD_CFLAGS, ADD_CXXFLAGS, ADD_LDFLAGS according to settings in platform file.
417
+ #
418
+ # @param libs [Array] Array of libraries to be considered
419
+ #
420
+ def platform_flags_fixup(libs)
421
+ libs[:all].each do |lib|
422
+ ps = tc.platform_settings_for(lib)
423
+ unless ps.empty?
424
+ @settings['ADD_CFLAGS'] += " #{ps[:CFLAGS]}" if ps[:CFLAGS]
425
+ @settings['ADD_CXXFLAGS'] += " #{ps[:CXXFLAGS]}" if ps[:CXXFLAGS]
426
+
427
+ # remove all -lXX settings from ps[:LDFLAGS] and use rest for @settings['ADD_LDFLAGS'],
428
+ # -lXX is set in Toolchain#linker_line_for
429
+ @settings['ADD_LDFLAGS'] += ps[:LDFLAGS].gsub(/(\s|^)+-l\S+/, '') if ps[:LDFLAGS]
430
+ end
425
431
  end
426
432
  end
427
433
 
data/lib/rakeoe/lib.rb CHANGED
@@ -84,11 +84,11 @@ module RakeOE
84
84
  file test_binary => [@test_fw.binary_path] + [binary] + test_deps + test_objs do
85
85
  prj_libs = search_libs(settings)
86
86
  tc.test(:objects => test_objs,
87
- :test => test_binary,
88
- :libs => prj_libs[:all] + [name],
89
- :framework => @test_fw.name,
90
- :settings => @settings,
91
- :includes => test_dirs)
87
+ :test => test_binary,
88
+ :libs => prj_libs[:all] + [name],
89
+ :framework => @test_fw.name,
90
+ :settings => @settings,
91
+ :includes => test_dirs)
92
92
  end
93
93
  CLEAN.include(test_binary, build_dir)
94
94
  task :all => "#{name}"
@@ -287,7 +287,7 @@ class Toolchain
287
287
  paths.each_with_object('') {|path, str| str << " -I#{path}"}
288
288
  end
289
289
 
290
- # Generates linker line from given library list
290
+ # Generates linker line from given library list.
291
291
  #
292
292
  # @param [Array] libs Libraries to be used for linker line
293
293
  #
@@ -295,12 +295,13 @@ class Toolchain
295
295
  #
296
296
  def linker_line_for(libs)
297
297
  libs.map do |lib|
298
- settings = res_platform_settings(lib)
298
+ settings = platform_settings_for(lib)
299
299
  if settings[:LDFLAGS].nil?
300
300
  # automatic linker line if no platform specific LDFLAGS exist
301
301
  "-l#{lib}"
302
302
  else
303
- settings[:LDFLAGS]
303
+ # only matches -l<libname> settings
304
+ /(\s|^)+-l\S+/.match(settings[:LDFLAGS]).to_s
304
305
  end
305
306
  end.join(' ').strip
306
307
  end
@@ -320,7 +321,7 @@ class Toolchain
320
321
  # The returned hash has the following format:
321
322
  # { :CFLAGS => '...', :CXXFLAGS => '...', :LDFLAGS => '...'}
322
323
  #
323
- def res_platform_settings(resource_name)
324
+ def platform_settings_for(resource_name)
324
325
  return {} if resource_name.empty?
325
326
 
326
327
  rv = Hash.new
@@ -1,3 +1,3 @@
1
1
  module RakeOE
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakeoe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schnell