Skip to content

Commit

Permalink
Move all ymal related code into test
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <[email protected]>
  • Loading branch information
Alan Jowett committed Oct 20, 2024
1 parent 9f25cee commit 2b9fa51
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install libboost-dev libboost-filesystem-dev libboost-program-options-dev libyaml-cpp-dev valgrind
sudo apt install libboost-dev libboost-filesystem-dev libboost-program-options-dev
- name: Install test dependencies
if: ${{matrix.target == 'tests'}}
run: |
sudo apt install libyaml-cpp-dev valgrind
- uses: actions/checkout@v4
with:
Expand Down
40 changes: 23 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ endif ()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
"${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
find_package(yaml-cpp REQUIRED)
if (VERIFIER_ENABLE_TESTS)
find_package(yaml-cpp REQUIRED)
endif()
find_package(Boost REQUIRED)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -57,22 +59,24 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(Boost_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/packages/boost/lib/native/include)
set(Boost_LIBRARY_DIRS ${CMAKE_BINARY_DIR}/packages/boost_filesystem-vc143/lib/native)

# MSVC's "std:c++20" option is the current standard that supports all the C++17
# features we use. However, cmake can't deal with that here, so we set it below.

set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/packages/yaml-cpp)
include(ExternalProject)
ExternalProject_Add(yaml-cpp
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
GIT_TAG "yaml-cpp-0.7.0"
GIT_SHALLOW true
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DYAML_MSVC_SHARED_RT=ON
-DYAML_CPP_BUILD_TESTS=OFF
-DYAML_CPP_BUILD_TOOLS=OFF
)
set(YAML_CPP_LIBRARIES ${EXTERNAL_INSTALL_LOCATION}/lib/yaml-cpp$<$<CONFIG:DEBUG>:d>.lib)
set(YAML_CPP_INCLUDE_DIR ${EXTERNAL_INSTALL_LOCATION}/include/)
if (VERIFIER_ENABLE_TESTS)
# MSVC's "std:c++20" option is the current standard that supports all the C++17
# features we use. However, cmake can't deal with that here, so we set it below.

set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/packages/yaml-cpp)
include(ExternalProject)
ExternalProject_Add(yaml-cpp
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
GIT_TAG "yaml-cpp-0.7.0"
GIT_SHALLOW true
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DYAML_MSVC_SHARED_RT=ON
-DYAML_CPP_BUILD_TESTS=OFF
-DYAML_CPP_BUILD_TOOLS=OFF
)
set(YAML_CPP_LIBRARIES ${EXTERNAL_INSTALL_LOCATION}/lib/yaml-cpp$<$<CONFIG:DEBUG>:d>.lib)
set(YAML_CPP_INCLUDE_DIR ${EXTERNAL_INSTALL_LOCATION}/include/)
endif()
endif ()

include_directories(./external)
Expand All @@ -97,6 +101,8 @@ file(GLOB LIB_SRC

if(VERIFIER_ENABLE_TESTS)
file(GLOB ALL_TEST
"src/test/ebpf_yaml.hpp"
"src/test/ebpf_yaml.hpp"
"./src/test/test_conformance.cpp"
"./src/test/test_marshal.cpp"
"./src/test/test_print.cpp"
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 2b9fa51

Please sign in to comment.