mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
update for nuget/core
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
84baddf87c
commit
c372500018
|
@ -562,6 +562,11 @@ def set_version(major, minor, build, revision):
|
||||||
def get_version():
|
def get_version():
|
||||||
return (VER_MAJOR, VER_MINOR, VER_BUILD, VER_REVISION)
|
return (VER_MAJOR, VER_MINOR, VER_BUILD, VER_REVISION)
|
||||||
|
|
||||||
|
def get_version_string(n):
|
||||||
|
if n == 3:
|
||||||
|
return "{}.{}.{}".format(VER_MAJOR,VER_MINOR,VER_BUILD)
|
||||||
|
return "{}.{}.{}.{}".format(VER_MAJOR,VER_MINOR,VER_BUILD,VER_REVISION)
|
||||||
|
|
||||||
def build_static_lib():
|
def build_static_lib():
|
||||||
return STATIC_LIB
|
return STATIC_LIB
|
||||||
|
|
||||||
|
@ -1639,11 +1644,7 @@ class DotNetDLLComponent(Component):
|
||||||
pkg_config_template = os.path.join(self.src_dir, '{}.pc.in'.format(self.gac_pkg_name()))
|
pkg_config_template = os.path.join(self.src_dir, '{}.pc.in'.format(self.gac_pkg_name()))
|
||||||
substitutions = { 'PREFIX': PREFIX,
|
substitutions = { 'PREFIX': PREFIX,
|
||||||
'GAC_PKG_NAME': self.gac_pkg_name(),
|
'GAC_PKG_NAME': self.gac_pkg_name(),
|
||||||
'VERSION': "{}.{}.{}.{}".format(
|
'VERSION': get_version_string(4)
|
||||||
VER_MAJOR,
|
|
||||||
VER_MINOR,
|
|
||||||
VER_BUILD,
|
|
||||||
VER_REVISION)
|
|
||||||
}
|
}
|
||||||
pkg_config_output = os.path.join(BUILD_DIR,
|
pkg_config_output = os.path.join(BUILD_DIR,
|
||||||
self.build_dir,
|
self.build_dir,
|
||||||
|
@ -1838,30 +1839,14 @@ class DotNetCoreDLLComponent(Component):
|
||||||
self.assembly_info_dir = assembly_info_dir
|
self.assembly_info_dir = assembly_info_dir
|
||||||
self.key_file = default_key_file
|
self.key_file = default_key_file
|
||||||
|
|
||||||
def mk_pkg_config_file(self):
|
def mk_nuget_config_file(self):
|
||||||
# TBD revise
|
# TBD revise
|
||||||
"""
|
"""
|
||||||
Create pkgconfig file for the dot net bindings. These
|
Create nuget file for the dot net bindings. These
|
||||||
are needed by Monodevelop.
|
are needed by Monodevelop.
|
||||||
"""
|
"""
|
||||||
pkg_config_template = os.path.join(self.src_dir, '{}.pc.in'.format(self.gac_pkg_name()))
|
return
|
||||||
substitutions = { 'PREFIX': PREFIX,
|
|
||||||
'GAC_PKG_NAME': self.gac_pkg_name(),
|
|
||||||
'VERSION': "{}.{}.{}.{}".format(
|
|
||||||
VER_MAJOR,
|
|
||||||
VER_MINOR,
|
|
||||||
VER_BUILD,
|
|
||||||
VER_REVISION)
|
|
||||||
}
|
|
||||||
pkg_config_output = os.path.join(BUILD_DIR,
|
|
||||||
self.build_dir,
|
|
||||||
'{}.pc'.format(self.gac_pkg_name()))
|
|
||||||
|
|
||||||
# FIXME: Why isn't the build directory available?
|
|
||||||
mk_dir(os.path.dirname(pkg_config_output))
|
|
||||||
# Configure file that will be installed by ``make install``.
|
|
||||||
configure_file(pkg_config_template, pkg_config_output, substitutions)
|
|
||||||
|
|
||||||
def mk_makefile(self, out):
|
def mk_makefile(self, out):
|
||||||
global DOTNET_KEY_FILE
|
global DOTNET_KEY_FILE
|
||||||
if not is_dotnet_core_enabled():
|
if not is_dotnet_core_enabled():
|
||||||
|
@ -1879,26 +1864,55 @@ class DotNetCoreDLLComponent(Component):
|
||||||
out.write(cs_file)
|
out.write(cs_file)
|
||||||
out.write('\n')
|
out.write('\n')
|
||||||
|
|
||||||
csproj = os.path.join(self.to_src_dir, "core", "core.csproj")
|
if VS_X64:
|
||||||
|
platform = 'x64'
|
||||||
|
elif VS_ARM:
|
||||||
|
platform = 'ARM'
|
||||||
|
else:
|
||||||
|
platform = 'x86'
|
||||||
|
|
||||||
|
version = get_version_string(3)
|
||||||
|
|
||||||
|
core_csproj_str = """<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||||
|
<PlatformTarget>%s</PlatformTarget>
|
||||||
|
<DefineConstants>$(DefineConstants);DOTNET_CORE</DefineConstants>
|
||||||
|
<DebugType>portable</DebugType>
|
||||||
|
<AssemblyName>Microsoft.Z3</AssemblyName>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<PackageId>Microsoft.Z3</PackageId>
|
||||||
|
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
|
||||||
|
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
|
||||||
|
<Version>%s</Version>
|
||||||
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
|
<Authors>Microsoft</Authors>
|
||||||
|
<Company>Microsoft</Company>
|
||||||
|
<Description>Z3 is a satisfiability modulo theories solver from Microsoft Research.</Description>
|
||||||
|
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
|
||||||
|
<PackageTags>smt constraint solver theorem prover</PackageTags>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\%s\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>""" % (platform, version, self.to_src_dir)
|
||||||
|
|
||||||
|
mk_dir(os.path.join(BUILD_DIR, 'dotnet'))
|
||||||
|
csproj = os.path.join('dotnet', 'z3.csproj')
|
||||||
|
with open(os.path.join(BUILD_DIR, csproj), 'w') as ous:
|
||||||
|
ous.write(core_csproj_str)
|
||||||
|
|
||||||
dotnetCmdLine = [DOTNET, "build", csproj]
|
dotnetCmdLine = [DOTNET, "build", csproj]
|
||||||
|
|
||||||
# TBD: select build configurations also based on architecture
|
|
||||||
# Debug|x86, Debug|x64, Debug|arm
|
|
||||||
# Release|x86, Release|x64, Release|arm
|
|
||||||
dotnetCmdLine.extend(['-c'])
|
dotnetCmdLine.extend(['-c'])
|
||||||
if DEBUG_MODE:
|
if DEBUG_MODE:
|
||||||
dotnetCmdLine.extend(['Debug'])
|
dotnetCmdLine.extend(['Debug'])
|
||||||
else:
|
else:
|
||||||
dotnetCmdLine.extend(['Release'])
|
dotnetCmdLine.extend(['Release'])
|
||||||
|
|
||||||
if IS_WINDOWS:
|
|
||||||
runtime = "win-" + ("x64" if VS_X64 else "x86")
|
|
||||||
elif IS_LINUX:
|
|
||||||
runtime = "linux-x64" if LINUX_X64 else ""
|
|
||||||
elif IS_OSX:
|
|
||||||
runtime = "osx-x64" if LINUX_X64 else ""
|
|
||||||
if runtime != "":
|
|
||||||
dotnetCmdLine.extend(['-r', runtime])
|
|
||||||
|
|
||||||
path = os.path.abspath(BUILD_DIR)
|
path = os.path.abspath(BUILD_DIR)
|
||||||
dotnetCmdLine.extend(['-o', path])
|
dotnetCmdLine.extend(['-o', path])
|
||||||
|
@ -1911,8 +1925,8 @@ class DotNetCoreDLLComponent(Component):
|
||||||
out.write('\n')
|
out.write('\n')
|
||||||
out.write('%s: %s\n\n' % (self.name, dllfile))
|
out.write('%s: %s\n\n' % (self.name, dllfile))
|
||||||
|
|
||||||
# Create pkg-config file
|
# Create nuget file
|
||||||
self.mk_pkg_config_file()
|
self.mk_nuget_config_file()
|
||||||
return
|
return
|
||||||
|
|
||||||
def main_component(self):
|
def main_component(self):
|
||||||
|
@ -1926,8 +1940,8 @@ class DotNetCoreDLLComponent(Component):
|
||||||
mk_dir(os.path.join(dist_path, INSTALL_BIN_DIR))
|
mk_dir(os.path.join(dist_path, INSTALL_BIN_DIR))
|
||||||
shutil.copy('%s.dll' % os.path.join(build_path, self.dll_name),
|
shutil.copy('%s.dll' % os.path.join(build_path, self.dll_name),
|
||||||
'%s.dll' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
'%s.dll' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
||||||
shutil.copy('%s.xml' % os.path.join(build_path, self.dll_name),
|
shutil.copy('%s.deps.json' % os.path.join(build_path, self.dll_name),
|
||||||
'%s.xml' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
'%s.deps.json' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
||||||
if DEBUG_MODE:
|
if DEBUG_MODE:
|
||||||
shutil.copy('%s.pdb' % os.path.join(build_path, self.dll_name),
|
shutil.copy('%s.pdb' % os.path.join(build_path, self.dll_name),
|
||||||
'%s.pdb' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
'%s.pdb' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
||||||
|
@ -1937,8 +1951,8 @@ class DotNetCoreDLLComponent(Component):
|
||||||
mk_dir(os.path.join(dist_path, INSTALL_BIN_DIR))
|
mk_dir(os.path.join(dist_path, INSTALL_BIN_DIR))
|
||||||
shutil.copy('%s.dll' % os.path.join(build_path, self.dll_name),
|
shutil.copy('%s.dll' % os.path.join(build_path, self.dll_name),
|
||||||
'%s.dll' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
'%s.dll' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
||||||
shutil.copy('%s.xml' % os.path.join(build_path, self.dll_name),
|
shutil.copy('%s.deps.json' % os.path.join(build_path, self.dll_name),
|
||||||
'%s.xml' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
'%s.deps.json' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
||||||
|
|
||||||
def mk_install_deps(self, out):
|
def mk_install_deps(self, out):
|
||||||
if not is_dotnet_core_enabled():
|
if not is_dotnet_core_enabled():
|
||||||
|
@ -1949,6 +1963,7 @@ class DotNetCoreDLLComponent(Component):
|
||||||
return "{}.Sharp".format(self.dll_name)
|
return "{}.Sharp".format(self.dll_name)
|
||||||
|
|
||||||
def _install_or_uninstall_to_gac(self, out, install):
|
def _install_or_uninstall_to_gac(self, out, install):
|
||||||
|
# TBD revise for nuget
|
||||||
gacUtilFlags = ['/package {}'.format(self.gac_pkg_name()),
|
gacUtilFlags = ['/package {}'.format(self.gac_pkg_name()),
|
||||||
'/root',
|
'/root',
|
||||||
'{}{}'.format(MakeRuleCmd.install_root(), INSTALL_LIB_DIR)
|
'{}{}'.format(MakeRuleCmd.install_root(), INSTALL_LIB_DIR)
|
||||||
|
@ -1967,6 +1982,7 @@ class DotNetCoreDLLComponent(Component):
|
||||||
flags=' '.join(gacUtilFlags)))
|
flags=' '.join(gacUtilFlags)))
|
||||||
|
|
||||||
def mk_install(self, out):
|
def mk_install(self, out):
|
||||||
|
# TBD revise for nuget
|
||||||
if not is_dotnet_core_enabled():
|
if not is_dotnet_core_enabled():
|
||||||
return
|
return
|
||||||
self._install_or_uninstall_to_gac(out, install=True)
|
self._install_or_uninstall_to_gac(out, install=True)
|
||||||
|
@ -1978,6 +1994,7 @@ class DotNetCoreDLLComponent(Component):
|
||||||
MakeRuleCmd.install_files(out, pkg_config_output, INSTALL_PKGCONFIG_DIR)
|
MakeRuleCmd.install_files(out, pkg_config_output, INSTALL_PKGCONFIG_DIR)
|
||||||
|
|
||||||
def mk_uninstall(self, out):
|
def mk_uninstall(self, out):
|
||||||
|
# TBD revise for nuget
|
||||||
if not is_dotnet_core_enabled():
|
if not is_dotnet_core_enabled():
|
||||||
return
|
return
|
||||||
self._install_or_uninstall_to_gac(out, install=False)
|
self._install_or_uninstall_to_gac(out, install=False)
|
||||||
|
|
Loading…
Reference in a new issue