Fix Cython build on Windows/MSVC, tested on MSVC 2019 compiler

release/4.3a0
Tuwuh S Wibowo 2020-05-21 02:15:15 -04:00
parent c66b227410
commit 125d59dfcd
3 changed files with 12 additions and 1 deletions

View File

@ -87,6 +87,12 @@ endfunction()
# - output_dir: The output directory
function(build_cythonized_cpp target cpp_file output_lib_we output_dir)
add_library(${target} MODULE ${cpp_file})
# Use .pyd extension instead of .dll on Windows
if(WIN32)
set_target_properties(${target} PROPERTIES SUFFIX ".pyd")
endif()
if(APPLE)
set(link_flags "-undefined dynamic_lookup")
endif()

View File

@ -7,6 +7,11 @@ if (GTSAM_INSTALL_CYTHON_TOOLBOX)
add_subdirectory(gtsam_eigency)
include_directories(${PROJECT_BINARY_DIR}/cython/gtsam_eigency)
# Fix for error "C1128: number of sections exceeded object file format limit"
if(MSVC)
add_compile_options(/bigobj)
endif()
# wrap gtsam
add_custom_target(gtsam_header DEPENDS "../gtsam.h")
wrap_and_install_library_cython("../gtsam.h" # interface_header

View File

@ -35,7 +35,7 @@ setup(
packages=packages,
package_data={package:
[f for f in os.listdir(package.replace('.', os.path.sep)) if os.path.splitext(f)[1] in ('.so', '.dll')]
[f for f in os.listdir(package.replace('.', os.path.sep)) if os.path.splitext(f)[1] in ('.so', '.pyd')]
for package in packages
},
install_requires=[line.strip() for line in '''