-
Notifications
You must be signed in to change notification settings - Fork 982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Premake generator is broken #17345
Comments
Hi @Enhex Thanks for your feedback. I am doing #17350, including a test and some pending fixes to It seems to be working fine for |
when I run
it seems to be silent because it carries on to run the test_package which also fails because there's no compiled library:
this happens because in the generated premake file there's only support for 1 configuration which mismatches what's actually being used. -- ...
t_conandeps["release_x86_64"]["freetype"] = {}
t_conandeps["release_x86_64"]["freetype"]["includedirs"] = {"/home/desktop/.conan2/p/b/freete219fd5cdef6f/p/include",
"/home/desktop/.conan2/p/b/freete219fd5cdef6f/p/include/freetype2"}
t_conandeps["release_x86_64"]["freetype"]["libdirs"] = {"/home/desktop/.conan2/p/b/freete219fd5cdef6f/p/lib"}
-- ... and in function conan_setup_build(conf, pkg)
if conf == nil then
filter { "configurations:release", "architecture:x86_64" } -- defaults to only working with this configuration
conan_setup_build("release_x86_64")
filter {}
elseif pkg == nil then
for k,v in pairs(conandeps[conf]) do
conan_setup_build(conf, k)
end
else
includedirs(conandeps[conf][pkg]["includedirs"])
bindirs(conandeps[conf][pkg]["bindirs"])
defines(conandeps[conf][pkg]["defines"])
end
end Why the generated Premake scripts are release/debug and architecture specific? i don't understand what this new generator tries to solves, it only seems to over-complicate things with all these nested dictionaries, merging and recursion. |
my first post got a .zip download with a reproducible example. for more context it's my initial attempt to upgrade the following script from Conan 1 to Conan 2, regarding #13390 as i suspected it's a multi build attempt. |
Hello again, thank you for the heads up! As already written in full detail in my comment to your PR @Enhex (#17355 (comment)) this is from my POV expected behavior and not a bug. Yes it is a bit unlucky that it does not work with the out of the box "first" premake script. One very important info is that all configurations supported by your premake script needs to be covered by conan. So if you use the starter example from premake you already need at least two builds (Debug and Release). For me it is not clear how premake decided which architecture to use. However you need to make sure that you retrieve your conan dependencies 2 time one time for Debug and one time for Release (architecture needs to match whatever premake decides to use). Any configuration not covered by conan will not have the right includes and links setup. Taking your location_dir = "./"
include(location_dir .. "conandeps.premake5.lua")
workspace("nanovg")
location(location_dir)
architecture "x86_64"
configurations { "Debug", "Release" }
project("nanovg")
kind "StaticLib"
language "C++"
cppdialect "C++17"
targetdir = location_dir .. "bin/%{cfg.buildcfg}"
conan_setup()
files{
"nanovg/src/**",
}
links{"OpenGL32.lib"}
defines{"FONS_USE_FREETYPE"}
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On" In case you also want to support 32-Bit I would recommend taking a look at premake5's platforms: You could configure the platforms as follows: platforms { "x32", "x64" }
filter { "platforms:x32" }
architecture "x86"
filter {}
filter { "platforms:x64" }
architecture "x86_64"
filter {} When doing like that you need to make sure to fetch the following 4 conan dependencies:
You can see a full working example (template repo) here: https://github.com/Moxibyte/MoxPP (However without 32-Bit support) |
Describe the bug
Conan version 2.9.2
How to reproduce it
when calling the generated
conan_setup()
inconandeps.premake5.lua
without arguments,it only works with x86 release build because in
conan_setup_build()
it callsfilter { "configurations:release", "architecture:x86_64" }
which filters away all the setup calls for any other configuration.
when i call
conan create .
on my recipe it seems to default to debug build,because it fails to add dependencies' include dirs.
it's possible to work around the wrong config detection by manually specifying
the configuration string (example:
conan_setup("release_x86_64")
,for every configuration combination...
bug_premake.zip
Conan 1's Premake generator worked fine, if it ain't broke why break it?
The text was updated successfully, but these errors were encountered: