Merge pull request #15 from adamscott/copy-bin-to-projectdir
This commit is contained in:
		
						commit
						843b2258a0
					
				
							
								
								
									
										12
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| 
						 | 
					@ -3,6 +3,18 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Ignore library files but not the gdextension file
 | 
					# Ignore library files but not the gdextension file
 | 
				
			||||||
demo/bin/*
 | 
					demo/bin/*
 | 
				
			||||||
 | 
					!demo/bin/android
 | 
				
			||||||
 | 
					demo/bin/android/*
 | 
				
			||||||
 | 
					!demo/bin/android/.gitkeep
 | 
				
			||||||
 | 
					!demo/bin/linux
 | 
				
			||||||
 | 
					demo/bin/linux/*
 | 
				
			||||||
 | 
					!demo/bin/linux/.gitkeep
 | 
				
			||||||
 | 
					!demo/bin/macos
 | 
				
			||||||
 | 
					demo/bin/macos/*
 | 
				
			||||||
 | 
					!demo/bin/macos/.gitkeep
 | 
				
			||||||
 | 
					!demo/bin/windows
 | 
				
			||||||
 | 
					demo/bin/windows/*
 | 
				
			||||||
 | 
					!demo/bin/windows/.gitkeep
 | 
				
			||||||
!demo/bin/*.gdextension
 | 
					!demo/bin/*.gdextension
 | 
				
			||||||
.sconsign*.dblite
 | 
					.sconsign*.dblite
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										32
									
								
								SConstruct
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								SConstruct
									
									
									
									
									
								
							| 
						 | 
					@ -12,6 +12,7 @@ def validate_parent_dir(key, val, env):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
libname = "EXTENSION-NAME"
 | 
					libname = "EXTENSION-NAME"
 | 
				
			||||||
 | 
					projectdir = "demo"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
localEnv = Environment(tools=["default"], PLATFORM="")
 | 
					localEnv = Environment(tools=["default"], PLATFORM="")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,19 +53,30 @@ env = SConscript("godot-cpp/SConstruct", {"env": env, "customs": customs})
 | 
				
			||||||
env.Append(CPPPATH=["src/"])
 | 
					env.Append(CPPPATH=["src/"])
 | 
				
			||||||
sources = Glob("src/*.cpp")
 | 
					sources = Glob("src/*.cpp")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					file = "{}{}{}".format(libname, env["suffix"], env["SHLIBSUFFIX"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if env["platform"] == "macos":
 | 
					if env["platform"] == "macos":
 | 
				
			||||||
    platlibname = "{}.{}.{}".format(libname, env["platform"], env["target"])
 | 
					    platlibname = "{}.{}.{}".format(libname, env["platform"], env["target"])
 | 
				
			||||||
    library = env.SharedLibrary(
 | 
					    file = "{}.framework/{}".format(env["platform"], platlibname, platlibname)
 | 
				
			||||||
        "bin/{}.framework/{}".format(platlibname, platlibname),
 | 
					 | 
				
			||||||
        source=sources,
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
else:
 | 
					 | 
				
			||||||
    library = env.SharedLibrary(
 | 
					 | 
				
			||||||
        "bin/{}{}{}".format(libname, env["suffix"], env["SHLIBSUFFIX"]),
 | 
					 | 
				
			||||||
        source=sources,
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
default_args = [library]
 | 
					libraryfile = "bin/{}/{}".format(env["platform"], file)
 | 
				
			||||||
 | 
					library = env.SharedLibrary(
 | 
				
			||||||
 | 
					    libraryfile,
 | 
				
			||||||
 | 
					    source=sources,
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def copy_bin_to_projectdir(target, source, env):
 | 
				
			||||||
 | 
					    import shutil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    targetfrom = "bin/{}/lib{}".format(env["platform"], file)
 | 
				
			||||||
 | 
					    targetdest = "{}/bin/{}/lib{}".format(projectdir, env["platform"], file)
 | 
				
			||||||
 | 
					    shutil.copyfile(targetfrom, targetdest)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					copy = env.Command(libraryfile, None, copy_bin_to_projectdir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					default_args = [library, copy]
 | 
				
			||||||
if localEnv.get("compiledb", False):
 | 
					if localEnv.get("compiledb", False):
 | 
				
			||||||
    default_args += [compilation_db]
 | 
					    default_args += [compilation_db]
 | 
				
			||||||
Default(*default_args)
 | 
					Default(*default_args)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										0
									
								
								bin/android/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								bin/android/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								bin/linux/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								bin/linux/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								bin/macos/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								bin/macos/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								bin/windows/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								bin/windows/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								demo/bin/android/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								demo/bin/android/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								demo/bin/linux/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								demo/bin/linux/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								demo/bin/macos/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								demo/bin/macos/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								demo/bin/windows/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								demo/bin/windows/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
		Loading…
	
		Reference in a new issue