esrlabs / bake

C++ build tool
http://esrlabs.github.io/bake
Other
26 stars 11 forks source link

Adoptions specified in .adapt file are not applied to Library config #152

Closed Nicoretti closed 6 years ago

Nicoretti commented 7 years ago

Host System: OS: OSX Yosemite Ruby: 2.4.0 Bake: -- bake 2.39.1, ruby 2.4.0p0, platform x86_64-darwin14 --

Used Adapt file:

Adapt {
  ExecutableConfig __ALL__, project: __MAIN__, type: extend {
    Dependency gmock
    ExternalLibrary "pthread"
    PostSteps {
      CommandLine "./$(OutputDir)/$(ArtifactName)", filter: run, default: off
      CommandLine "./$(OutputDir)/$(ArtifactName) -r xml --out $(OutputDir)/test_$(ArtifactName).xml", filter: run_xml, default: off
    }
    DefaultToolchain GCC {
      Compiler CPP {
        Flags "-m32 -O0 -g -Wall -fpermissive -fmessage-length=0"
        Define "UNIT_TEST"
      }
      Compiler C {
        Flags "-m32 -O0 -g -Wall -fmessage-length=0 -std=c99"
        Define "UNIT_TEST"
      }
      Linker {
          Flags "-m32"
      }
    }
  }
}

Invocation: bake -m _externals/Compositions/Project/Components/component --adapt gcc UnitTestBase -v3 -a black --do run

Expected Behaviour: Everything is built using the adapt config -> using the -m32 flag

Actual Behaviour: Got linker error because one component/lib was built without -m32 and therefore has no symbols for 32 bit archtiecture.

Project.meta of the problematic component:

Project {
    LibraryConfig IncludeOnly {
    }

    LibraryConfig UnitTestLib {
    Files "**/*.cpp"
    IncludeDir "include", inherit: true
    IncludeDir "common/include"
    IncludeDir "configuration/include"
    IncludeDir "cpp2ethernet/include"
    IncludeDir "estl/include"
    IncludeDir "gmock/fused-src"
    IncludeDir "platform/include"
    IncludeDir "util/include"
    IncludeDir "transport/include"
    Toolchain {
        Compiler CPP {
            Define "UNIT_TEST"
            Flags "-O2 -g -Wall -fmessage-length=0"
        }
    }
    }
}

Further Details: If the Toolchain setting is removed from the Library config the component is built with the -m32 if the adapt is used. -> The Issue seems to be caused by the Toolchain within the Library config

aschaal commented 7 years ago

bake is correct. Flags "abc" means Flags replace: "abc". This is a bad default behaviour since the beginning of the tool. I will implement a warning and make this behaviour deprecated.