mirror of https://github.com/mono/CppSharp.git
				
				
			
		c-sharpdotnetmonobindingsbridgecclangcpluspluscppsharpglueinteropparserparsingpinvokeswigsyntax-treevisitorsxamarinxamarin-bindings
		
		
		
		
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							76 lines
						
					
					
						
							1.7 KiB
						
					
					
				
			
		
		
	
	
							76 lines
						
					
					
						
							1.7 KiB
						
					
					
				require "Utils" | 
						|
 | 
						|
function get_msbuild_path() | 
						|
	local msbuild = '%SystemRoot%\\system32\\reg.exe query "HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0" /v MSBuildToolsPath' | 
						|
	local val = execute(msbuild) | 
						|
 | 
						|
	for i in string.gmatch(val, "%S+") do | 
						|
		if os.isdir(i) then | 
						|
			return i | 
						|
		end | 
						|
	end | 
						|
 | 
						|
	error("MSBuild path could not be found in Windows registry.") | 
						|
end | 
						|
 | 
						|
function msbuild(sln, conf, platform) | 
						|
	local msbuild_path = "msbuild.exe" | 
						|
	local sln = path.normalize(sln) | 
						|
 | 
						|
	local cmd = msbuild_path .. " " .. sln .. " /m" | 
						|
	if conf ~= nil then | 
						|
		cmd = cmd .. " /p:Configuration=" .. conf | 
						|
	end | 
						|
 | 
						|
	if platform ~= nil then | 
						|
		cmd = cmd .. " /p:Platform=" .. platform | 
						|
	end | 
						|
 | 
						|
	execute_or_die(cmd) | 
						|
end | 
						|
 | 
						|
function ninja(dir, action) | 
						|
	local cmd = "ninja -C " .. dir | 
						|
	if action then | 
						|
		cmd = cmd .. " " .. action | 
						|
	end | 
						|
	return execute_or_die(cmd) | 
						|
end | 
						|
 | 
						|
function run_premake(file, action) | 
						|
	-- search for file with extension Lua | 
						|
	if os.isfile(file .. ".lua") then | 
						|
		file = file .. ".lua" | 
						|
	end | 
						|
 | 
						|
	local cmd = string.format("%s --file=%s %s", _PREMAKE_COMMAND, file, action) | 
						|
	return execute_or_die(cmd) | 
						|
end | 
						|
 | 
						|
function build_cppsharp() | 
						|
	-- install dependencies | 
						|
	run_premake("Provision", "provision") | 
						|
 | 
						|
	-- if there is an llvm git clone then use it | 
						|
	-- otherwise download and extract llvm/clang build | 
						|
 | 
						|
	run_premake("LLVM", "download_llvm") | 
						|
 | 
						|
	-- generate project files | 
						|
	run_premake("../premake4", "gmake") | 
						|
 | 
						|
	-- build cppsharp | 
						|
	--[[BUILD_CONF=release_x32; | 
						|
	config=$BUILD_CONF make -C build/gmake/ | 
						|
	BUILD_DIR=`ls build/gmake/lib` | 
						|
	mkdir -p "$PWD"/build/gmake/lib/lib/"$BUILD_DIR" | 
						|
	cp "$PWD"/build/gmake/lib/"$BUILD_DIR"/libNamespacesBase.* "$PWD"/build/gmake/lib/lib/"$BUILD_DIR" | 
						|
	]] | 
						|
end | 
						|
 | 
						|
if _ACTION == "build_cppsharp" then | 
						|
  build_cppsharp() | 
						|
  os.exit() | 
						|
end | 
						|
 | 
						|
 | 
						|
 |