Fix some ngspice handling during build for MSVC

This commit is contained in:
Marek Roszko 2022-08-08 18:41:57 -04:00
parent a11f48ef10
commit 22649f79e8
3 changed files with 24 additions and 0 deletions

View File

@ -125,6 +125,14 @@ if( WIN32 AND MSYS )
else()
message( STATUS ": libngspice shared lib found: ${NGSPICE_DLL}\n" )
endif()
elseif( WIN32 AND MSVC )
find_file( NGSPICE_DLL NAMES ngspice.dll
PATHS
${NGSPICE_ROOT_DIR}
PATH_SUFFIXES
bin
lib
)
else()
set( NGSPICE_DLL "${NGSPICE_LIBRARY}" )
endif()

View File

@ -474,6 +474,13 @@ if( KICAD_SPICE )
PRIVATE
${NGSPICE_LIBRARY}
)
if( MSVC )
# Allow for MSVC to debug ngspice from the build directory
add_custom_command( TARGET eeschema_kiface POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${NGSPICE_DLL}" "$<TARGET_FILE_DIR:eeschema_kiface>"
)
endif()
endif()
set_target_properties( eeschema_kiface PROPERTIES

View File

@ -99,6 +99,7 @@ add_executable( qa_eeschema
)
target_link_libraries( qa_eeschema
PRIVATE
eeschema_kiface_objects
common
pcbcommon
@ -110,6 +111,14 @@ target_link_libraries( qa_eeschema
${Boost_LIBRARIES}
)
if( KICAD_SPICE AND MSVC )
# Allow for MSVC to run from the build directory
add_custom_command( TARGET qa_eeschema POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${NGSPICE_DLL}" "$<TARGET_FILE_DIR:qa_eeschema>"
)
endif()
# Eeschema tests, so pretend to be eeschema (for units, etc)
target_compile_definitions( qa_eeschema
PUBLIC EESCHEMA