<commit_before>local ide_dir = iif(_ACTION == nil, "vs2013", _ACTION)
local LOCATION = "tmp/" .. ide_dir
local BINARY_DIR = LOCATION .. "/bin/"

newoption {
	trigger = "static-plugins",
	description = "Plugins are static libraries.",
}

newaction {
	trigger = "install",
	description = "Install in ../../LumixEngine_data/bin",
	execute = function()
		local src_dir = "tmp/vs2013/bin/RelWithDebInfo/"
		local dst_dir = "../../LumixEngine_data/bin/"
		
		function installDll(filename)
			os.copyfile(path.join(src_dir, filename .. ".dll"), path.join(dst_dir, filename .. ".dll"))
		end

		function installDllWithPdb(filename)
			installDll(filename)
			os.copyfile(path.join(src_dir, filename .. ".pdb"), path.join(dst_dir, filename .. ".pdb"))
		end
		
		--installDllWithPdb "animation"
		--installDllWithPdb "audio"
		--installDllWithPdb "editor"
		--installDllWithPdb "engine"
		--installDllWithPdb "lua_script"
		--installDllWithPdb "physics"
		--installDllWithPdb "renderer"
		installDllWithPdb "assimp"
		
		installDll "PhysX3CommonCHECKED_x64"
		installDll "PhysX3CookingCHECKED_x64"
		installDll "PhysX3CharacterKinematicCHECKED_x64"
		installDll "PhysX3CHECKED_x64"
		installDll "nvToolsExt64_1"

		os.copyfile(path.join(src_dir, "studio.exe"), path.join(dst_dir, "studio.exe"))
		os.copyfile(path.join(src_dir, "studio.pdb"), path.join(dst_dir, "studio.pdb"))
		os.copyfile(path.join(src_dir, "app.exe"), path.join(dst_dir, "app.exe"))
		os.copyfile(path.join(src_dir, "app.pdb"), path.join(dst_dir, "app.pdb"))
	end
}

newaction {
	trigger = "install32",
	description = "Install 32bit in ../../LumixEngine_data/bin32",
	execute = function()
		local src_dir = "tmp/vs2013/bin/RelWithDebInfo/"
		local dst_dir = "../../LumixEngine_data/bin32/"
		
		function installDll(filename)
			os.copyfile(path.join(src_dir, filename .. ".dll"), path.join(dst_dir, filename .. ".dll"))
		end

		function installDllWithPdb(filename)
			installDll(filename)
			os.copyfile(path.join(src_dir, filename .. ".pdb"), path.join(dst_dir, filename .. ".pdb"))
		end
		
		--installDllWithPdb "animation"
		--installDllWithPdb "audio"
		--installDllWithPdb "editor"
		--installDllWithPdb "engine"
		--installDllWithPdb "lua_script"
		--installDllWithPdb "physics"
		--installDllWithPdb "renderer"
		installDllWithPdb "assimp"
		
		installDll "PhysX3CommonCHECKED_x86"
		installDll "PhysX3CookingCHECKED_x86"
		installDll "PhysX3CharacterKinematicCHECKED_x86"
		installDll "PhysX3CHECKED_x86"
		installDll "nvToolsExt32_1"

		os.copyfile(path.join(src_dir, "studio.exe"), path.join(dst_dir, "studio.exe"))
		os.copyfile(path.join(src_dir, "studio.pdb"), path.join(dst_dir, "studio.pdb"))
		os.copyfile(path.join(src_dir, "app.exe"), path.join(dst_dir, "app.exe"))
		os.copyfile(path.join(src_dir, "app.pdb"), path.join(dst_dir, "app.pdb"))
	end
}

function defaultConfigurations()
	configuration "Debug"
		targetdir(BINARY_DIR .. "Debug")
		defines { "DEBUG" }
		flags { "Symbols", "WinMain" }

	configuration "Release"
		targetdir(BINARY_DIR .. "Release")
		defines { "NDEBUG" }
		flags { "Optimize", "WinMain" }

	configuration "RelWithDebInfo"
		targetdir(BINARY_DIR .. "RelWithDebInfo")
		defines { "NDEBUG" }
		flags { "Symbols", "Optimize", "WinMain" }
		
	configuration {}
		files { "lumix.natvis" }
	
end

function linkLib(lib)
	links {lib}

	configuration { "x64", "Debug" }
		libdirs {"../external/" .. lib .. "/lib/win64_" .. ide_dir .. "/debug"}

	configuration { "x64", "Release" }
		libdirs {"../external/" .. lib .. "/lib/win64_" .. ide_dir .. "/release"}

	configuration { "x64", "RelWithDebInfo" }
		libdirs {"../external/" .. lib .. "/lib/win64_" .. ide_dir .. "/release"}

	configuration { "x32", "Debug" }
		libdirs {"../external/" .. lib .. "/lib/win32_" .. ide_dir .. "/debug"}

	configuration { "x32", "Release" }
		libdirs {"../external/" .. lib .. "/lib/win32_" .. ide_dir .. "/release"}

	configuration { "x32", "RelWithDebInfo" }
		libdirs {"../external/" .. lib .. "/lib/win32_" .. ide_dir .. "/release"}

	configuration {}
end

function useLua()
	if _OPTIONS["static-plugins"] then
		linkLib("lua")
	else		
		defines { "LUA_BUILD_AS_DLL" }
	end
	includedirs { "../external/lua/include" }
end

function copyDlls(src_dir, platform_bit, platform_dir, dest_dir)
	local physx_suffix
	if platform_bit == 32 then
		configuration { "x32", dest_dir }
		physx_suffix = "x86"
	else
		configuration { "x64", dest_dir }
		physx_suffix = "x64"
	end

	postbuildcommands {
		"xcopy /Y \"$(SolutionDir)../../../external/assimp/dll/" .. platform_dir .. "_" .. ide_dir .. "/" .. src_dir .. "\\assimp.dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\"",
		"xcopy /Y \"$(SolutionDir)../../../external/physx/dll/" .. ide_dir .. "/" .. platform_dir .. "\\nvToolsExt".. tostring(platform_bit) .. "_1.dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\"",
		"xcopy /Y \"$(SolutionDir)../../../external/physx/dll/" .. ide_dir .. "/" .. platform_dir .. "\\PhysX3CommonCHECKED_".. physx_suffix .. ".dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\"",
		"xcopy /Y \"$(SolutionDir)../../../external/physx/dll/" .. ide_dir .. "/" .. platform_dir .. "\\PhysX3CookingCHECKED_".. physx_suffix .. ".dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\"",
		"xcopy /Y \"$(SolutionDir)../../../external/physx/dll/" .. ide_dir .. "/" .. platform_dir .. "\\PhysX3CharacterKinematicCHECKED_".. physx_suffix .. ".dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\"",
		"xcopy /Y \"$(SolutionDir)../../../external/physx/dll/" .. ide_dir .. "/" .. platform_dir .. "\\PhysX3CHECKED_".. physx_suffix .. ".dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\""
	}
end

function libType()
	if _OPTIONS["static-plugins"] then
		kind "StaticLib"
	else
		kind "SharedLib"
	end
end

function linkPhysX()
	configuration { "x64" }
		libdirs {"../external/physx/lib/" .. ide_dir .. "/win64"}
		links {"PhysX3CHECKED_x64", "PhysX3CommonCHECKED_x64", "PhysX3CharacterKinematicCHECKED_x64", "PhysX3CookingCHECKED_x64" }
	configuration { "x32" }
		libdirs {"../external/physx/lib/" .. ide_dir .. "/win32"}
		links {"PhysX3CHECKED_x86", "PhysX3CommonCHECKED_x86", "PhysX3CharacterKinematicCHECKED_x86", "PhysX3CookingCHECKED_x86"}

	configuration { "Debug" }
		links { "PhysX3ExtensionsDEBUG", "PhysXVisualDebuggerSDKDEBUG" }
	configuration { "Release" }
		links { "PhysX3ExtensionsCHECKED", "PhysXVisualDebuggerSDKCHECKED" }
	configuration { "RelWithDebInfo" }
		links { "PhysX3ExtensionsCHECKED", "PhysXVisualDebuggerSDKCHECKED" }
		
	configuration {}
end

function forceLink(name)
	configuration { "x64" }
		linkoptions {"/INCLUDE:" .. name}
	configuration { "x32" }
		linkoptions {"/INCLUDE:_" .. name}
	configuration {}
end

solution "LumixEngine"
	configurations { "Debug", "Release", "RelWithDebInfo" }
	platforms { "x32", "x64" }
	flags { "FatalWarnings", "NoPCH" }
	includedirs {"../src", "../src/engine"}
	location(LOCATION)
	language "C++"
	startproject "studio"
	if _OPTIONS["static-plugins"] then
		defines {"STATIC_PLUGINS"}
	end
	
project "engine"
	libType()

	files { "../src/engine/**.h", "../src/engine/**.cpp", "genie.lua" }
	excludes { "../src/engine/**/osx/*"}

	defines { "BUILDING_ENGINE" }
	includedirs { "../external/lua/include" }
	if not _OPTIONS["static-plugins"] then
		linkoptions {"/DEF:\"../../../src/engine/engine.def\""}
	end<commit_msg>remove "../src/engine" from includedirs in genie.lua<commit_after>local ide_dir = iif(_ACTION == nil, "vs2013", _ACTION)
local LOCATION = "tmp/" .. ide_dir
local BINARY_DIR = LOCATION .. "/bin/"

newoption {
	trigger = "static-plugins",
	description = "Plugins are static libraries.",
}

newaction {
	trigger = "install",
	description = "Install in ../../LumixEngine_data/bin",
	execute = function()
		local src_dir = "tmp/vs2013/bin/RelWithDebInfo/"
		local dst_dir = "../../LumixEngine_data/bin/"
		
		function installDll(filename)
			os.copyfile(path.join(src_dir, filename .. ".dll"), path.join(dst_dir, filename .. ".dll"))
		end

		function installDllWithPdb(filename)
			installDll(filename)
			os.copyfile(path.join(src_dir, filename .. ".pdb"), path.join(dst_dir, filename .. ".pdb"))
		end
		
		--installDllWithPdb "animation"
		--installDllWithPdb "audio"
		--installDllWithPdb "editor"
		--installDllWithPdb "engine"
		--installDllWithPdb "lua_script"
		--installDllWithPdb "physics"
		--installDllWithPdb "renderer"
		installDllWithPdb "assimp"
		
		installDll "PhysX3CommonCHECKED_x64"
		installDll "PhysX3CookingCHECKED_x64"
		installDll "PhysX3CharacterKinematicCHECKED_x64"
		installDll "PhysX3CHECKED_x64"
		installDll "nvToolsExt64_1"

		os.copyfile(path.join(src_dir, "studio.exe"), path.join(dst_dir, "studio.exe"))
		os.copyfile(path.join(src_dir, "studio.pdb"), path.join(dst_dir, "studio.pdb"))
		os.copyfile(path.join(src_dir, "app.exe"), path.join(dst_dir, "app.exe"))
		os.copyfile(path.join(src_dir, "app.pdb"), path.join(dst_dir, "app.pdb"))
	end
}

newaction {
	trigger = "install32",
	description = "Install 32bit in ../../LumixEngine_data/bin32",
	execute = function()
		local src_dir = "tmp/vs2013/bin/RelWithDebInfo/"
		local dst_dir = "../../LumixEngine_data/bin32/"
		
		function installDll(filename)
			os.copyfile(path.join(src_dir, filename .. ".dll"), path.join(dst_dir, filename .. ".dll"))
		end

		function installDllWithPdb(filename)
			installDll(filename)
			os.copyfile(path.join(src_dir, filename .. ".pdb"), path.join(dst_dir, filename .. ".pdb"))
		end
		
		--installDllWithPdb "animation"
		--installDllWithPdb "audio"
		--installDllWithPdb "editor"
		--installDllWithPdb "engine"
		--installDllWithPdb "lua_script"
		--installDllWithPdb "physics"
		--installDllWithPdb "renderer"
		installDllWithPdb "assimp"
		
		installDll "PhysX3CommonCHECKED_x86"
		installDll "PhysX3CookingCHECKED_x86"
		installDll "PhysX3CharacterKinematicCHECKED_x86"
		installDll "PhysX3CHECKED_x86"
		installDll "nvToolsExt32_1"

		os.copyfile(path.join(src_dir, "studio.exe"), path.join(dst_dir, "studio.exe"))
		os.copyfile(path.join(src_dir, "studio.pdb"), path.join(dst_dir, "studio.pdb"))
		os.copyfile(path.join(src_dir, "app.exe"), path.join(dst_dir, "app.exe"))
		os.copyfile(path.join(src_dir, "app.pdb"), path.join(dst_dir, "app.pdb"))
	end
}

function defaultConfigurations()
	configuration "Debug"
		targetdir(BINARY_DIR .. "Debug")
		defines { "DEBUG" }
		flags { "Symbols", "WinMain" }

	configuration "Release"
		targetdir(BINARY_DIR .. "Release")
		defines { "NDEBUG" }
		flags { "Optimize", "WinMain" }

	configuration "RelWithDebInfo"
		targetdir(BINARY_DIR .. "RelWithDebInfo")
		defines { "NDEBUG" }
		flags { "Symbols", "Optimize", "WinMain" }
		
	configuration {}
		files { "lumix.natvis" }
	
end

function linkLib(lib)
	links {lib}

	configuration { "x64", "Debug" }
		libdirs {"../external/" .. lib .. "/lib/win64_" .. ide_dir .. "/debug"}

	configuration { "x64", "Release" }
		libdirs {"../external/" .. lib .. "/lib/win64_" .. ide_dir .. "/release"}

	configuration { "x64", "RelWithDebInfo" }
		libdirs {"../external/" .. lib .. "/lib/win64_" .. ide_dir .. "/release"}

	configuration { "x32", "Debug" }
		libdirs {"../external/" .. lib .. "/lib/win32_" .. ide_dir .. "/debug"}

	configuration { "x32", "Release" }
		libdirs {"../external/" .. lib .. "/lib/win32_" .. ide_dir .. "/release"}

	configuration { "x32", "RelWithDebInfo" }
		libdirs {"../external/" .. lib .. "/lib/win32_" .. ide_dir .. "/release"}

	configuration {}
end

function useLua()
	if _OPTIONS["static-plugins"] then
		linkLib("lua")
	else		
		defines { "LUA_BUILD_AS_DLL" }
	end
	includedirs { "../external/lua/include" }
end

function copyDlls(src_dir, platform_bit, platform_dir, dest_dir)
	local physx_suffix
	if platform_bit == 32 then
		configuration { "x32", dest_dir }
		physx_suffix = "x86"
	else
		configuration { "x64", dest_dir }
		physx_suffix = "x64"
	end

	postbuildcommands {
		"xcopy /Y \"$(SolutionDir)../../../external/assimp/dll/" .. platform_dir .. "_" .. ide_dir .. "/" .. src_dir .. "\\assimp.dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\"",
		"xcopy /Y \"$(SolutionDir)../../../external/physx/dll/" .. ide_dir .. "/" .. platform_dir .. "\\nvToolsExt".. tostring(platform_bit) .. "_1.dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\"",
		"xcopy /Y \"$(SolutionDir)../../../external/physx/dll/" .. ide_dir .. "/" .. platform_dir .. "\\PhysX3CommonCHECKED_".. physx_suffix .. ".dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\"",
		"xcopy /Y \"$(SolutionDir)../../../external/physx/dll/" .. ide_dir .. "/" .. platform_dir .. "\\PhysX3CookingCHECKED_".. physx_suffix .. ".dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\"",
		"xcopy /Y \"$(SolutionDir)../../../external/physx/dll/" .. ide_dir .. "/" .. platform_dir .. "\\PhysX3CharacterKinematicCHECKED_".. physx_suffix .. ".dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\"",
		"xcopy /Y \"$(SolutionDir)../../../external/physx/dll/" .. ide_dir .. "/" .. platform_dir .. "\\PhysX3CHECKED_".. physx_suffix .. ".dll\" \"$(SolutionDir)bin/" .. dest_dir .. "\""
	}
end

function libType()
	if _OPTIONS["static-plugins"] then
		kind "StaticLib"
	else
		kind "SharedLib"
	end
end

function linkPhysX()
	configuration { "x64" }
		libdirs {"../external/physx/lib/" .. ide_dir .. "/win64"}
		links {"PhysX3CHECKED_x64", "PhysX3CommonCHECKED_x64", "PhysX3CharacterKinematicCHECKED_x64", "PhysX3CookingCHECKED_x64" }
	configuration { "x32" }
		libdirs {"../external/physx/lib/" .. ide_dir .. "/win32"}
		links {"PhysX3CHECKED_x86", "PhysX3CommonCHECKED_x86", "PhysX3CharacterKinematicCHECKED_x86", "PhysX3CookingCHECKED_x86"}

	configuration { "Debug" }
		links { "PhysX3ExtensionsDEBUG", "PhysXVisualDebuggerSDKDEBUG" }
	configuration { "Release" }
		links { "PhysX3ExtensionsCHECKED", "PhysXVisualDebuggerSDKCHECKED" }
	configuration { "RelWithDebInfo" }
		links { "PhysX3ExtensionsCHECKED", "PhysXVisualDebuggerSDKCHECKED" }
		
	configuration {}
end

function forceLink(name)
	configuration { "x64" }
		linkoptions {"/INCLUDE:" .. name}
	configuration { "x32" }
		linkoptions {"/INCLUDE:_" .. name}
	configuration {}
end

solution "LumixEngine"
	configurations { "Debug", "Release", "RelWithDebInfo" }
	platforms { "x32", "x64" }
	flags { "FatalWarnings", "NoPCH" }
	includedirs {"../src"}
	location(LOCATION)
	language "C++"
	startproject "studio"
	if _OPTIONS["static-plugins"] then
		defines {"STATIC_PLUGINS"}
	end
	
project "engine"
	libType()

	files { "../src/engine/**.h", "../src/engine/**.cpp", "genie.lua" }
	excludes { "../src/engine/**/osx/*"}

	defines { "BUILDING_ENGINE" }
	includedirs { "../external/lua/include" }
	if not _OPTIONS["static-plugins"] then
		linkoptions {"/DEF:\"../../../src/engine/engine.def\""}
	end
{'fraction_non_alphanumeric': 0.18923729973983294, 'fraction_numerical': 0.0180747637957004, 'mean_word_length': 3.7088974854932304, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4966899', 'n_tokens_mistral': 5913, 'n_tokens_neox': 5320, 'n_words': 965}