premake-core icon indicating copy to clipboard operation
premake-core copied to clipboard

Looking for an example of using a `configmap` to map a build configuration/platform pair

Open JeremyMorton opened this issue 1 year ago • 1 comments

What are you trying to do? "Map Build Configuration and Platform pairs using a configmap."

From https://premake.github.io/docs/configmap/

wks_cfg is the workspace configuration being mapped. It can be a string representing a build configuration or a platform, or a table holding a build configuration/platform pair.

prj_cfg is the project configuration to which the workspace configuration should be mapped. It may also be a string or a build configuration/platform pair.

What problem are you having? I have tried syntax like this:

        configmap {
            [{ 'Debug',      'x64' }] = { 'Debug',   'Any CPU' },
            [{ 'Internal',   'x64' }] = { 'Release', 'Any CPU' }
        }

premake doesn't error, but the output sln file seems to have ignored it:

		{0AACB1DA-1E49-4034-A852-4F6D6B1BF838}.Debug|x64.ActiveCfg = Debug|x64
		{0AACB1DA-1E49-4034-A852-4F6D6B1BF838}.Debug|x64.Build.0 = Debug|x64
		{0AACB1DA-1E49-4034-A852-4F6D6B1BF838}.Internal|x64.ActiveCfg = Internal|x64
		{0AACB1DA-1E49-4034-A852-4F6D6B1BF838}.Internal|x64.Build.0 = Internal|x64

What have you tried so far? I have also tried a simpler configmap to see if I could just map the Platform:

        configmap { [ "x64" ] = "Any CPU" }

again, with no mapping occurring.

This mapping of just the Build Configuration works:

        configmap {
            [ 'Internal' ] = 'Release'
        }

What version of Premake are you using? Premake 5.0.71 (72b58235), a build script generator.

JeremyMorton avatar Jun 21 '23 19:06 JeremyMorton

I have discovered that the Platform that shows up in the sln file as x64 is actually x86_64 in the premake lua files, so I was able to get it somewhat closer.

        configmap {
            [{ 'Debug',      'x86_64' }] = { 'Debug',   'Any CPU' },
            [{ 'Internal',   'x86_64' }] = { 'Release', 'Any CPU' }
        }

makes the not-quite-correct:

		{0AACB1DA-1E49-4034-A852-4F6D6B1BF838}.Debug|x64.ActiveCfg = Debug Any CPU|x64
		{0AACB1DA-1E49-4034-A852-4F6D6B1BF838}.Debug|x64.Build.0 = Debug Any CPU|x64
		{0AACB1DA-1E49-4034-A852-4F6D6B1BF838}.Internal|x64.ActiveCfg = Release Any CPU|x64
		{0AACB1DA-1E49-4034-A852-4F6D6B1BF838}.Internal|x64.Build.0 = Release Any CPU|x64

And

        configmap {
            [ "x86_64" ] = "Any CPU"
        }

makes a similarly not correct:

		{1B7F6123-3A14-4055-ADD1-E99CD87757CE}.Debug|x64.ActiveCfg = Debug Any CPU|x64
		{1B7F6123-3A14-4055-ADD1-E99CD87757CE}.Debug|x64.Build.0 = Debug Any CPU|x64
		{1B7F6123-3A14-4055-ADD1-E99CD87757CE}.Internal|x64.ActiveCfg = Internal Any CPU|x64
		{1B7F6123-3A14-4055-ADD1-E99CD87757CE}.Internal|x64.Build.0 = Internal Any CPU|x64

JeremyMorton avatar Jun 21 '23 20:06 JeremyMorton