From 5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sun, 16 Jul 2023 02:03:33 +0200 Subject: Squashed 'flatcc/' content from commit 473da2a git-subtree-dir: flatcc git-subtree-split: 473da2afa5ca435363f8c5e6569167aee6bc31c5 --- test/monster_test_cpp/CMakeLists.txt | 24 ++++++++++++++++++++++++ test/monster_test_cpp/monster_test.cpp | 3 +++ 2 files changed, 27 insertions(+) create mode 100644 test/monster_test_cpp/CMakeLists.txt create mode 100644 test/monster_test_cpp/monster_test.cpp (limited to 'test/monster_test_cpp') diff --git a/test/monster_test_cpp/CMakeLists.txt b/test/monster_test_cpp/CMakeLists.txt new file mode 100644 index 0000000..dd576ca --- /dev/null +++ b/test/monster_test_cpp/CMakeLists.txt @@ -0,0 +1,24 @@ +include(CTest) + +# Note: This re-uses the samples/monster fbs and .c file. + +set(INC_DIR "${PROJECT_SOURCE_DIR}/include") +# We use our own separate gen dir so we don't clash with the real monster sample. +set(GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated/monster_test_cpp") +set(FBS_DIR "${PROJECT_SOURCE_DIR}/samples/monster") + +include_directories("${GEN_DIR}" "${INC_DIR}") + +add_custom_target(gen_monster_test_cpp ALL) +add_custom_command ( + TARGET gen_monster_test_cpp + COMMAND ${CMAKE_COMMAND} -E make_directory "${GEN_DIR}" + COMMAND flatcc_cli -a -o "${GEN_DIR}" "${FBS_DIR}/monster.fbs" + DEPENDS flatcc_cli "${FBS_DIR}/monster.fbs" +) + +add_executable(monster_test_cpp monster_test.cpp) +add_dependencies(monster_test_cpp gen_monster_test_cpp) +target_link_libraries(monster_test_cpp flatccrt) + +add_test(monster_test_cpp monster_test_cpp${CMAKE_EXECUTABLE_SUFFIX}) diff --git a/test/monster_test_cpp/monster_test.cpp b/test/monster_test_cpp/monster_test.cpp new file mode 100644 index 0000000..9a7477a --- /dev/null +++ b/test/monster_test_cpp/monster_test.cpp @@ -0,0 +1,3 @@ +extern "C" { +#include "../../samples/monster/monster.c" +} -- cgit v1.2.3