2020-08-06 04:56:27 +08:00
|
|
|
vcpkg_fail_port_install(ON_TARGET "Linux" "OSX" "UWP" ON_ARCH "arm" "arm64")
|
|
|
|
|
|
|
|
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
|
|
|
|
2020-10-03 07:47:14 +08:00
|
|
|
# ngspice produces self-contained DLLs
|
|
|
|
set(VCPKG_CRT_LINKAGE static)
|
|
|
|
|
2020-08-06 04:56:27 +08:00
|
|
|
vcpkg_from_sourceforge(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO ngspice/ng-spice-rework
|
2021-02-09 09:53:35 +08:00
|
|
|
REF 34
|
|
|
|
FILENAME "ngspice-34.tar.gz"
|
|
|
|
SHA512 5e90727f3f6b8675b83f71e1961d33cd498081a7f3bea5d081521f12ecb3979775159f083f84a5856233529505262c399f75d305758af51894a1245603476cf8
|
2020-08-06 04:56:27 +08:00
|
|
|
PATCHES
|
2021-02-03 06:28:38 +08:00
|
|
|
use-winbison-sharedspice.patch
|
|
|
|
use-winbison-vngspice.patch
|
2020-08-06 04:56:27 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_find_acquire_program(BISON)
|
|
|
|
|
|
|
|
get_filename_component(BISON_DIR "${BISON}" DIRECTORY)
|
|
|
|
vcpkg_add_to_path(PREPEND "${BISON_DIR}")
|
|
|
|
|
2021-02-03 06:28:38 +08:00
|
|
|
# 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
|
2020-08-06 04:56:27 +08:00
|
|
|
|
2021-02-03 06:28:38 +08:00
|
|
|
file(REMOVE_RECURSE ${SOURCE_PATH}/contrib)
|
|
|
|
file(REMOVE_RECURSE ${SOURCE_PATH}/examples)
|
|
|
|
file(REMOVE_RECURSE ${SOURCE_PATH}/man)
|
|
|
|
file(REMOVE_RECURSE ${SOURCE_PATH}/tests)
|
2020-08-06 04:56:27 +08:00
|
|
|
|
2021-02-03 06:28:38 +08:00
|
|
|
# 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
|
2020-08-06 04:56:27 +08:00
|
|
|
INCLUDES_SUBPATH /src/include
|
|
|
|
LICENSE_SUBPATH COPYING
|
2021-02-03 06:28:38 +08:00
|
|
|
# build_msbuild swaps x86 for win32(bad) if we dont force our own setting
|
2020-10-03 07:47:14 +08:00
|
|
|
PLATFORM ${TRIPLET_SYSTEM_ARCH}
|
2020-08-06 04:56:27 +08:00
|
|
|
TARGET Build
|
|
|
|
)
|
2021-02-11 16:06:01 +08:00
|
|
|
|
|
|
|
# ngspice oddly has solution configs of x64 and x86 but
|
|
|
|
# output folders of x64 and win32
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
|
|
|
|
set(OUT_ARCH x64)
|
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
|
|
|
|
set(OUT_ARCH Win32)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unsupported target architecture")
|
|
|
|
endif()
|
|
|
|
|
2021-02-03 06:28:38 +08:00
|
|
|
#put the code models in the intended location
|
|
|
|
file(GLOB NGSPICE_CODEMODELS_DEBUG
|
2021-02-11 16:06:01 +08:00
|
|
|
${BUILDTREE_PATH}/visualc/codemodels/${OUT_ARCH}/Debug/*.cm
|
2021-02-03 06:28:38 +08:00
|
|
|
)
|
|
|
|
file(COPY ${NGSPICE_CODEMODELS_DEBUG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/ngspice)
|
|
|
|
|
|
|
|
file(GLOB NGSPICE_CODEMODELS_RELEASE
|
2021-02-11 16:06:01 +08:00
|
|
|
${BUILDTREE_PATH}/visualc/codemodels/${OUT_ARCH}/Release/*.cm
|
2021-02-03 06:28:38 +08:00
|
|
|
)
|
|
|
|
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)
|
2020-08-06 04:56:27 +08:00
|
|
|
endif()
|
|
|
|
|
2021-02-03 06:28:38 +08:00
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
2020-08-06 04:56:27 +08:00
|
|
|
# Unforunately install_msbuild isn't able to dual include directories that effectively layer
|
2021-02-03 06:28:38 +08:00
|
|
|
file(GLOB NGSPICE_INCLUDES ${SOURCE_PATH}/visualc/src/include/ngspice/*)
|
2020-08-06 04:56:27 +08:00
|
|
|
file(COPY ${NGSPICE_INCLUDES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/ngspice)
|
2021-02-09 09:53:35 +08:00
|
|
|
|
|
|
|
# This gets copied by install_msbuild but should not be shared
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/cppduals)
|