Search code examples
premake

premake5 how to set up thread building blocks(TBB)?


I'm trying to get TBB to work with premake5.

TBB has some fairly non-standard things going on in its project files.

  1. It includes .asm files in the project(premake5 seems ok with this)

  2. The .asm files are different for 32bit/64bit etc, so some files need to be excluded depending on the architecture. TBB does this by using "exclude from build" flag in VS, this way the files show up in the project, but are only actual build if they aren't flagged as excluded. I'm not seeing any way to replicate this in premake5 yet. Premake5 has "excludes" but it seems to completely remove the files from the project instead of marking them as not built, it also appears to not work when filtered by platforms.

  3. The asm files are marked as: Item Type = Microsoft Macro Assembler in TBB's project. I am not sure how to make premake5 do this. Currently when I add them to my premake5 generated project, Item type is blank. TBB also marks them Execute Before: Midl Execute After: CustomBuild

This seems like it might be beyond what premake5 supports, so maybe this isn't even supported:/ ?


Solution

  • It includes .asm files in the project(premake5 seems ok with this)

    Yes, this should be fine.

    The .asm files are different for 32bit/64bit etc, so some files need to be excluded depending on the architecture.

    You'll want to do something like this:

    solution "MySolution"
       configurations { "Debug", "Release" }
       platforms { "x86", "x86_64" }
    
    project "MyProject"
        kind "ConsoleApp" -- or whatever set things up here
    
    filter { "platforms:x86" }
        files {
           -- 32-bit files go here
        }
    
    filter { "platforms:x86_64" }
        files {
            -- 64-bit files go here
        }
    

    The asm files are marked as: Item Type = Microsoft Macro Assembler in TBB's project.

    Premake does not do this currently, nor does it automatically include the MASM rule, which is probably also needed? Might be worth opening a ticket so the developers can get it addressed.