Skip to content

Commit

Permalink
Merge pull request #95 from rock-core/default_cxx11_castxml
Browse files Browse the repository at this point in the history
control C++11 and castxml selection
  • Loading branch information
doudou committed Dec 30, 2016
2 parents 047ff87 + 613e660 commit 727e11e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 3 deletions.
29 changes: 29 additions & 0 deletions defaults.osdeps
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file defines fake osdep entries to check whether certain features should
# be enabled on certain OSes by default
#
# 'nonexistent' => no
# 'ignore' => yes


# Check whether the default C++ loader should be castxml (ignore) or gccxml
# (nonexistent)
default_castxml:
ubuntu:
'12.04,12.10,13.04,13.10,14.04,14.10,15.04': nonexistent
default: ignore
debian:
testing,unstable: ignore
default: nonexistent
default: nonexistent

# Check whether the default C++ standard should be C++11 (ignore) or C++98
# (nonexistent)
default_cxx11:
ubuntu:
'12.04,12.10,13.04,13.10,14.04,14.10,15.04,15.10': nonexistent
default: ignore
debian:
testing,unstable: ignore
default: nonexistent
default: nonexistent

1 change: 1 addition & 0 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,4 @@ def bundle_package(*args, &block)
if Autobuild.macos?
Autobuild::Orogen.transports.delete("mqueue")
end

14 changes: 11 additions & 3 deletions overrides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@
Autoproj.warn " #{pkgs}"
end

require File.join(File.dirname(__FILE__), 'rock/git_hook')
require File.join(File.dirname(__FILE__), 'rock/cmake_build_type')

Autoproj.env_add_path 'ROCK_BUNDLE_PATH', File.join(Autobuild.prefix, 'share', 'rock')
Autoproj.env_add_path 'ROCK_BUNDLE_PATH', File.join(Autoproj.root_dir, 'bundles')

require File.join(__dir__, 'rock', 'cxx11')
if Autoproj.respond_to?(:workspace) # autoproj 2.0
Rock.setup_cxx11_support(Autoproj.workspace.os_package_resolver, Autoproj.config)
else
Rock.setup_cxx11_support(Autoproj.osdeps, Autoproj.config)
end

require File.join(__dir__, 'rock', 'git_hook')
require File.join(__dir__, 'rock', 'cmake_build_type')
Autoproj.manifest.each_autobuild_package do |pkg|
case pkg.importer
when Autobuild::Git
Expand Down Expand Up @@ -91,6 +97,8 @@
setup_package(pkg.name) do
pkg.define 'ROCK_TEST_LOG_DIR', pkg.test_utility.source_dir
end

pkg.define 'ROCK_USE_CXX11', Autoproj.config.get('cxx11')
end
end

Expand Down
26 changes: 26 additions & 0 deletions rock/cxx11.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module Rock
# Offer the C++11 option only on systems where we either can install castxml
# from the OS packages, or build it.
#
# But then, set it to true on OSes where it should. This is controlled by
# stub osdep entries in defaults.osdeps
def self.setup_cxx11_support(os_package_resolver, config)
if os_package_resolver.has?('libclang-castxml') || os_package_resolver.has?('castxml')
config.declare 'cxx11', 'boolean',
default: 'no',
doc: "whether C++11 should be enabled for Rock packages"
else
config.set 'typelib_cxx_loader', 'gccxml'
config.set 'cxx11', false
end

if !config.has_value_for?('castxml') && os_package_resolver.has?('default_castxml')
config.set 'typelib_cxx_loader', 'castxml', true
elsif config.get('cxx11')
config.set 'typelib_cxx_loader', 'castxml'
else
config.set 'typelib_cxx_loader', 'gccxml'
end
end
end

0 comments on commit 727e11e

Please sign in to comment.