diff --git a/src/robot_dart/utils.hpp b/src/robot_dart/utils.hpp index 7e92643c..bb0ec489 100644 --- a/src/robot_dart/utils.hpp +++ b/src/robot_dart/utils.hpp @@ -48,12 +48,12 @@ namespace robot_dart { std::cerr << "[robot_dart WARNING]: \"" << message << "\"" << std::endl; \ } -#define ROBOT_DART_ASSERT(condition, message, returnValue) \ - do { \ - if (!(condition)) { \ - std::cerr << "robot_dart assertion failed: " << message << std::endl; \ - return returnValue; \ - } \ +#define ROBOT_DART_ASSERT(condition, message, returnValue) \ + do { \ + if (!(condition)) { \ + std::cerr << __LINE__ << " " << __FILE__ << " -> robot_dart assertion failed: " << message << std::endl; \ + return returnValue; \ + } \ } while (false) #define ROBOT_DART_EXCEPTION_ASSERT(condition, message) \ diff --git a/waf_tools/boost.py b/waf_tools/boost.py index d5ada8ee..0a8f1dd1 100644 --- a/waf_tools/boost.py +++ b/waf_tools/boost.py @@ -32,8 +32,8 @@ def build(bld): from waflib import Utils, Logs from waflib.Configure import conf -BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib/x86_64-linux-gnu/', '/opt/homebrew/lib'] -BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] +BOOST_LIBS = ['/usr/lib', '/usr/local/lib64', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/usr/local/lib/x86_64-linux-gnu/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib/aarch64-linux-gnu/', '/opt/homebrew/lib'] +BOOST_INCLUDES = ['/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] BOOST_VERSION_FILE = 'boost/version.hpp' BOOST_VERSION_CODE = ''' #include diff --git a/waf_tools/corrade.py b/waf_tools/corrade.py index 1947073f..88372226 100644 --- a/waf_tools/corrade.py +++ b/waf_tools/corrade.py @@ -38,7 +38,7 @@ def find_in_string(data, text): return includes_check = ['/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] - libs_check = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib/x86_64-linux-gnu/', '/usr/lib64', '/opt/homebrew/lib'] + libs_check = ['/usr/lib', '/usr/local/lib64', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/usr/local/lib/x86_64-linux-gnu/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib/aarch64-linux-gnu/', '/opt/homebrew/lib'] bins_check = ['/usr/bin', '/usr/local/bin', '/opt/local/bin', '/sw/bin', '/bin', '/opt/homebrew/bin'] # OSX/Mac uses .dylib and GNU/Linux .so diff --git a/waf_tools/dart.py b/waf_tools/dart.py index ab03a6c4..dce00651 100644 --- a/waf_tools/dart.py +++ b/waf_tools/dart.py @@ -33,16 +33,16 @@ def get_directory(filename, dirs): includes_check = [conf.options.dart + '/include'] libs_check = [conf.options.dart + '/lib'] else: - includes_check = ['/usr/local/include', '/usr/include', '/opt/homebrew/include'] - libs_check = ['/usr/local/lib', '/usr/local/lib64', '/usr/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/opt/homebrew/lib'] + includes_check = ['/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] + libs_check = ['/usr/lib', '/usr/local/lib64', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/usr/local/lib/x86_64-linux-gnu/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib/aarch64-linux-gnu/', '/opt/homebrew/lib'] if 'RESIBOTS_DIR' in os.environ: includes_check = [os.environ['RESIBOTS_DIR'] + '/include'] + includes_check libs_check = [os.environ['RESIBOTS_DIR'] + '/lib'] + libs_check # DART has some optional Bullet features - bullet_check = ['/usr/local/include/bullet', '/usr/include/bullet', '/opt/homebrew/include/bullet'] - bullet_libs = ['/usr/local/lib', '/usr/local/lib64', '/usr/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/opt/homebrew/lib'] + bullet_check = ['/usr/local/include/bullet', '/usr/include/bullet', '/opt/local/include/bullet', '/sw/include/bullet', '/opt/homebrew/include/bullet', '/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] + bullet_libs = ['/usr/lib', '/usr/local/lib64', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/usr/local/lib/x86_64-linux-gnu/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib/aarch64-linux-gnu/', '/opt/homebrew/lib'] bullet_include = [] bullet_lib = [] bullet_found = False @@ -57,8 +57,8 @@ def get_directory(filename, dirs): bullet_found = False # DART has some optional ODE features - ode_check = ['/usr/local/include', '/usr/include', '/opt/homebrew/include'] - ode_libs = ['/usr/local/lib', '/usr/local/lib64', '/usr/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/opt/homebrew/lib'] + ode_check = ['/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] + ode_libs = ['/usr/lib', '/usr/local/lib64', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/usr/local/lib/x86_64-linux-gnu/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib/aarch64-linux-gnu/', '/opt/homebrew/lib'] ode_include = [] ode_lib = [] ode_found = False @@ -73,8 +73,8 @@ def get_directory(filename, dirs): ode_found = False # DART has some optional Octomap dependency - octomap_check = ['/usr/local/include', '/usr/include', '/opt/homebrew/include'] - octomap_libs = ['/usr/local/lib', '/usr/local/lib64', '/usr/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/opt/homebrew/lib'] + octomap_check = ['/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] + octomap_libs = ['/usr/lib', '/usr/local/lib64', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/usr/local/lib/x86_64-linux-gnu/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib/aarch64-linux-gnu/', '/opt/homebrew/lib'] if 'ROS_DISTRO' in os.environ: octomap_check.append('/opt/ros/' + os.environ['ROS_DISTRO'] + '/include') octomap_libs.append('/opt/ros/' + os.environ['ROS_DISTRO'] + '/lib') diff --git a/waf_tools/eigen.py b/waf_tools/eigen.py index a071784c..c833069d 100644 --- a/waf_tools/eigen.py +++ b/waf_tools/eigen.py @@ -45,7 +45,7 @@ def check_eigen(conf, *k, **kw): def get_directory(filename, dirs): res = conf.find_file(filename, dirs) return res[:-len(filename)-1] - includes_check = ['/usr/include/eigen3', '/usr/local/include/eigen3', '/usr/include', '/usr/local/include', '/opt/homebrew/include', '/opt/homebrew/include/eigen3'] + includes_check = ['/usr/include/eigen3', '/usr/local/include/eigen3', '/opt/local/include/eigen3', '/sw/include/eigen3', '/opt/homebrew/include/eigen3', '/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] required = kw.get('required', False) min_version = kw.get('min_version', (3,3,3)) diff --git a/waf_tools/magnum.py b/waf_tools/magnum.py index 7adb2269..16b4d8f3 100644 --- a/waf_tools/magnum.py +++ b/waf_tools/magnum.py @@ -117,7 +117,7 @@ def fatal(required, msg): return includes_check = ['/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] - libs_check = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib/x86_64-linux-gnu/', '/usr/lib64', '/opt/homebrew/lib'] + libs_check = ['/usr/lib', '/usr/local/lib64', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/usr/local/lib/x86_64-linux-gnu/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib/aarch64-linux-gnu/', '/opt/homebrew/lib'] bins_check = ['/usr/bin', '/usr/local/bin', '/opt/local/bin', '/sw/bin', '/bin', '/opt/homebrew/bin'] if conf.env['DEST_OS'] == 'darwin': includes_check = includes_check + ['/System/Library/Frameworks/OpenGL.framework/Headers', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/'] diff --git a/waf_tools/magnum_integration.py b/waf_tools/magnum_integration.py index db72dfe5..4425f5a2 100644 --- a/waf_tools/magnum_integration.py +++ b/waf_tools/magnum_integration.py @@ -97,7 +97,7 @@ def find_in_string(data, text): return includes_check = ['/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] - libs_check = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib/x86_64-linux-gnu/', '/usr/lib64', '/opt/homebrew/lib'] + libs_check = ['/usr/lib', '/usr/local/lib64', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/usr/local/lib/x86_64-linux-gnu/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib/aarch64-linux-gnu/', '/opt/homebrew/lib'] bins_check = ['/usr/bin', '/usr/local/bin', '/opt/local/bin', '/sw/bin', '/bin', '/opt/homebrew/bin'] # Magnum depends on several libraries and we cannot make the assumption that diff --git a/waf_tools/magnum_plugins.py b/waf_tools/magnum_plugins.py index d96e4109..09c79ea2 100644 --- a/waf_tools/magnum_plugins.py +++ b/waf_tools/magnum_plugins.py @@ -103,7 +103,7 @@ def find_in_string(data, text): return includes_check = ['/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] - libs_check = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib/x86_64-linux-gnu/', '/usr/lib64', '/opt/homebrew/lib'] + libs_check = ['/usr/lib', '/usr/local/lib64', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib64', '/usr/lib/x86_64-linux-gnu/', '/usr/local/lib/x86_64-linux-gnu/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib/aarch64-linux-gnu/', '/opt/homebrew/lib'] bins_check = ['/usr/bin', '/usr/local/bin', '/opt/local/bin', '/sw/bin', '/bin', '/opt/homebrew/bin'] # Magnum depends on several libraries and we cannot make the assumption that diff --git a/waf_tools/pybind.py b/waf_tools/pybind.py index 5adf680c..90a606d4 100644 --- a/waf_tools/pybind.py +++ b/waf_tools/pybind.py @@ -18,7 +18,7 @@ def check_pybind11(conf, *k, **kw): required = kw.get('required', False) conf.start_msg('Checking for pybind11') - includes_check = ['/usr/include/', '/usr/local/include/', '/opt/homebrew/include'] + includes_check = ['/usr/local/include', '/usr/include', '/opt/local/include', '/sw/include', '/opt/homebrew/include'] if conf.options.pybind11: includes_check = [conf.options.pybind11] diff --git a/wscript b/wscript index 42e6835d..30a7cb3c 100644 --- a/wscript +++ b/wscript @@ -43,6 +43,7 @@ def options(opt): opt.add_option('--tests', action='store_true', help='compile tests or not', dest='tests') opt.add_option('--python', action='store_true', help='compile python bindings', dest='pybind') opt.add_option('--no-robot_dart', action='store_true', help='only install the URDF library (utheque) / deactivate RobotDART', dest='utheque_only') + opt.add_option('--no-pic', action='store_true', help='do not compile with position independent code', dest='no_pic') def configure(conf): @@ -113,7 +114,8 @@ def configure_robot_dart(conf): conf.check_python_module('dartpy') conf.check_pybind11(required=True) conf.env['BUILD_PYTHON'] = True - conf.env['py_flags'] = ' -fPIC' # we need -fPIC + if not conf.options.build_shared: + conf.env['py_flags'] = ' -fPIC' # we need -fPIC for python if building static # We require Magnum DartIntegration, EigenIntegration, AssimpImporter, and StbTrueTypeFont if len(conf.env.INCLUDES_MagnumIntegration_Dart) > 0 and len(conf.env.INCLUDES_MagnumIntegration_Eigen) > 0 and len(conf.env.INCLUDES_MagnumPlugins_AssimpImporter) > 0 and len(conf.env.INCLUDES_MagnumPlugins_StbTrueTypeFont) > 0: @@ -152,6 +154,9 @@ def configure_robot_dart(conf): if gcc_version >= 71: opt_flags = opt_flags + " -faligned-new" + if (not conf.options.build_shared) and (not conf.options.no_pic): + common_flags += ' -fPIC' + all_flags = common_flags + conf.env['py_flags'] + opt_flags conf.env['CXXFLAGS'] = conf.env['CXXFLAGS'] + all_flags.split(' ') @@ -171,6 +176,9 @@ def configure_robot_dart(conf): # add strict flags for warnings corrade.corrade_enable_pedantic_flags(conf) + + # keep only one time each flag + conf.env['CXXFLAGS'] = list(set(conf.env['CXXFLAGS'])) print(conf.env['CXXFLAGS']) def summary(bld):