premake-core
premake-core copied to clipboard
Files filter only seems to work on source files or header files
What are you trying to do?
I'm trying to add an .ico
file with buildaction ResourceCompile.
What problem are you having? I honestly have no idea how to do this, the files filter only seems to work when it has a .cpp or .h extension.
What have you tried so far?
files {
"%{prj.location}/src/**.h",
"%{prj.location}/src/**.cpp",
"%{prj.location}/assets/**.ico"
}
filter "files:%{prj.location}/assets/**.ico"
buildaction "ResourceCompile"
What version of Premake are you using? premake5 (Premake Build Script Generator) 5.0.0-beta2
Anything else we should know? Add any other context about the problem here. Right now, .ico files have the buildaction set to None in the .vcxproj file.
Tokens cannot be used in filter. So use:
filter "files:assets/**.ico"
buildaction "ResourceCompile"
Tokens cannot be used in filter. So use:
filter "files:assets/**.ico" buildaction "ResourceCompile"
@Jarod42 that doesn't seem to make a difference.
Which generator do you use?
I bet than buildaction "ResourceCompile"
is only supported by vs* action.
The command I use to generate project files is premake5 vs2022
.
Is project location at the same place than premake5.lua? (else path in filter "files:assets/**.ico"
should be fixed).
Just did a quick test, and in visual, property of the ico file is set properly...
premake5.lua:
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
workspace "Imagination Game Engine"
startproject "Editor"
architecture "x64"
configurations {
"Debug",
"Release"
}
flags {
"MultiProcessorCompile"
}
language "C++"
cppdialect "C++20"
staticruntime "off"
targetdir ("%{wks.location}/bin/" .. outputdir .. "/%{prj.name}")
objdir ("%{wks.location}/bin-int/" .. outputdir .. "/%{prj.name}")
includedirs {
"%{prj.location}/src"
}
files {
"%{prj.location}/src/**.h",
"%{prj.location}/src/**.cpp",
"%{prj.location}/assets/**.ico"
}
filter "files:assets/**.ico"
buildaction "ResourceCompile"
filter "system:windows"
systemversion "latest"
defines "SYSTEM=0"
filter "configurations:Debug"
runtime "Debug"
symbols "on"
defines "CONFIGURATION=0"
filter "configurations:Release"
runtime "Release"
optimize "on"
defines "CONFIGURATION=1"
include "Editor"
include "Engine"
Engine/premake5.lua:
project "Engine"
location "%{wks.location}/%{prj.name}"
kind "StaticLib"
pchsource "src/impch.cpp"
pchheader "impch.h"
And then there's the Engine/assets/icons/Imagination.ico
file.
All the other files should be irrelevant.
Eventually, it seemed putting the files filter in the project scope fixed it..
Nevermind. It may be marked as ResourceCompile, but there are still no resource.h, Engine.rc, or Engine.aps files.
And it's broken again?...
Nevermind. It may be marked as ResourceCompile, but there are still no resource.h, Engine.rc, or Engine.aps files.
Project with resource I work on doesn't use buildaction "ResourceCompile"
for the .ico, but have .rc files (which is handled directly with files "**.rc"
and supported by all generators)...