mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-27 01:39:22 +00:00 
			
		
		
		
	Add high level bindings for js (#6048)
* [Draft] Added unfinished code for high level bindings for js * * Rewrote structure of js api files * Added more high level apis * Minor fixes * Fixed wasm github action * Fix JS test * Removed ContextOptions type * * Added Ints to JS Api * Added tests to JS Api * Added run-time checks for contexts * Removed default contexts * Merged Context and createContext so that the api behaves the sames as in other constructors * Added a test for Solver * Added Reals * Added classes for IntVals and RealVals * Added abillity to specify logic for solver * Try to make CI tests not fail * Changed APIs after a round of review * Fix test * Added BitVectors * Made sort into getter * Added initial JS docs * Added more coercible types * Removed done TODOs
This commit is contained in:
		
							parent
							
								
									3d00d1d56b
								
							
						
					
					
						commit
						7fdcbbaee9
					
				
					 37 changed files with 15973 additions and 643 deletions
				
			
		|  | @ -246,10 +246,13 @@ def rmf(fname): | |||
| 
 | ||||
| def exec_compiler_cmd(cmd): | ||||
|     r = exec_cmd(cmd) | ||||
|     if is_windows() or is_cygwin_mingw() or is_cygwin() or is_msys2(): | ||||
|         rmf('a.exe') | ||||
|     else: | ||||
|         rmf('a.out') | ||||
|     # Windows | ||||
|     rmf('a.exe') | ||||
|     # Unix | ||||
|     rmf('a.out') | ||||
|     # Emscripten | ||||
|     rmf('a.wasm') | ||||
|     rmf('a.worker.js') | ||||
|     return r | ||||
| 
 | ||||
| def test_cxx_compiler(cc): | ||||
|  | @ -293,6 +296,10 @@ def test_fpmath(cc): | |||
|     t.commit() | ||||
|     # -Werror is needed because some versions of clang warn about unrecognized | ||||
|     # -m flags. | ||||
|     # TODO(ritave): Safari doesn't allow SIMD WebAssembly extension, add a flag to build script | ||||
|     if exec_compiler_cmd([cc, CPPFLAGS, '-Werror', 'tstsse.cpp', LDFLAGS, '-msse -msse2 -msimd128']) == 0: | ||||
|         FPMATH_FLAGS='-msse -msse2 -msimd128' | ||||
|         return 'SSE2-EMSCRIPTEN' | ||||
|     if exec_compiler_cmd([cc, CPPFLAGS, '-Werror', 'tstsse.cpp', LDFLAGS, '-mfpmath=sse -msse -msse2']) == 0: | ||||
|         FPMATH_FLAGS="-mfpmath=sse -msse -msse2" | ||||
|         return "SSE2-GCC" | ||||
|  | @ -499,7 +506,7 @@ def find_ml_lib(): | |||
| 
 | ||||
| def is64(): | ||||
|     global LINUX_X64 | ||||
|     if is_sunos() and sys.version_info.major < 3:  | ||||
|     if is_sunos() and sys.version_info.major < 3: | ||||
|         return LINUX_X64 | ||||
|     else: | ||||
|         return LINUX_X64 and sys.maxsize >= 2**32 | ||||
|  | @ -625,11 +632,11 @@ elif os.name == 'posix': | |||
|         else: | ||||
|             LINUX_X64=False | ||||
| 
 | ||||
|              | ||||
| 
 | ||||
| if os.name == 'posix' and os.uname()[4] == 'arm64': | ||||
|     IS_ARCH_ARM64 = True | ||||
| 
 | ||||
|              | ||||
| 
 | ||||
| def display_help(exit_code): | ||||
|     print("mk_make.py: Z3 Makefile generator\n") | ||||
|     print("This script generates the Makefile for the Z3 theorem prover.") | ||||
|  | @ -792,7 +799,7 @@ def extract_c_includes(fname): | |||
|     linenum = 1 | ||||
|     for line in f: | ||||
|         m1 = std_inc_pat.match(line) | ||||
|         if m1:  | ||||
|         if m1: | ||||
|             root_file_name = m1.group(1) | ||||
|             slash_pos =  root_file_name.rfind('/') | ||||
|             if slash_pos >= 0  and root_file_name.find("..") < 0 : #it is a hack for lp include files that behave as continued from "src" | ||||
|  | @ -1650,7 +1657,7 @@ def set_key_file(self): | |||
|        else: | ||||
|            print("Keyfile '%s' could not be found; %s.dll will be unsigned." % (self.key_file, self.dll_name)) | ||||
|            self.key_file = None | ||||
|      | ||||
| 
 | ||||
| 
 | ||||
| # build for dotnet core | ||||
| class DotNetDLLComponent(Component): | ||||
|  | @ -1664,7 +1671,7 @@ class DotNetDLLComponent(Component): | |||
|         self.assembly_info_dir = assembly_info_dir | ||||
|         self.key_file = default_key_file | ||||
| 
 | ||||
|      | ||||
| 
 | ||||
|     def mk_makefile(self, out): | ||||
|         if not is_dotnet_core_enabled(): | ||||
|             return | ||||
|  | @ -1680,7 +1687,7 @@ class DotNetDLLComponent(Component): | |||
|             out.write(' ') | ||||
|             out.write(cs_file) | ||||
|         out.write('\n') | ||||
|          | ||||
| 
 | ||||
|         set_key_file(self) | ||||
|         key = "" | ||||
|         if not self.key_file is None: | ||||
|  | @ -1724,7 +1731,7 @@ class DotNetDLLComponent(Component): | |||
|             ous.write(core_csproj_str) | ||||
| 
 | ||||
|         dotnetCmdLine = [DOTNET, "build", csproj] | ||||
|          | ||||
| 
 | ||||
|         dotnetCmdLine.extend(['-c']) | ||||
|         if DEBUG_MODE: | ||||
|             dotnetCmdLine.extend(['Debug']) | ||||
|  | @ -1733,19 +1740,19 @@ class DotNetDLLComponent(Component): | |||
| 
 | ||||
|         path = os.path.join(os.path.abspath(BUILD_DIR), ".") | ||||
|         dotnetCmdLine.extend(['-o', "\"%s\"" % path]) | ||||
|              | ||||
| 
 | ||||
|         MakeRuleCmd.write_cmd(out, ' '.join(dotnetCmdLine)) | ||||
|         out.write('\n')         | ||||
|         out.write('\n') | ||||
|         out.write('%s: %s\n\n' % (self.name, dllfile)) | ||||
| 
 | ||||
|     def main_component(self): | ||||
|         return is_dotnet_core_enabled() | ||||
|      | ||||
| 
 | ||||
|     def has_assembly_info(self): | ||||
|         # TBD: is this required for dotnet core given that version numbers are in z3.csproj file? | ||||
|         return False | ||||
| 
 | ||||
|      | ||||
| 
 | ||||
|     def mk_win_dist(self, build_path, dist_path): | ||||
|         if is_dotnet_core_enabled(): | ||||
|             mk_dir(os.path.join(dist_path, INSTALL_BIN_DIR)) | ||||
|  | @ -2038,7 +2045,7 @@ class MLComponent(Component): | |||
|             out.write('ml: %s.cma %s.cmxa %s.cmxs\n' % (z3mls, z3mls, z3mls)) | ||||
|             if IS_OSX: | ||||
|                 out.write('\tinstall_name_tool -id %s/libz3.dylib libz3.dylib\n' % (stubs_install_path)) | ||||
|                 out.write('\tinstall_name_tool -change libz3.dylib %s/libz3.dylib api/ml/dllz3ml.so\n' % (stubs_install_path))                 | ||||
|                 out.write('\tinstall_name_tool -change libz3.dylib %s/libz3.dylib api/ml/dllz3ml.so\n' % (stubs_install_path)) | ||||
|             out.write('\n') | ||||
| 
 | ||||
|             if IS_WINDOWS: | ||||
|  | @ -3117,7 +3124,7 @@ def get_platform_toolset_str(): | |||
|     if len(tokens) < 2: | ||||
|         return default | ||||
|     else: | ||||
|         if tokens[0] == "15":  | ||||
|         if tokens[0] == "15": | ||||
|             # Visual Studio 2017 reports 15.* but the PlatformToolsetVersion is 141 | ||||
|             return "v141" | ||||
|         else: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue