[ngspice] build codemodel extension libraries (#15882)

* [ngspice] build codemodel extension libraries

* tabs -> spaces

* [ngspice] make codemodels a feature

* [ngspice] Improve portfile.cmake

* update version record

Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
This commit is contained in:
Marek Roszko 2021-02-02 17:28:38 -05:00 committed by GitHub
parent bbb50a7d8b
commit 1ce08c0fc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 110 additions and 22 deletions

View File

@ -1,5 +1,10 @@
Source: ngspice
Version: 33
Port-Version: 1
Homepage: http://ngspice.sourceforge.net/
Description: Ngspice is a mixed-level/mixed-signal electronic circuit simulator. It is a successor of the latest stable release of Berkeley SPICE
Supports: !(linux|osx|arm|uwp)
Default-Features: codemodels
Feature: codemodels
Description: Adds optional code models for XSPICE, ADMS (verilog integration) and B-/E-/G- sources.

View File

@ -12,7 +12,8 @@ vcpkg_from_sourceforge(
FILENAME "ngspice-33.tar.gz"
SHA512 895e39f7de185df18bf443a9fa5691cdb3bf0a5091d9860d20ccb02254ef396a4cca5a1c8bf4ba19a03783fc89bb86649218cee977b0fe4565d3c84548943c09
PATCHES
use-winbison-global.patch
use-winbison-sharedspice.patch
use-winbison-vngspice.patch
)
vcpkg_find_acquire_program(BISON)
@ -20,33 +21,60 @@ vcpkg_find_acquire_program(BISON)
get_filename_component(BISON_DIR "${BISON}" DIRECTORY)
vcpkg_add_to_path(PREPEND "${BISON_DIR}")
# Ensure its windows
if (VCPKG_TARGET_IS_WINDOWS)
# Sadly, vcpkg globs .libs inside install_msbuild and whines that the 47 year old SPICE format isn't a MSVC lib ;)
# We need to kill them off first before the source tree is copied to a tmp location by install_msbuild
# Sadly, vcpkg globs .libs inside install_msbuild and whines that the 47 year old SPICE format isn't a MSVC lib ;)
# We need to kill them off first before the source tree is copied to a tmp location by install_msbuild
file(REMOVE_RECURSE ${SOURCE_PATH}/contrib)
file(REMOVE_RECURSE ${SOURCE_PATH}/examples)
file(REMOVE_RECURSE ${SOURCE_PATH}/man)
file(REMOVE_RECURSE ${SOURCE_PATH}/tests)
file(REMOVE_RECURSE ${SOURCE_PATH}/contrib)
file(REMOVE_RECURSE ${SOURCE_PATH}/examples)
file(REMOVE_RECURSE ${SOURCE_PATH}/man)
file(REMOVE_RECURSE ${SOURCE_PATH}/tests)
vcpkg_install_msbuild(
SOURCE_PATH ${SOURCE_PATH}
# this builds the main dll
vcpkg_install_msbuild(
SOURCE_PATH ${SOURCE_PATH}
INCLUDES_SUBPATH /src/include
LICENSE_SUBPATH COPYING
# install_msbuild swaps x86 for win32(bad) if we dont force our own setting
PLATFORM ${TRIPLET_SYSTEM_ARCH}
PROJECT_SUBPATH visualc/sharedspice.sln
TARGET Build
)
if("codemodels" IN_LIST FEATURES)
# vngspice generates "codemodels" to enhance simulation capabilities
# we cannot use install_msbuild as they output with ".cm" extensions on purpose
set(BUILDTREE_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
file(REMOVE_RECURSE ${BUILDTREE_PATH})
file(COPY ${SOURCE_PATH}/ DESTINATION ${BUILDTREE_PATH})
vcpkg_build_msbuild(
PROJECT_PATH ${BUILDTREE_PATH}/visualc/vngspice.sln
INCLUDES_SUBPATH /src/include
LICENSE_SUBPATH COPYING
# install_msbuild swaps x86 for win32(bad) if we dont force our own setting
# build_msbuild swaps x86 for win32(bad) if we dont force our own setting
PLATFORM ${TRIPLET_SYSTEM_ARCH}
PROJECT_SUBPATH visualc/sharedspice.sln
TARGET Build
)
else()
message(FATAL_ERROR "Sorry but ngspice only can be built in Windows")
#put the code models in the intended location
file(GLOB NGSPICE_CODEMODELS_DEBUG
${BUILDTREE_PATH}/visualc/codemodels/${TRIPLET_SYSTEM_ARCH}/Debug/*.cm
)
file(COPY ${NGSPICE_CODEMODELS_DEBUG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/ngspice)
file(GLOB NGSPICE_CODEMODELS_RELEASE
${BUILDTREE_PATH}/visualc/codemodels/${TRIPLET_SYSTEM_ARCH}/Release/*.cm
)
file(COPY ${NGSPICE_CODEMODELS_RELEASE} DESTINATION ${CURRENT_PACKAGES_DIR}/lib/ngspice)
# copy over spinit (spice init)
file(RENAME ${BUILDTREE_PATH}/visualc/spinit_all ${BUILDTREE_PATH}/visualc/spinit)
file(COPY ${BUILDTREE_PATH}/visualc/spinit DESTINATION ${CURRENT_PACKAGES_DIR}/share/ngspice)
endif()
# Unforunately install_msbuild isn't able to dual include directories that effectively layer
file(GLOB NGSPICE_INCLUDES
${SOURCE_PATH}/visualc/src/include/ngspice/*
)
file(COPY ${NGSPICE_INCLUDES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/ngspice)
vcpkg_copy_pdbs()
# Unforunately install_msbuild isn't able to dual include directories that effectively layer
file(GLOB NGSPICE_INCLUDES ${SOURCE_PATH}/visualc/src/include/ngspice/*)
file(COPY ${NGSPICE_INCLUDES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/ngspice)

View File

@ -0,0 +1,50 @@
diff --git a/visualc/vngspice.vcxproj b/visualc/vngspice.vcxproj
index 2d1aa81..cf0f0c7 100644
--- a/visualc/vngspice.vcxproj
+++ b/visualc/vngspice.vcxproj
@@ -2681,12 +2681,12 @@
<ItemGroup>
<CustomBuild Include="..\src\frontend\parse-bison.y">
<Message>invoke win_bison.exe for %(Identity)</Message>
- <Command>..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
+ <Command>win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
<Outputs>.\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="..\src\spicelib\parser\inpptree-parser.y">
<Message>invoke win_bison.exe for %(Identity)</Message>
- <Command>..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
+ <Command>win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
<Outputs>.\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h</Outputs>
</CustomBuild>
</ItemGroup>
diff --git a/visualc/xspice/cmpp/cmpp.vcxproj b/visualc/xspice/cmpp/cmpp.vcxproj
index 78607a3..7bcc1a4 100644
--- a/visualc/xspice/cmpp/cmpp.vcxproj
+++ b/visualc/xspice/cmpp/cmpp.vcxproj
@@ -157,22 +157,22 @@
<ItemGroup>
<CustomBuild Include="..\..\..\src\xspice\cmpp\ifs_lex.l">
<Message>invoke win_flex.exe for %(Identity)</Message>
- <Command>..\..\..\..\flex-bison\win_flex.exe --outfile=.\tmp-bison\%(Filename).c --header-file=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
+ <Command>win_flex.exe --outfile=.\tmp-bison\%(Filename).c --header-file=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
<Outputs>.\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\..\src\xspice\cmpp\ifs_yacc.y">
<Message>invoke win_bison.exe for %(Identity)</Message>
- <Command>..\..\..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
+ <Command>win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
<Outputs>.\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\..\src\xspice\cmpp\mod_lex.l">
<Message>invoke win_flex.exe for %(Identity)</Message>
- <Command>..\..\..\..\flex-bison\win_flex.exe --outfile=.\tmp-bison\%(Filename).c --header-file=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
+ <Command>win_flex.exe --outfile=.\tmp-bison\%(Filename).c --header-file=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
<Outputs>.\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\..\src\xspice\cmpp\mod_yacc.y">
<Message>invoke win_bison.exe for %(Identity)</Message>
- <Command>..\..\..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
+ <Command>win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1</Command>
<Outputs>.\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h</Outputs>
</CustomBuild>
<None Include="..\src\xspice\icm\objects.inc" />

View File

@ -4022,7 +4022,7 @@
},
"ngspice": {
"baseline": "33",
"port-version": 0
"port-version": 1
},
"nifticlib": {
"baseline": "2020-04-30",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "ff27e9605199ca4134c1ab3fa6bcb311096a0e10",
"version-string": "33",
"port-version": 1
},
{
"git-tree": "90c388f47ca769fd11449fde9d70402e9865a986",
"version-string": "33",