mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	ML API: build fixes
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
		
							parent
							
								
									93d7412950
								
							
						
					
					
						commit
						40c6be0baa
					
				
					 1 changed files with 60 additions and 38 deletions
				
			
		| 
						 | 
					@ -1389,53 +1389,75 @@ class MLComponent(Component):
 | 
				
			||||||
                prev = prev + ' ' + os.path.join(sub_dir, m) + '.mli'
 | 
					                prev = prev + ' ' + os.path.join(sub_dir, m) + '.mli'
 | 
				
			||||||
            cmis = ''
 | 
					            cmis = ''
 | 
				
			||||||
            for m in modules:
 | 
					            for m in modules:
 | 
				
			||||||
                out.write('%s.cmi: %s.mli\n' % (os.path.join(sub_dir,m),os.path.join(sub_dir,m)))
 | 
					                out.write('%s.cmi: %s.mli%s\n' % (os.path.join(sub_dir,m),os.path.join(sub_dir,m), cmis))
 | 
				
			||||||
                out.write('\t%s -I %s -c %s.mli\n' % (OCAMLC,sub_dir,os.path.join(sub_dir,m)))
 | 
					                out.write('\t%s -I %s -c %s.mli\n' % (OCAMLC,sub_dir,os.path.join(sub_dir,m)))
 | 
				
			||||||
                cmis = cmis + ' ' + os.path.join(sub_dir,m) + '.cmi'
 | 
					                cmis = cmis + ' ' + os.path.join(sub_dir,m) + '.cmi'
 | 
				
			||||||
            out.write('api/ml/z3native_stubs$(OBJ_EXT): %s/z3native_stubs.c\n' % (sub_dir));
 | 
					 | 
				
			||||||
            out.write('\t$(CC) $(CXXFLAGS) -I %s -I %s %s/z3native_stubs.c $(CXX_OUT_FLAG)api/ml/z3native_stubs$(OBJ_EXT)\n' % (OCAML_LIB, api_src, sub_dir))
 | 
					 | 
				
			||||||
            out.write('api/ml/libz3ml$(LIB_EXT): api/ml/z3native_stubs$(OBJ_EXT) %s$(SO_EXT)\n' % get_component(Z3_DLL_COMPONENT).dll_name)
 | 
					 | 
				
			||||||
            out.write('\t$(AR) $(AR_FLAGS) $(AR_OUTFLAG)api/ml/libz3ml$(LIB_EXT) api/ml/z3native_stubs$(OBJ_EXT)\n')
 | 
					 | 
				
			||||||
            out.write('api/ml/libz3mldyn$(SO_EXT): api/ml/z3native_stubs.c %s$(SO_EXT)\n' % get_component(Z3_DLL_COMPONENT).dll_name)
 | 
					 | 
				
			||||||
            out.write('\t$(CC) $(CXXFLAGS) -I %s -I %s %s/z3native_stubs.c $(CXX_OUT_FLAG)api/ml/z3native_stubs$(OBJ_EXT)\n' % (OCAML_LIB, api_src, sub_dir))
 | 
					 | 
				
			||||||
            out.write('\t$(SLINK) $(SLINK_OUT_FLAG)api/ml/libz3ml$(SO_EXT) $(SLINK_FLAGS) -I %s -I %s api/ml/z3native_stubs$(OBJ_EXT) %s$(LIB_EXT)\n' % (OCAML_LIB, api_src, get_component(Z3_DLL_COMPONENT).dll_name))
 | 
					 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            out.write('%s: api/ml/libz3ml$(LIB_EXT) %s$(SO_EXT) %s' % (os.path.join(sub_dir, 'z3.cmxa'), get_component(Z3_DLL_COMPONENT).dll_name, cmis))
 | 
					            out.write('%s: %s %s\n' % 
 | 
				
			||||||
            for mlfile in get_ml_files(self.src_dir):
 | 
					                      (os.path.join(sub_dir, 'z3native_stubs$(OBJ_EXT)'), 
 | 
				
			||||||
                out.write(' %s' % os.path.join(sub_dir, mlfile))
 | 
					                       os.path.join(sub_dir, 'z3native_stubs.c'), 
 | 
				
			||||||
            out.write('\n')
 | 
					                       get_component(Z3_DLL_COMPONENT).dll_name+'$(SO_EXT)'));
 | 
				
			||||||
            out.write('\t%s ' % (OCAMLOPT))
 | 
					            out.write('\t$(CC) $(CXXFLAGS) -I %s -I %s %s $(CXX_OUT_FLAG)%s$(OBJ_EXT)\n' % 
 | 
				
			||||||
            if DEBUG_MODE:
 | 
					                      (OCAML_LIB, api_src, os.path.join(sub_dir, 'z3native_stubs.c'), os.path.join(sub_dir, 'z3native_stubs')))
 | 
				
			||||||
                out.write('-g ')
 | 
					
 | 
				
			||||||
            out.write('-cclib "-L %s -lz3ml" -I %s %s/z3enums.ml %s/z3native.ml %s/z3.ml -a -o api/ml/z3.cmxa -linkall\n' % (sub_dir, sub_dir,sub_dir,sub_dir,sub_dir))
 | 
					            # out.write('api/ml/libz3ml$(LIB_EXT): api/ml/z3native_stubs$(OBJ_EXT) %s$(SO_EXT)\n' % get_component(Z3_DLL_COMPONENT).dll_name)
 | 
				
			||||||
            out.write('%s: %s\n' % (os.path.join(sub_dir, 'z3.cmxs'), os.path.join(sub_dir, 'z3.cmxa')))
 | 
					            # out.write('\t$(AR) $(AR_FLAGS) $(AR_OUTFLAG)api/ml/libz3ml$(LIB_EXT) api/ml/z3native_stubs$(OBJ_EXT)\n')
 | 
				
			||||||
            out.write('\t%s ' % (OCAMLOPT))
 | 
					
 | 
				
			||||||
            if DEBUG_MODE:
 | 
					            # out.write('api/ml/libz3ml$(SO_EXT): api/ml/z3native_stubs$(OBJ_EXT) %s$(SO_EXT)\n' % get_component(Z3_DLL_COMPONENT).dll_name)
 | 
				
			||||||
                out.write('-g ')
 | 
					            # out.write('\t$(SLINK) $(SLINK_OUT_FLAG)api/ml/libz3ml$(SO_EXT) $(SLINK_FLAGS) -I %s -I %s api/ml/z3native_stubs$(OBJ_EXT) %s$(LIB_EXT)\n' % (OCAML_LIB, api_src, get_component(Z3_DLL_COMPONENT).dll_name))
 | 
				
			||||||
            out.write('-cclib "-L %s -lz3ml" -shared -o %s %s -linkall\n' % (sub_dir, os.path.join(sub_dir, 'z3.cmxs'), os.path.join(sub_dir, 'z3.cmxa')))
 | 
					
 | 
				
			||||||
            out.write('%s: api/ml/libz3ml$(LIB_EXT) %s$(SO_EXT) %s' % (os.path.join(sub_dir, 'z3.cma'), get_component(Z3_DLL_COMPONENT).dll_name, cmis))
 | 
					
 | 
				
			||||||
            for mlfile in get_ml_files(self.src_dir):
 | 
					            # out.write('%s: api/ml/libz3ml$(LIB_EXT) %s$(SO_EXT) %s' % (os.path.join(sub_dir, 'z3.cmxa'), get_component(Z3_DLL_COMPONENT).dll_name, cmis))
 | 
				
			||||||
                out.write(' %s' % os.path.join(sub_dir, mlfile))
 | 
					
 | 
				
			||||||
            out.write('\n')
 | 
					            # for mlfile in get_ml_files(self.src_dir):
 | 
				
			||||||
            out.write('\t%s ' % (OCAMLC))
 | 
					            #     out.write(' %s' % os.path.join(sub_dir, mlfile))
 | 
				
			||||||
            if DEBUG_MODE:
 | 
					            # out.write('\n')
 | 
				
			||||||
                out.write('-g ')
 | 
					            # out.write('\t%s ' % (OCAMLOPT))
 | 
				
			||||||
            out.write('-cclib "-L %s -lz3ml" -I %s %s/z3enums.ml %s/z3native.ml %s/z3.ml -a -o api/ml/z3.cma -linkall\n' % (sub_dir, sub_dir,sub_dir,sub_dir,sub_dir))
 | 
					            # if DEBUG_MODE:
 | 
				
			||||||
            out.write('ml: %s %s %s\n' % (os.path.join(sub_dir, 'z3.cmxa'), os.path.join(sub_dir, 'z3.cmxs'), os.path.join(sub_dir, 'z3.cma')))
 | 
					            #     out.write('-g ')
 | 
				
			||||||
            out.write('\n')
 | 
					            # out.write('-cclib "-L %s -lz3ml" -I %s %s/z3enums.ml %s/z3native.ml %s/z3.ml -a -o api/ml/z3.cmxa -linkall\n' % (sub_dir, sub_dir,sub_dir,sub_dir,sub_dir))
 | 
				
			||||||
            # Generate META file and package installation commands
 | 
					
 | 
				
			||||||
            self.mk_ml_meta(os.path.join('src/api/ml/META'), os.path.join(BUILD_DIR, sub_dir, 'META'), VER_MAJOR, VER_MINOR, VER_BUILD, VER_REVISION)
 | 
					            # out.write('%s: %s\n' % (os.path.join(sub_dir, 'z3.cmxs'), os.path.join(sub_dir, 'z3.cmxa')))
 | 
				
			||||||
            if OCAMLFIND != '':
 | 
					            # out.write('\t%s ' % (OCAMLOPT))
 | 
				
			||||||
                out.write('ocamlfind_install: api/ml/z3.cma api/ml/z3.cmxa api/ml/z3.cmxs api/ml/META\n')
 | 
					            # if DEBUG_MODE:
 | 
				
			||||||
                out.write('\t%s remove Z3\n' % (OCAMLFIND))
 | 
					            #     out.write('-g ')
 | 
				
			||||||
                out.write('\t%s install Z3 api/ml/META api/ml/z3.cma api/ml/z3.cmxa api/ml/z3.cmxs api/ml/z3$(LIB_EXT) api/ml/libz3ml$(LIB_EXT) libz3$(SO_EXT)' % (OCAMLFIND))
 | 
					            # out.write('-cclib "-L %s -lz3ml" -shared -o %s %s -linkall\n' % (sub_dir, os.path.join(sub_dir, 'z3.cmxs'), os.path.join(sub_dir, 'z3.cmxa')))
 | 
				
			||||||
 | 
					            # out.write('%s: api/ml/libz3ml$(LIB_EXT) %s$(SO_EXT) %s' % (os.path.join(sub_dir, 'z3.cma'), get_component(Z3_DLL_COMPONENT).dll_name, cmis))
 | 
				
			||||||
 | 
					            # for mlfile in get_ml_files(self.src_dir):
 | 
				
			||||||
 | 
					            #     out.write(' %s' % os.path.join(sub_dir, mlfile))
 | 
				
			||||||
 | 
					            # out.write('\n')
 | 
				
			||||||
 | 
					            # out.write('\t%s ' % (OCAMLC))
 | 
				
			||||||
 | 
					            # if DEBUG_MODE:
 | 
				
			||||||
 | 
					            #     out.write('-g ')
 | 
				
			||||||
 | 
					            # out.write('-cclib "-L %s -lz3ml" -I %s %s/z3enums.ml %s/z3native.ml %s/z3.ml -a -o api/ml/z3.cma -linkall\n' % (sub_dir, sub_dir,sub_dir,sub_dir,sub_dir))            
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            out.write('%s:' % (os.path.join(sub_dir, "z3.cmxa")))
 | 
				
			||||||
            for m in modules:
 | 
					            for m in modules:
 | 
				
			||||||
                out.write(' %s.cmi' % (os.path.join(sub_dir, m)))
 | 
					                out.write(' %s.cmi' % (os.path.join(sub_dir, m)))
 | 
				
			||||||
                out.write(' %s.cmx' % (os.path.join(sub_dir, m)))
 | 
					                out.write(' %s.cmx' % (os.path.join(sub_dir, m)))
 | 
				
			||||||
                if IS_WINDOWS:
 | 
					                out.write(' %s.cmo' % (os.path.join(sub_dir, m)))
 | 
				
			||||||
                    out.write(' libz3$(LIB_EXT)')
 | 
					            out.write('%s/z3native_stubs.o\n' % (sub_dir))
 | 
				
			||||||
                out.write('\n')
 | 
					            out.write('\tcd %s ; ocamlmklib -verbose -o z3' % (sub_dir))
 | 
				
			||||||
                out.write('\n')
 | 
					            for m in modules:
 | 
				
			||||||
 | 
					                out.write(' ' + m)
 | 
				
			||||||
 | 
					            out.write('z3native_stubs$(OBJ_EXT) ; cd -' )
 | 
				
			||||||
 | 
					            out.write('ml: %s\n' % (os.path.join(sub_dir, 'z3.cmxa'))) # , os.path.join(sub_dir, 'z3.cmxs'), os.path.join(sub_dir, 'z3.cma')))
 | 
				
			||||||
 | 
					            #out.write('\n')
 | 
				
			||||||
 | 
					            # Generate META file and package installation commands
 | 
				
			||||||
 | 
					            self.mk_ml_meta(os.path.join('src/api/ml/META'), os.path.join(BUILD_DIR, sub_dir, 'META'), VER_MAJOR, VER_MINOR, VER_BUILD, VER_REVISION)
 | 
				
			||||||
 | 
					            if OCAMLFIND != '':
 | 
				
			||||||
 | 
					                out.write('\nocamlfind_install: api/ml/z3.cmxa api/ml/META\n')
 | 
				
			||||||
 | 
					                out.write('\t%s remove Z3\n' % (OCAMLFIND))
 | 
				
			||||||
 | 
					                out.write('\t%s install Z3 %s' % (OCAMLFIND, (os.path.join(sub_dir, 'META'))))
 | 
				
			||||||
 | 
					                for m in modules:
 | 
				
			||||||
 | 
					                    out.write(' %s.cma' % (os.path.join(sub_dir, m)))
 | 
				
			||||||
 | 
					                    out.write(' %s.cmxa' % (os.path.join(sub_dir, m)))
 | 
				
			||||||
 | 
					                    out.write(' %s.cmxx' % (os.path.join(sub_dir, m)))
 | 
				
			||||||
 | 
					                    out.write(' %s.cmi' % (os.path.join(sub_dir, m)))
 | 
				
			||||||
 | 
					                    out.write(' %s.cmx' % (os.path.join(sub_dir, m)))
 | 
				
			||||||
 | 
					                out.write(' %s' % ((os.path.join(sub_dir, 'libz3$(LIB_EXT)'))))
 | 
				
			||||||
 | 
					                out.write(' %s' % ((os.path.join(sub_dir, 'dllz3$(SO_EXT)'))))
 | 
				
			||||||
 | 
					                out.write('\n\n')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    def main_component(self):
 | 
					    def main_component(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue