Merged in fix/python_hide_library_rebased (pull request #288)

[python] Make python library hidden by renaming gtsampy.so to _gtsampy.so
release/4.3a0
Chris Beall 2017-03-08 07:10:45 +00:00
commit 2a7c64d4a8
4 changed files with 6 additions and 6 deletions

View File

@ -1 +1 @@
from gtsampy import * from _gtsampy import *

View File

@ -12,7 +12,7 @@ endforeach()
add_library(gtsam_python SHARED exportgtsam.cpp ${gtsam_python_srcs}) add_library(gtsam_python SHARED exportgtsam.cpp ${gtsam_python_srcs})
string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type_toupper) string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type_toupper)
set_target_properties(gtsam_python PROPERTIES set_target_properties(gtsam_python PROPERTIES
OUTPUT_NAME gtsampy OUTPUT_NAME _gtsampy
PREFIX "" PREFIX ""
${build_type_toupper}_POSTFIX "" ${build_type_toupper}_POSTFIX ""
SKIP_BUILD_RPATH TRUE SKIP_BUILD_RPATH TRUE
@ -31,11 +31,11 @@ target_link_libraries(gtsam_python
# Cause the library to be output in the correct directory. # Cause the library to be output in the correct directory.
# TODO: Change below to work on different systems (currently works only with Linux) # TODO: Change below to work on different systems (currently works only with Linux)
set(output_path ${CMAKE_CURRENT_BINARY_DIR}/../gtsam/_libgtsam_python.so) set(output_path ${CMAKE_CURRENT_BINARY_DIR}/../gtsam/_gtsampy.so)
add_custom_command( add_custom_command(
OUTPUT ${output_path} OUTPUT ${output_path}
DEPENDS gtsam_python DEPENDS gtsam_python
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gtsam_python> ${output_path} COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gtsam_python> ${output_path}
COMMENT "Copying extension module to python/gtsam/_libgtsam_python.so" COMMENT "Copying extension module to python/gtsam/_gtsampy.so"
) )
add_custom_target(copy_gtsam_python_module ALL DEPENDS ${output_path}) add_custom_target(copy_gtsam_python_module ALL DEPENDS ${output_path})

View File

@ -62,7 +62,7 @@ void registerNumpyEigenConversions();
//-----------------------------------// //-----------------------------------//
BOOST_PYTHON_MODULE(gtsampy){ BOOST_PYTHON_MODULE(_gtsampy){
// NOTE: We need to call import_array1() instead of import_array() to support both python 2 // NOTE: We need to call import_array1() instead of import_array() to support both python 2
// and 3. The reason is that BOOST_PYTHON_MODULE puts all its contents in a function // and 3. The reason is that BOOST_PYTHON_MODULE puts all its contents in a function

View File

@ -11,5 +11,5 @@ setup(name='gtsam',
package_dir={ '': '${CMAKE_CURRENT_SOURCE_DIR}' }, package_dir={ '': '${CMAKE_CURRENT_SOURCE_DIR}' },
packages=['gtsam', 'gtsam_utils', 'gtsam_examples', 'gtsam_tests'], packages=['gtsam', 'gtsam_utils', 'gtsam_examples', 'gtsam_tests'],
#package_data={'gtsam' : ['_libgtsam_python.so']}, # location of .so file is relative to package_dir #package_data={'gtsam' : ['_libgtsam_python.so']}, # location of .so file is relative to package_dir
data_files=[('${PY_INSTALL_FOLDER}/gtsam/', ['gtsam/_libgtsam_python.so'])], # location of .so file relative to setup.py data_files=[('${PY_INSTALL_FOLDER}/gtsam/', ['gtsam/_gtsampy.so'])], # location of .so file relative to setup.py
) )