mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-04 13:29:11 +00:00 
			
		
		
		
	update for nuget/core
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
		
							parent
							
								
									84baddf87c
								
							
						
					
					
						commit
						c372500018
					
				
					 1 changed files with 60 additions and 43 deletions
				
			
		| 
						 | 
				
			
			@ -562,6 +562,11 @@ def set_version(major, minor, build, revision):
 | 
			
		|||
def get_version():
 | 
			
		||||
    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():
 | 
			
		||||
    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()))
 | 
			
		||||
        substitutions = { 'PREFIX': PREFIX,
 | 
			
		||||
                          'GAC_PKG_NAME': self.gac_pkg_name(),
 | 
			
		||||
                          'VERSION': "{}.{}.{}.{}".format(
 | 
			
		||||
                              VER_MAJOR,
 | 
			
		||||
                              VER_MINOR,
 | 
			
		||||
                              VER_BUILD,
 | 
			
		||||
                              VER_REVISION)
 | 
			
		||||
                          'VERSION': get_version_string(4)
 | 
			
		||||
                        }
 | 
			
		||||
        pkg_config_output = os.path.join(BUILD_DIR,
 | 
			
		||||
                                       self.build_dir,
 | 
			
		||||
| 
						 | 
				
			
			@ -1838,29 +1839,13 @@ class DotNetCoreDLLComponent(Component):
 | 
			
		|||
        self.assembly_info_dir = assembly_info_dir
 | 
			
		||||
        self.key_file = default_key_file
 | 
			
		||||
 | 
			
		||||
    def mk_pkg_config_file(self):
 | 
			
		||||
    def mk_nuget_config_file(self):
 | 
			
		||||
        # TBD revise
 | 
			
		||||
        """
 | 
			
		||||
            Create pkgconfig file for the dot net bindings. These
 | 
			
		||||
            Create nuget file for the dot net bindings. These
 | 
			
		||||
            are needed by Monodevelop.
 | 
			
		||||
        """
 | 
			
		||||
        pkg_config_template = os.path.join(self.src_dir, '{}.pc.in'.format(self.gac_pkg_name()))
 | 
			
		||||
        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)
 | 
			
		||||
        return
 | 
			
		||||
    
 | 
			
		||||
    def mk_makefile(self, out):
 | 
			
		||||
        global DOTNET_KEY_FILE        
 | 
			
		||||
| 
						 | 
				
			
			@ -1879,26 +1864,55 @@ class DotNetCoreDLLComponent(Component):
 | 
			
		|||
            out.write(cs_file)
 | 
			
		||||
        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]
 | 
			
		||||
        
 | 
			
		||||
        # TBD: select build configurations also based on architecture
 | 
			
		||||
        # Debug|x86, Debug|x64, Debug|arm
 | 
			
		||||
        # Release|x86, Release|x64, Release|arm
 | 
			
		||||
        dotnetCmdLine.extend(['-c'])
 | 
			
		||||
        if DEBUG_MODE:
 | 
			
		||||
            dotnetCmdLine.extend(['Debug'])
 | 
			
		||||
        else:
 | 
			
		||||
            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)
 | 
			
		||||
        dotnetCmdLine.extend(['-o', path])
 | 
			
		||||
| 
						 | 
				
			
			@ -1911,8 +1925,8 @@ class DotNetCoreDLLComponent(Component):
 | 
			
		|||
        out.write('\n')
 | 
			
		||||
        out.write('%s: %s\n\n' % (self.name, dllfile))
 | 
			
		||||
 | 
			
		||||
        # Create pkg-config file
 | 
			
		||||
        self.mk_pkg_config_file()
 | 
			
		||||
        # Create nuget file
 | 
			
		||||
        self.mk_nuget_config_file()
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
    def main_component(self):
 | 
			
		||||
| 
						 | 
				
			
			@ -1926,8 +1940,8 @@ class DotNetCoreDLLComponent(Component):
 | 
			
		|||
            mk_dir(os.path.join(dist_path, INSTALL_BIN_DIR))
 | 
			
		||||
            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))
 | 
			
		||||
            shutil.copy('%s.xml' % os.path.join(build_path, self.dll_name),
 | 
			
		||||
                        '%s.xml' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
 | 
			
		||||
            shutil.copy('%s.deps.json' % os.path.join(build_path, self.dll_name),
 | 
			
		||||
                        '%s.deps.json' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
 | 
			
		||||
            if DEBUG_MODE:
 | 
			
		||||
                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))
 | 
			
		||||
| 
						 | 
				
			
			@ -1937,8 +1951,8 @@ class DotNetCoreDLLComponent(Component):
 | 
			
		|||
            mk_dir(os.path.join(dist_path, INSTALL_BIN_DIR))
 | 
			
		||||
            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))
 | 
			
		||||
            shutil.copy('%s.xml' % os.path.join(build_path, self.dll_name),
 | 
			
		||||
                        '%s.xml' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
 | 
			
		||||
            shutil.copy('%s.deps.json' % os.path.join(build_path, self.dll_name),
 | 
			
		||||
                        '%s.deps.json' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
 | 
			
		||||
 | 
			
		||||
    def mk_install_deps(self, out):
 | 
			
		||||
        if not is_dotnet_core_enabled():
 | 
			
		||||
| 
						 | 
				
			
			@ -1949,6 +1963,7 @@ class DotNetCoreDLLComponent(Component):
 | 
			
		|||
        return "{}.Sharp".format(self.dll_name)
 | 
			
		||||
 | 
			
		||||
    def _install_or_uninstall_to_gac(self, out, install):
 | 
			
		||||
        # TBD revise for nuget
 | 
			
		||||
        gacUtilFlags = ['/package {}'.format(self.gac_pkg_name()),
 | 
			
		||||
                        '/root',
 | 
			
		||||
                        '{}{}'.format(MakeRuleCmd.install_root(), INSTALL_LIB_DIR)
 | 
			
		||||
| 
						 | 
				
			
			@ -1967,6 +1982,7 @@ class DotNetCoreDLLComponent(Component):
 | 
			
		|||
            flags=' '.join(gacUtilFlags)))
 | 
			
		||||
 | 
			
		||||
    def mk_install(self, out):
 | 
			
		||||
        # TBD revise for nuget
 | 
			
		||||
        if not is_dotnet_core_enabled():
 | 
			
		||||
            return
 | 
			
		||||
        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)
 | 
			
		||||
 | 
			
		||||
    def mk_uninstall(self, out):
 | 
			
		||||
        # TBD revise for nuget
 | 
			
		||||
        if not is_dotnet_core_enabled():
 | 
			
		||||
            return
 | 
			
		||||
        self._install_or_uninstall_to_gac(out, install=False)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue