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

[melodic] pass ROS_BUILD_SHARED_LIBS to use visibility control properly. #89

Merged
merged 3 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 5 additions & 3 deletions cmake/sip_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ def get_sip_dir_flags(config):
' that PyQt5 is installed')


if len(sys.argv) != 8:
print('usage: %s build-dir sip-file output_dir include_dirs libs lib_dirs ldflags' %
if len(sys.argv) != 9:
print('usage: %s build-dir sip-file output_dir include_dirs libs lib_dirs ldflags extra_defines' %
sys.argv[0])
sys.exit(1)

# The SIP build folder, the SIP file, the output directory, the include
# directories, the libraries, the library directories and the linker
# flags.
build_dir, sip_file, output_dir, include_dirs, libs, lib_dirs, ldflags = sys.argv[1:]
build_dir, sip_file, output_dir, include_dirs, libs, lib_dirs, ldflags, extra_defines = sys.argv[1:]

# The name of the SIP build file generated by SIP and used by the build system.
build_file = 'pyqtscripting.sbf'
Expand Down Expand Up @@ -152,6 +152,8 @@ def split_paths(paths):
makefile.extra_lib_dirs.append(lib_dir)
for ldflag in ldflags.split('\\ '):
makefile.LFLAGS.append(ldflag)
for extra_define in extra_defines.split(' '):
makefile.extra_defines.append(extra_define)

# redirect location of generated library
makefile._target = '"%s"' % os.path.join(output_dir, makefile._target)
Expand Down
7 changes: 6 additions & 1 deletion cmake/sip_helper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,19 @@ function(build_sip_binding PROJECT_NAME SIP_FILE)
set(LIBRARY_DIRS ${${PROJECT_NAME}_LIBRARY_DIRS})
set(LDFLAGS_OTHER ${${PROJECT_NAME}_LDFLAGS_OTHER})

set(EXTRA_DEFINES "")
if(BUILD_SHARED_LIBS)
set(EXTRA_DEFINES "ROS_BUILD_SHARED_LIBS")
endif()

# SIP configure doesn't handle build configuration keywords
catkin_filter_libraries_for_build_configuration(LIBRARIES ${${PROJECT_NAME}_LIBRARIES})
# SIP configure doesn't handle CMake targets
catkin_replace_imported_library_targets(LIBRARIES ${LIBRARIES})

add_custom_command(
OUTPUT ${SIP_BUILD_DIR}/Makefile
COMMAND ${PYTHON_EXECUTABLE} ${sip_SIP_CONFIGURE} ${SIP_BUILD_DIR} ${SIP_FILE} ${sip_LIBRARY_DIR} \"${INCLUDE_DIRS}\" \"${LIBRARIES}\" \"${LIBRARY_DIRS}\" \"${LDFLAGS_OTHER}\"
COMMAND ${PYTHON_EXECUTABLE} ${sip_SIP_CONFIGURE} ${SIP_BUILD_DIR} ${SIP_FILE} ${sip_LIBRARY_DIR} \"${INCLUDE_DIRS}\" \"${LIBRARIES}\" \"${LIBRARY_DIRS}\" \"${LDFLAGS_OTHER}\" \"${EXTRA_DEFINES}\"
DEPENDS ${sip_SIP_CONFIGURE} ${SIP_FILE} ${sip_DEPENDS}
WORKING_DIRECTORY ${sip_SOURCE_DIR}
COMMENT "Running SIP generator for ${PROJECT_NAME} Python bindings..."
Expand Down