Search code examples
c++buck

Does Buck support headers with the same name as folders?


I am trying to build Eigen with . Unfortunately, Eigen has an unusual structure of headers:

Eigen/src/Cholesky/LLT.h
Eigen/src/Cholesky/LDLT.h
Eigen/src/Cholesky/...
Eigen/src/...
Eigen/Array
Eigen/Cholesky
Eigen/Core
Eigen/...
...

You can browse the repo on GitHub.

I need to include Eigen/Cholesky and Eigen/Cholesky/LLT.h in the exported headers, but Buck considers this a conflict:

prebuilt_cxx_library(
  name = 'eigen',
  header_only = True,
  header_namespace = 'Eigen', 
  exported_headers = subdir_glob([
    ('Eigen', '*'),
    ('Eigen/src', '**/*.h'),
  ]), 
  visibility = [
    'PUBLIC',
  ],
)

java.nio.file.FileAlreadyExistsException: .../eigen/buck-out/gen/eigen#default,headers/Eigen/Cholesky

How can I have folders and files with the same name as exported headers in Buck?


Solution

  • the src folder should be part of the export, try this one:

    prebuilt_cxx_library(
      name = 'eigen',
      header_only = True,
      header_namespace = 'Eigen', 
      exported_headers = subdir_glob([
        ('Eigen', '*'),
        ('Eigen', 'src/**/*.h'),
      ]), 
      visibility = [
        'PUBLIC',
      ],
    )