premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.22k stars 620 forks source link

Premake5 alpha 16 - cppdialect c++20 still not working? #1623

Closed Pirulax closed 3 years ago

Pirulax commented 3 years ago

What's your question? I've seen #1516, and #1460. I took a look at alpha 16's release note, and it includes #1460, yet it doesn't seem to work. Error message: Error: invalid value 'c++20' for cppdialect.

Anything else we should know? If needed I can provide my premake scripts. CLI args: premake5.exe vs2019

I tried with c++17 but then: Error: [string "vstudio/vs2005.lua"]:9: attempt to index a nil value (field 'sln2005') Edit: Turns out this error was from a mistake by my side (something to do with calling vpaths before files IIRC)

(You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to questions like these!)

Pirulax commented 3 years ago

Okay, so it seems like I misunderstood the release notes. alpha16 doesn't include the listed PRs? I cloned the current soruce code, built it, and it works.

samsinsane commented 3 years ago

@starkos are you able to confirm the binary you uploaded? The version says alpha16, and the tagged commit contains all the listed PRs, but the binary (Windows at least) doesn't contain any of them. C++20 isn't an allowed value for cppdialect and the COPYFILE and COPYDIR tokens aren't in there either. Also, the release says "Changes since 5.0-alpha16" but it should say "Changes since 5.0-alpha15".

starkos commented 3 years ago

Maybe the embedded scripts didn't get updated somehow? I've rebuilt it and verified that "C++20" works for cppdialect. @Pirulax Could you download from the release page and verify that it now works for you?

samsinsane commented 3 years ago

I'm going to close this off assuming that it all works now.

mmance commented 3 years ago

OK, so I am new to premake and just learning C++, but I think I am experiencing this same issue. I am trying to use premake to make a clion project. I have installed a cmake and clion module for premake.

If I put cppdialect "c++2a" in my lua, I get Target "myGame" requires the language dialect "CXXnil" , but CMake does not know the compile flags to use to enable it.

I have tried c++20 also: g++: error: unrecognized command line option '-std=c++20'; did you mean '-std=c++2a'?

I tried the premake alpha16 linux binary and also compiled from source.

samsinsane commented 3 years ago

@mmance it will be up to those modules to support the cppdialect values. It's likely that they contain this pattern:

local cppdialect = {
  "c++11" = "something",
  "c++14" = "somethingelse",
  ...
}
local output = "CXX" .. cppdialect[cfg.cppdialect]

This isn't an issue with this repo, you'll need to go back to the developers of the CMake and CLion modules and let them know. I would assume they're only supporting the non-draft versions of C++.