diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ee40e3079..6b4b2741ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -502,6 +502,11 @@ if( MINGW AND USE_WX_GRAPHICS_CONTEXT ) check_find_package_result( GDI_PLUS_FOUND "GDI+" ) endif() +# Find ngspice library, required for integrated circuit simulator +if( KICAD_SPICE ) + find_package( ngspice REQUIRED ) +endif() + # Assist with header file searching optimization: # INC_BEFORE and INC_AFTER are two lists which go at the front and back of the # header file search lists, respectively. diff --git a/CMakeModules/Findngspice.cmake b/CMakeModules/Findngspice.cmake new file mode 100644 index 0000000000..1b394409a1 --- /dev/null +++ b/CMakeModules/Findngspice.cmake @@ -0,0 +1,25 @@ +# CMake script for finding libngspice +# (C) CERN 2016 +# Author: Maciej Suminski + +find_path( NGSPICE_INCLUDE_DIR ngspice/sharedspice.h + PATHS ${NGSPICE_INCLUDE_PATH} + PATH_SUFFIXES share/ngspice/include +) + +find_library( NGSPICE_LIBRARY ngspice + PATHS ${NGSPICE_LIBRARY_PATH} +) + +include( FindPackageHandleStandardArgs ) + +find_package_handle_standard_args( ngspice + REQUIRED_VARS + NGSPICE_INCLUDE_DIR + NGSPICE_LIBRARY +) + +mark_as_advanced( + NGSPICE_INCLUDE_DIR + NGSPICE_LIBRARY +) diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index d582c7c31f..b9e4faada6 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -1,5 +1,9 @@ add_definitions( -DEESCHEMA ) +if( KICAD_SPICE ) + set( INC_AFTER ${INC_AFTER} ${NGSPICE_INCLUDE_DIR} ) +endif() + include_directories( BEFORE ${INC_BEFORE} ) include_directories( ./dialogs @@ -195,7 +199,7 @@ set( EESCHEMA_COMMON_SRCS if( KICAD_SPICE ) - set( EESCHEMA_SRCS + set( EESCHEMA_SRCS ${EESCHEMA_SRCS} sim/simulate.cpp sim/sim_plot_frame_base.cpp diff --git a/eeschema/sim/ngspice.h b/eeschema/sim/ngspice.h index 0605c62b0c..7877811b8d 100644 --- a/eeschema/sim/ngspice.h +++ b/eeschema/sim/ngspice.h @@ -25,9 +25,10 @@ #ifndef NGSPICE_H #define NGSPICE_H -#include <../share/ngspice/include/ngspice/sharedspice.h> #include "spice_simulator.h" +#include + class wxDynamicLibrary; class NGSPICE : public SPICE_SIMULATOR {