mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.35k stars 1.53k forks source link

CMake module fails to import Faiss library #13197

Open artem opened 1 month ago

artem commented 1 month ago

Describe the bug Meson fails to import faiss as cmake subproject using cmake module

To Reproduce

  1. Put https://github.com/facebookresearch/faiss into the subprojects directory

  2. Import faiss using cmake module:

    cmake = import('cmake')
    faiss_opts = cmake.subproject_options()
    faiss_opts.add_cmake_defines({'FAISS_ENABLE_GPU': false, 'FAISS_ENABLE_PYTHON': false, 'BUILD_TESTING': false})
    faiss_proj = cmake.subproject('faiss', options: faiss_opts)
    faiss_lib = faiss_proj.dependency('faiss')
  3. The following error is observed during meson setup:

    subprojects/faiss/meson.build:127:0: ERROR: Invalid variable name: 1_Flat_dir

P.S. I have narrowed the issue to the following CMake expressions in the Faiss: https://github.com/facebookresearch/faiss/blob/3121fc6/tutorial/cpp/CMakeLists.txt#L7-L8 . Seems like Meson fails to handle them properly. Commenting them out workarounds the issue.

Expected behavior Meson configures the project successfully

system parameters