2016-08-12 13:56:51 +00:00
|
|
|
# CMake script for finding libngspice
|
2018-11-02 08:40:50 +00:00
|
|
|
|
|
|
|
# Copyright (C) 2016 CERN
|
2016-08-12 13:56:51 +00:00
|
|
|
# Author: Maciej Suminski <maciej.suminski@cern.ch>
|
2018-11-02 08:40:50 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, you may find one here:
|
|
|
|
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
# or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
# or you may write to the Free Software Foundation, Inc.,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2016-08-12 13:56:51 +00:00
|
|
|
|
|
|
|
find_path( NGSPICE_INCLUDE_DIR ngspice/sharedspice.h
|
2016-08-15 12:39:26 +00:00
|
|
|
PATHS ${NGSPICE_ROOT_DIR} $ENV{NGSPICE_ROOT_DIR} ${NGSPICE_INCLUDE_PATH}
|
2016-08-15 13:27:24 +00:00
|
|
|
PATH_SUFFIXES src/include share/ngspice/include share/ngspice/include/ngspice
|
2016-08-12 13:56:51 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
find_library( NGSPICE_LIBRARY ngspice
|
2016-08-15 12:39:26 +00:00
|
|
|
PATHS ${NGSPICE_ROOT_DIR} $ENV{NGSPICE_ROOT_DIR} ${NGSPICE_LIBRARY_PATH}
|
2016-08-15 13:27:24 +00:00
|
|
|
PATH_SUFFIXES src/.libs lib
|
2016-08-12 13:56:51 +00:00
|
|
|
)
|
|
|
|
|
2018-10-29 13:23:03 +00:00
|
|
|
if( WIN32 AND MSYS )
|
|
|
|
# NGSPICE_LIBRARY points to libngspice.dll.a on Windows,
|
|
|
|
# but the goal is to find out the DLL name.
|
|
|
|
find_library( NGSPICE_DLL NAMES libngspice-0.dll libngspice-1.dll )
|
|
|
|
else()
|
|
|
|
set( NGSPICE_DLL "${NGSPICE_LIBRARY}" )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2016-08-12 13:56:51 +00:00
|
|
|
include( FindPackageHandleStandardArgs )
|
|
|
|
|
2016-08-22 12:28:31 +00:00
|
|
|
if( ${NGSPICE_INCLUDE_DIR} STREQUAL "NGSPICE_INCLUDE_DIR-NOTFOUND" OR ${NGSPICE_LIBRARY} STREQUAL "NGSPICE_LIBRARY-NOTFOUND" )
|
|
|
|
message( "" )
|
|
|
|
message( "*** NGSPICE library missing ***" )
|
|
|
|
message( "Most of ngspice packages do not provide the required libngspice library." )
|
|
|
|
message( "You can either compile ngspice configured with --with-ngshared parameter" )
|
|
|
|
message( "or run a script that does the job for you:" )
|
2019-02-14 22:42:12 +00:00
|
|
|
message( " cd ./scripting/build_tools" )
|
2016-08-22 14:08:45 +00:00
|
|
|
message( " chmod +x get_libngspice_so.sh" )
|
|
|
|
message( " ./get_libngspice_so.sh" )
|
|
|
|
message( " sudo ./get_libngspice_so.sh install" )
|
2016-08-22 12:28:31 +00:00
|
|
|
message( "" )
|
|
|
|
endif()
|
|
|
|
|
2016-08-12 13:56:51 +00:00
|
|
|
find_package_handle_standard_args( ngspice
|
2018-10-29 13:23:03 +00:00
|
|
|
REQUIRED_VARS NGSPICE_INCLUDE_DIR NGSPICE_LIBRARY NGSPICE_DLL )
|
2016-08-12 13:56:51 +00:00
|
|
|
|
|
|
|
mark_as_advanced(
|
|
|
|
NGSPICE_INCLUDE_DIR
|
|
|
|
NGSPICE_LIBRARY
|
2018-10-29 13:23:03 +00:00
|
|
|
NGSPICE_DLL
|
2016-08-12 13:56:51 +00:00
|
|
|
)
|