scylladb / cpp-rust-driver

API-compatible rewrite of https://github.com/scylladb/cpp-driver as a wrapper for Rust driver.
GNU Lesser General Public License v2.1
11 stars 11 forks source link

introduce single CMake script build all packages #129

Open syuu1228 opened 4 weeks ago

syuu1228 commented 4 weeks ago

This introduces single CMake script to build all packages and non-package build with same result, including shared library SONAME and versioning.

Complicated shellscripting to build package build are no longer required, everything can be build with "cmake -S . -B build && cmake --build build".

Note that there is a limitation, this requires a dummy C code to call libscylla-cpp-driver function. It is because this rebuild libraries with C Linker on CMake. The dummy C code is located at dummy/dummy.c.

CMakeList.txt is now fully re-written without unrelated codes. And to build Rust code easier, imported CMakeRust project: https://github.com/Devolutions/CMakeRust

And also FindLibClang.cmake from cpp2py: https://github.com/TRIQS/cpp2py/blob/master/cmake/FindLibClang.cmake

Both included few patches since little bit outdated, and have few bugs.

Pre-review checklist

syuu1228 commented 4 weeks ago

Build passed on following environments:

Build failed on following environments:

These two are outdated releases, does not have newer packages for build dependencies. I think we just can drop them from support list.

wprzytula commented 4 weeks ago

@syuu1228 CI is failing because libclang is not found.

wprzytula commented 3 weeks ago

Waiting with review until CI stops failing.

syuu1228 commented 2 weeks ago

Rewrited almost all code, now CI can pass. Here are change lists:

syuu1228 commented 2 weeks ago

Build failed on following environments:

  • DEB

    • Ubuntu x86_64

    • bionic (18.04)

    • Debian x86_64

    • buster (10)

These two are outdated releases, does not have newer packages for build dependencies. I think we just can drop them from support list.

Fixed the build failure, now build passed on these distros.

Lorak-mmk commented 2 weeks ago

Afaik apart from using prebuiilt libraries (.so + .h) it's popular in C/C++ to use submodules (or something similar) and CMake's add_subdirectory to build dependency alongside main project. It was one of the goals to be mostly compatible with cpp-driver, which allowed such usage. Example: I used cpp-driver in this manner during ZPP project in a more modern C++ wrapper: https://github.com/scylla-zpp-blas/scylla_modern_cpp_driver/blob/a9ea3ca5b2d2921af497164994d64ddf09e52fd9/CMakeLists.txt#L6

Is such usage still possible after your changes? I didn't review the changes yet, but I see fragments:

#---------------
# Policies
#---------------

if(POLICY CMP0074)
  cmake_policy(SET CMP0074 NEW)
endif()

if (POLICY CMP0054)
  cmake_policy(SET CMP0054 NEW)
endif()

or

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

I can't say I know CMake that well, so I'm not sure: is this going to be a problem?

mykaul commented 1 week ago

What's the status of this PR?