@@ -218,12 +218,15 @@ cython_add_module(dynd.ndt.type dynd.ndt.type_pyx True
218218 dynd/src/type_deduction.cpp
219219 )
220220
221- foreach (module dynd.ndt.json dynd.nd.callable dynd.nd.functional dynd.nd.registry)
221+ cython_add_module (dynd.ndt.json dynd.ndt.json_pyx True dynd/src/type_conversions.cpp )
222+
223+ foreach (module dynd.nd.callable dynd.nd.functional dynd.nd.registry)
222224 cython_add_module (${module} ${module} _pyx True
223225 # Additional C++ source files:
224226 dynd/src/type_conversions.cpp
225227 dynd/src/array_conversions.cpp )
226228endforeach (module )
229+
227230if (DYND_PYTHON_INPLACE_BUILD)
228231 set_target_library_output_dir (dynd.config "${PROJECT_SOURCE_DIR } /dynd" )
229232 set_target_library_output_dir (dynd.nd.array "${PROJECT_SOURCE_DIR } /dynd/nd" )
@@ -241,7 +244,41 @@ postprocess_cython( postprocess.py dynd.ndt.type_postprocess dynd.ndt.type_pyx d
241244postprocess_cython ( postprocess.py dynd.nd.array_postprocess dynd.nd.array_pyx dynd.nd.array )
242245postprocess_cython ( postprocess.py dynd.nd.callable_postprocess dynd.nd.callable_pyx dynd.nd.callable )
243246
244- foreach (module dynd.config dynd.ndt.type dynd.ndt.json dynd.nd.array dynd.nd.callable dynd.nd.functional dynd.nd.registry)
247+ # Linker commands for the dynd.ndt module.
248+ foreach (module dynd.ndt.type dynd.ndt.json)
249+ # Temporarily continue to define PYDYND_EXPORT to avoid inconsistent linkage warnings.
250+ # This should be removed once the macros have been refactored to hide all symbols
251+ # other than module initialization routines.
252+ set_property (
253+ TARGET ${module}
254+ PROPERTY COMPILE_DEFINITIONS PYDYND_EXPORT
255+ )
256+ if (DYND_INSTALL_LIB)
257+ target_link_libraries (${module} "${LIBDYNDT_LIBRARY} " )
258+ else ()
259+ target_link_libraries (${module} libdyndt )
260+ if (UNIX )
261+ # Make sure libdyndt is on the rpath.
262+ # On Windows, the dll is loaded dynamically via the logic in
263+ # dynd/__init__.py
264+ if (APPLE )
265+ set (module_install_rpath "@loader_path" )
266+ else ()
267+ set (module_install_rpath "$ORIGIN" )
268+ endif ()
269+ string (REPLACE "." ";" module_directories "${module} " )
270+ list (LENGTH module_directories i)
271+ while (${i} GREATER 2)
272+ set (module_install_rpath "${module_install_rpath} /.." )
273+ math (EXPR i "${i} - 1" )
274+ endwhile (${i} GREATER 2 )
275+ set_target_properties (${module} PROPERTIES INSTALL_RPATH ${module_install_rpath} )
276+ endif ()
277+ endif ()
278+ endforeach (module )
279+
280+ # Linker commands for the dynd.nd module.
281+ foreach (module dynd.config dynd.nd.array dynd.nd.callable dynd.nd.functional dynd.nd.registry)
245282 # Temporarily continue to define PYDYND_EXPORT to avoid inconsistent linkage warnings.
246283 # This should be removed once the macros have been refactored to hide all symbols
247284 # other than module initialization routines.
0 commit comments