Skip to content

Commit

Permalink
CI: fix aot cli
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwei37 committed Aug 10, 2024
1 parent b2082f2 commit 7720ea9
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 159 deletions.
Binary file added .github/assets/sum.bpf.o
Binary file not shown.
13 changes: 6 additions & 7 deletions .github/workflows/test-aot-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build and test AOT cli

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
Expand All @@ -26,17 +26,16 @@ jobs:

- name: Build and install everything
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DBPFTIME_ENABLE_UNIT_TESTING=1
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DBPFTIME_ENABLE_UNIT_TESTING=1 -DBUILD_LLVM_AOT_CLI=1
cmake --build build --target all -j
- name: Do compilation & run
run: |
export PATH=$PATH:~/.bpftime
cd .github/assets
bpftime-vm build sum.bpf.o
./build/cli/bpftime-vm build .github/assets/sum.bpf.o
echo "AwAAAAEAAAACAAAAAwAAAA==" | base64 -d > test.bin
program_output=$(bpftime-vm run test.o test.bin)
program_output=$(./build/cli/bpftime-vm run test.o test.bin)
echo $program_output
if echo $program_output | grep "Output: 6"; then
if echo $program_output | grep "Return value: 6"; then
echo "Successful!"
exit 0
else
Expand Down
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ if (${LLVM_PACKAGE_VERSION} VERSION_LESS 15)
message(FATAL_ERROR "LLVM version must be >=15")
endif()

option(ENABLE_LLVM_SHARED "Link shared library of LLVM" YES)
option(ENABLE_LLVM_SHARED "Link shared library of LLVM" NO)
option(BUILD_LLVM_AOT_CLI "Build AOT cli, which rely on libbpf" NO)

if(ENABLE_LLVM_SHARED)
set(LLVM_LIBS LLVM)
Expand Down Expand Up @@ -75,9 +76,12 @@ endif()
# if BPFTIME_LLVM_JIT is set, then it's built in the bpftime project.
# If not, it's built as a standalone library.
if(${BPFTIME_LLVM_JIT})
# only build cli in the main project because it relies on libbpf
# build cli in the main project because it relies on libbpf
add_subdirectory(cli)
else()
if(${BUILD_LLVM_AOT_CLI})
add_subdirectory(cli)
endif()
if(${BPFTIME_ENABLE_UNIT_TESTING})
message(INFO " Adding Catch2 seperately..")
FetchContent_Declare(
Expand Down
12 changes: 10 additions & 2 deletions cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@ target_include_directories(bpftime-vm-cli
${LIBBPF_INCLUDE_DIRS}
)

add_dependencies(bpftime-vm-cli spdlog::spdlog argparse bpftime_llvm_jit_vm libbpf)
# Find the pkg-config package
find_package(PkgConfig REQUIRED)

# Find the libbpf package using pkg-config
pkg_check_modules(LIBBPF REQUIRED libbpf)

include_directories(${LIBBPF_INCLUDE_DIRS})

add_dependencies(bpftime-vm-cli spdlog::spdlog bpftime_llvm_jit_vm)
target_link_libraries(bpftime-vm-cli
PRIVATE spdlog::spdlog argparse bpftime_llvm_jit_vm
PRIVATE spdlog::spdlog bpftime_llvm_jit_vm
${LIBBPF_LIBRARIES}
elf
z
Expand Down
Loading

0 comments on commit 7720ea9

Please sign in to comment.