Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cmake #7

Merged
merged 9 commits into from
May 10, 2024
Merged

add cmake #7

merged 9 commits into from
May 10, 2024

Conversation

oathdruid
Copy link
Collaborator

No description provided.

@oathdruid oathdruid linked an issue May 9, 2024 that may be closed by this pull request
@coveralls
Copy link
Collaborator

coveralls commented May 9, 2024

Coverage Status

coverage: 82.964% (+0.5%) from 82.486%
when pulling da9c8b5 on 5-feat-support-cmake
into bb29d9b on main.

xingyuyu
xingyuyu previously approved these changes May 9, 2024
endif()

if(NOT TARGET absl::base)
find_package(absl REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some issues with the current implementation.

# env
g++ (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)
cmake version 3.29.0
# build
mkdir bld && cd bld && cmake .. -DBUILD_DEPS=ON
# failure log
CMake Error at cmake/babylon-deps.cmake:9 (find_package):
  Could not find a package configuration file provided by "absl" with any of
  the following names:

    abslConfig.cmake
    absl-config.cmake

  Add the installation prefix of "absl" to CMAKE_PREFIX_PATH or set
  "absl_DIR" to a directory containing one of the above files.  If "absl"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:8 (include)

I have already added the parameter -DBUILD_DEPS=ON
https://stackoverflow.com/questions/69748915/could-not-find-a-package-configuration-file-provided-by-absl-with-any-of-the-f

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you expect CMake use FetchContent to download dependencies automatically? this CMakeList.txt try to support this scenes

  1. manually install pre-built abseil-cpp/boost/protobuf from package system like apt or yum
  2. or, manually built them from source and install them to default place or specify in CMAKE_PREFIX_PATH
  3. or, add them along with babylon use add_subdirectory

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you expect CMake use FetchContent to download dependencies automatically?

Yep. I think maybe it's friendly for users.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used on CUTLASS before, as follows:

include(FetchContent)

FetchContent_Declare(
  repo-cutlass
  GIT_REPOSITORY https://github.com/NVIDIA/cutlass.git
  GIT_TAG        6f47420213f757831fae65c686aa471749fa8d60
  GIT_SHALLOW ON
)

set(CUTLASS_ENABLE_HEADERS_ONLY ON CACHE BOOL "Enable only the header library")

FetchContent_MakeAvailable(repo-cutlass)

Maybe it can be used as a reference.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhyncs try this new commit. I also add a new CI pipeline do demonstrate this basic usage
https://github.com/baidu/babylon/actions/runs/9032823762/job/24821774034

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhyncs try this new commit. I also add a new CI pipeline do demonstrate this basic usage https://github.com/baidu/babylon/actions/runs/9032823762/job/24821774034

Thanks very much, it is currently usable!

README.md Outdated
- 使用预编译依赖`cmake -Bbuild`
- 使用自动依赖下载`cmake -Bbuild -DBUILD_DEPS=ON`
- 编译`cmake --build build`
- 单测`--test-dir build`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--test-dir build -> ctest --test-dir build

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@oathdruid oathdruid merged commit 24a6752 into main May 10, 2024
10 checks passed
oathdruid added a commit that referenced this pull request May 10, 2024
* add CMake support and CI pipeline for it
@oathdruid oathdruid deleted the 5-feat-support-cmake branch May 20, 2024 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: support CMake
4 participants