Serveral problem of cmake users(output name, including path and installation config)
Hi, I'm a cmake user and I tried to use cmake/make_cmakelists.py to generate CMakeLists.txt and integrate upb into my project and find some problems.
- The generated dependency of
utf8_rangeis invalid because it has a/third_party/prefix. - CMake CONFIG files and is missing and also nothing to install when I try to create a prebuilt package.
- Should all exported header be under
upb/? Thethird_party/utf8_range/utf8_range.his a different path from others. - Could all output name of libraries in upb startswith
upb? There are a lot of targets (extension_registry,mini_table,fastdecodeand etc) now , and if we install them into any path, we can not tell which files are belong to upb.
Could we have a disscuss these topics and can I create a PR for them?
Quick question about 4. Do you mean C level symbols or file paths or something else?
Quick question about 4. Do you mean C level symbols or file paths or something else?
I mean file path, the OUTPUT_NAME of cmake target property only affect file path.
It is intended that CMakeLists.txt will be available in the repo (either on the main branch or a separate branch) without users having to generate it first. Unfortunately the setup for doing this is currently broken.
The right way to generate the CMakeLists.txt is to use the Bazel commands:
$ bazel test cmake:test_generated_files
$ bazel-bin/cmake/test_generated_files --fix
It is also possible to test the CMake build through Bazel:
bazel test cmake:cmake_build
CMake CONFIG files and is missing and also nothing to install when I try to create a prebuilt package.
Can you say more about your use case? What are you trying to create a prebuilt package for?
upb's API and ABI are both unstable. It is not intended to have prebuilt packages available in package repositories.
Should all exported header be under upb/ ? The third_party/utf8_range/utf8_range.h is a different path from others.
upb uses the UTF-8 decoder from this project: https://github.com/cyb70289/utf8. To truly CMake-ify upb, we would probably want to give that project its own CMakeLists.txt and depend on it from upb.
Within the upb repo, we need to keep it in a separate third_party directory since it is not Google-owned code.
Could all output name of libraries in upb startswith upb ?
I think it would be fine to add a upb_ prefix to all upb CMake targets.
@haberman I want to use upb and lua binding in my project. With installation of cmake CONFIG files, we can just link the exported target, let cmake to include the dependency header path and link the necessary libraries automatically, just like it does in bazel. Also we use grpc in our project which also depend upb, and it just link the upb runtime library, we want use both upb libraries, protoc-gen-upb, protoc-gen-lua and etc, I have to build the same version of upb, but without cmake CONFIG files I have to read the bazel scripts to know the relations between the libraries and executables in upb and then get which directory I should include, which libraries I should link.
I have written a patch file for my usage at https://github.com/atframework/cmake-toolset/blob/main/ports/grpc/upb-e4635f223e7d36dfbea3b722a4ca4807a7e882e2.patch . It's simular to the upb port in vcpkg(https://github.com/microsoft/vcpkg/blob/master/ports/upb/0001-make-cmakelists-py.patch), but I think it's very hard to follow the changes in the future.So I wondering if it can be done in this repo?
I'm not sure whether bazel can add a prefix for headers of some exported libraries.In my cmake patch file, I copy the header of utf8_range to a temporary path starts with upb/third_party/utf8-range . Or if it's a standalone library, maybe just removing third_party prefix is a better way?