Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor improvements to wscript (-fPIC) and dart.py + add line number in assert #179

Merged
merged 4 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/robot_dart/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
4 changes: 2 additions & 2 deletions waf_tools/boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <iostream>
Expand Down
2 changes: 1 addition & 1 deletion waf_tools/corrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions waf_tools/dart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion waf_tools/eigen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion waf_tools/magnum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/']
Expand Down
2 changes: 1 addition & 1 deletion waf_tools/magnum_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion waf_tools/magnum_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion waf_tools/pybind.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
10 changes: 9 additions & 1 deletion wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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(' ')

Expand All @@ -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):
Expand Down