@@ -241,7 +241,41 @@ postprocess_cython( postprocess.py dynd.ndt.type_postprocess dynd.ndt.type_pyx d
241241postprocess_cython ( postprocess.py dynd.nd.array_postprocess dynd.nd.array_pyx dynd.nd.array )
242242postprocess_cython ( postprocess.py dynd.nd.callable_postprocess dynd.nd.callable_pyx dynd.nd.callable )
243243
244- foreach (module dynd.config dynd.ndt.type dynd.ndt.json dynd.nd.array dynd.nd.callable dynd.nd.functional dynd.nd.registry)
244+ # Linker commands for the dynd.ndt module.
245+ foreach (module dynd.ndt.type dynd.ndt.json)
246+ # Temporarily continue to define PYDYND_EXPORT to avoid inconsistent linkage warnings.
247+ # This should be removed once the macros have been refactored to hide all symbols
248+ # other than module initialization routines.
249+ set_property (
250+ TARGET ${module}
251+ PROPERTY COMPILE_DEFINITIONS PYDYND_EXPORT
252+ )
253+ if (DYND_INSTALL_LIB)
254+ target_link_libraries (${module} "${LIBNDT_LIBRARY} " )
255+ else ()
256+ target_link_libraries (${module} libdyndt )
257+ if (UNIX )
258+ # Make sure libdyndt is on the rpath.
259+ # On Windows, the dll is loaded dynamically via the logic in
260+ # dynd/__init__.py
261+ if (APPLE )
262+ set (module_install_rpath "@loader_path" )
263+ else ()
264+ set (module_install_rpath "$ORIGIN" )
265+ endif ()
266+ string (REPLACE "." ";" module_directories "${module} " )
267+ list (LENGTH module_directories i)
268+ while (${i} GREATER 2)
269+ set (module_install_rpath "${module_install_rpath} /.." )
270+ math (EXPR i "${i} - 1" )
271+ endwhile (${i} GREATER 2 )
272+ set_target_properties (${module} PROPERTIES INSTALL_RPATH ${module_install_rpath} )
273+ endif ()
274+ endif ()
275+ endforeach (module )
276+
277+ # Linker commands for the dynd.nd module.
278+ foreach (module dynd.config dynd.nd.array dynd.nd.callable dynd.nd.functional dynd.nd.registry)
245279 # Temporarily continue to define PYDYND_EXPORT to avoid inconsistent linkage warnings.
246280 # This should be removed once the macros have been refactored to hide all symbols
247281 # other than module initialization routines.
0 commit comments