LoopPerfect / buckaroo

The decentralized package manager for C++ and friends 🏝️
https://buckaroo.pm
MIT License
936 stars 33 forks source link

BUCKAROO_DEPS with other dependencies #104

Closed r0x0d closed 7 years ago

r0x0d commented 7 years ago

How can i link BUCKAROO_DEPS with others libs for my project?

For example: deps = BUCKAROO_DEPS This will build all deps that buckaroo downloads, ok. But if i want to pass more than only BUCKAROO_DEPS?

Lets say: deps = [ BUCKAROO_DEPS, '//modules/mylib:Lib', '//modules/......' ]

When i tried the above code, it didn't work. How can i pass in a BUCK file to build BUCKAROO_DEPS and my own libs?

This is my current BUCK file

include_defs('//BUCKAROO_DEPS')

cxx_binary(
  name = 'App',
  header_namespace = 'myapp',
  headers = subdir_glob([
    ('include', '**/*.hpp'),
  ]),
  srcs = glob([
    'source/**/*.cpp',
  ]),
  deps = [
    BUCKAROO_DEPS,
    '//modules/lib1:Lib',
    '//modules/lib2:Lib2',
    '//modules/lib3:Lib3',
    '//modules/lib4:Lib4',
  ],
)
njlr commented 7 years ago

Hi @nicht,

deps takes a single Python list (docs). The variable BUCKAROO_DEPS is just a list (you can see the definition in the BUCKAROO_DEPS file), so you can concat with + to create a new list:

BUCKAROO_DEPS + [
    '//modules/lib1:Lib',
    '//modules/lib2:Lib2',
    '//modules/lib3:Lib3',
    '//modules/lib4:Lib4',
  ]

Applying this to your example, we get:

include_defs('//BUCKAROO_DEPS')

cxx_binary(
  name = 'App',
  header_namespace = 'myapp',
  headers = subdir_glob([
    ('include', '**/*.hpp'),
  ]),
  srcs = glob([
    'source/**/*.cpp',
  ]),
  deps = BUCKAROO_DEPS + [
    '//modules/lib1:Lib',
    '//modules/lib2:Lib2',
    '//modules/lib3:Lib3',
    '//modules/lib4:Lib4',
  ],
)

Hope that helps!

r0x0d commented 7 years ago

Oh, ok. Thanks !