Hazel icon indicating copy to clipboard operation
Hazel copied to clipboard

error MSB3073: The command "IF EXIST ..\bin\Debug-windows-x86_64\Hazel\Hazel.dll\ (xcopy /Q /E /Y /I ..\bin\Debug-windows-x86_64\Hazel\Hazel.dll ..\bin\Debug-windows-x86_64\Sandbox > nul) ELSE (xcopy /Q /Y /I ..\bin\Debug-windows-x86_64\Hazel\Hazel.dll ..\bin\Debug-windows-x86_64\Sandbox > nul)

Open Mephistoette opened this issue 1 year ago • 6 comments

when I set premake already, and then delete the hazel.sln,*vcxproj in Hazel and Sandbox Dirs, go back to run premake5.exe vs2022, everything seems ok, and I go back to open the Hazel.sln built by the premake in vs2022, then build Sanbox and Hazel, either of them show the same error " C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: The command "IF EXIST ..\bin\Debug-windows-x86_64\Hazel\Hazel.dll\ (xcopy /Q /E /Y /I ..\bin\Debug-windows-x86_64\Hazel\Hazel.dll ..\bin\Debug-windows-x86_64\Sandbox > nul) ELSE (xcopy /Q /Y /I ..\bin\Debug-windows-x86_64\Hazel\Hazel.dll ..\bin\Debug-windows-x86_64\Sandbox > nul)" another thing is that when I checking the Hazel and Sandbox properties, I found that the target directories and intermediate directories were blank, the path I set in premake didn't got read correctly.

Mephistoette avatar Jul 07 '24 05:07 Mephistoette

I figure out it, the solution is that replace "postbuildcommands { ("{COPY} %{cfg.buildtarget.abspath} ../bin/" .. outputdir .. "/Sandbox") } " with "postbuildcommands { ("{COPY} %{cfg.buildtarget.relpath} "../bin/" .. outputdir .. "/Sandbox/"") }"

Mephistoette avatar Jul 07 '24 06:07 Mephistoette

Then please close the issue.

ViktorPopp avatar Jul 07 '24 11:07 ViktorPopp

Replace "COPY" with "COPYFILE" postbuildcommands { ("{COPYFILE} %{cfg.buildtarget.relpath} ../bin/" .. outputdir .. "/Sandbox") }

crdc-mayangyang avatar Mar 03 '25 12:03 crdc-mayangyang

postbuildcommands
{
   ("{MKDIR} ../bin/" ..outputdir .."/Sandbox"),
   ("{COPYFILE} %{cfg.buildtarget.relpath} ../bin/" .. outputdir .. "/Sandbox")
}

1989706387 avatar Jun 20 '25 04:06 1989706387

Okay? Is it gonna be closed?

ViktorPopp avatar Jun 20 '25 05:06 ViktorPopp

Hi, i am facing some problem with premake and have seemed to hit a dead-end... these are some of the problems i have been facing trying to follow through the tutorial. please help me correct the issue or point me in the right direction of any similar issue already addressed, thank you in advance.

Problem-1:

premake takes relative path with resp to $(ProjectDir) and thus using .. to go to parent directory... which doesn't have seem to to be resolved into its absolute path VS as it doesn't event show in sometimes despite refreshing multiple times.

Image

Problem-2:

none of the filters options added into premake5.lua to turn on optimization (release & distributution) or keep symbols on (debug) as well as preprocessor definitions have been written into the project file.

Image

Problem-3:

additional include libraries also for some reason doesn't seem to have resolved the proper path instead it just writes the relative path as it is into proj file.

Image

Refernce:

  • i am currently following the 4th video along the tutorial series of game engine: https://youtu.be/sULV3aB2qeU?si=1qaPBWzN8DlgUqk0
  • using premake version: v5.0.0-beta7
  • VS version: 2022, i.e. cmd used here: premake5.exe vs2022
  • also there seems to a problem as windows headers are not included by default when proj files are created by premake, which cause a a whole bunch of identifier is undefined errors. is there a solution for it?
  • i have tried to go through few of the previously closed "issues" here and and in premake repo as well, and make some changes according to the premake5.lua script as below:

outdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" -- using variable common for multiple projects, ex: Debug-Win-x64
-- NOTE: this beta/aplha is not properly exporting for relative paths, so i have kept absolute paths with macros exactly how we define inside the VS

workspace "ChernoHazel" -- solution workspace
	architecture "x64"
	configurations 
	{
		"Debug", -- all logging included
		"Release", -- optim ver with lesser logging
		"Distribution" -- final actual release, with no logging
	}
	targetdir ("bin/" .. outdir .. "/%{prj.name}") -- output directory: _bin/Debug-Win-x64/ProjectName
	objdir ("obj/" .. outdir .. "/%{prj.name}") -- intermediate directory: _obj/Debug-Win-x64/ProjectName


project "Engine"
	location "Engine" -- relative folder location
	kind "SharedLib" -- config-type: Dynamic Library (.dll)
	language "C++"
	-- path root here: relative to the .vcxproj file, i.e. inside project folder

	files
	{
		"%{prj.name}/src/**.h", -- recursively include all files inside Engin/src/ folder
		"%{prj.name}/src/**.cpp", -- mention which file types to inclue, like .h, .cpp for now
	}
	includedirs -- Additional Include Directories
	{
		"%{prj.name}/vendor/spdlog/include",
	}

	filter {"system.windows"} -- filters specific to platform
		cppdialect "C++17" -- standard libraries version
		staticruntime "On" -- linking runtime libraries staticly
		systemversion "latest" -- windows SDK version
		defines -- Preprocessor Definitions
		{
			"HZ_PLATFORM_WINDOWS",
			"HZ_BUILD_DLL", -- macro only for engine
		}
		postbuildcommands
		{
			("{MKDIR} ../bin/" ..outdir .."/Sandbox"), -- create dir just to be safe o first build
			("{COPYFILE} %{cfg.buildtarget.relpath} ../bin/" .. outdir .. "/Sandbox")
		}
		
	filter {"configurations.Debug"} -- filters specific to type of config: debug
		defines "HZ_DEBG"
		symbols "On"
	filter {"configurations.Release"} -- filters specific to type of config: release
		defines "HZ_RELS"
		optimize "On"
	filter {"configurations.Distribution"} -- filters specific to type of config: distribution
		defines "HZ_DIST"
		optimize "On"


project "Sandbox"
	location "Sandbox"
	kind "ConsoleApp" -- config-type: Application (.exe)
	language "C++"

	files
	{
		"%{prj.name}/src/**.h",
		"%{prj.name}/src/**.cpp",
	}
	includedirs -- Additional Include Directories
	{
		"Engine/vendor/spdlog/include",
		"Engine/src",
	}
	links -- add other project refernces here
	{
		"Engine",
	}

	filter {"system.windows"} -- filters specific to platform
		cppdialect "C++17" -- standard libraries version
		staticruntime "On" -- linking runtime libraries staticly
		systemversion "latest" -- windows SDK version
		defines -- Preprocessor Definitions
		{
			"HZ_PLATFORM_WINDOWS",
		}
		
	filter {"configurations.Debug"} -- filters specific to type of config: debug
		defines "HZ_DEBG"
		symbols "On"
	filter {"configurations.Release"} -- filters specific to type of config: release
		defines "HZ_RELS"
		optimize "On"
	filter {"configurations.Distribution"} -- filters specific to type of config: distribution
		defines "HZ_DIST"
		optimize "On"

Xtremely-Doped-Punk avatar Jun 20 '25 06:06 Xtremely-Doped-Punk