Don't use REALPATH to find shared/dynamic libraries

We require API compatibility in the ngspice library because we
dynamically load the library and assign function pointers to specific
names/signatures.  This should be consistent for all versions of the the
library until the soversion changes.

Fixes https://gitlab.com/kicad/code/kicad/issues/8878
This commit is contained in:
Seth Hillbrand 2021-08-24 09:56:31 -07:00
parent a02ea1609b
commit 17a17586a6
2 changed files with 10 additions and 5 deletions

View File

@ -51,7 +51,6 @@ if( PKG_CONFIG_FOUND )
endif()
endif()
find_path( NGSPICE_INCLUDE_DIR ngspice/sharedspice.h
PATHS
${NGSPICE_ROOT_DIR}
@ -65,7 +64,13 @@ find_path( NGSPICE_INCLUDE_DIR ngspice/sharedspice.h
share/ngspice/include/ngspice
)
find_library( NGSPICE_LIBRARY ngspice
if( UNIX )
set( NGSPICE_LIB_NAME libngspice.so.0 CACHE STRING "Optionally versioned name of the shared library" )
else()
set( NGSPICE_LIB_NAME ngspice CACHE STRING "Optionally versioned name of the shared library" )
endif()
find_library( NGSPICE_LIBRARY ${NGSPICE_LIB_NAME}
PATHS
${NGSPICE_ROOT_DIR}
$ENV{NGSPICE_ROOT_DIR}
@ -148,5 +153,5 @@ mark_as_advanced(
NGSPICE_LIBRARY
NGSPICE_DLL
NGSPICE_BUILD_VERSION
NGSPIC_HAVE_CONFIG_H
NGSPICE_HAVE_CONFIG_H
)

View File

@ -10,8 +10,8 @@ if( KICAD_SPICE )
set( INC_AFTER ${INC_AFTER} ${NGSPICE_INCLUDE_DIR} )
# Find out the exact libngspice file name
get_filename_component( NGSPICE_DLL_REALPATH "${NGSPICE_DLL}" REALPATH )
get_filename_component( NGSPICE_DLL_FILE "${NGSPICE_DLL_REALPATH}" NAME )
get_filename_component( NGSPICE_DLL_ABSPATH "${NGSPICE_DLL}" ABSOLUTE )
get_filename_component( NGSPICE_DLL_FILE "${NGSPICE_DLL_ABSPATH}" NAME )
set_property( SOURCE sim/ngspice.cpp
APPEND PROPERTY COMPILE_DEFINITIONS