diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-07-16 02:03:33 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-07-16 02:03:33 +0200 |
commit | b31e4bc16d1df62b50c6f77a77041f9e7b6c906d (patch) | |
tree | 024c74c13d918aa6bde302aab6836fa33607613c /flatcc/test/monster_test_concat | |
parent | ba6815ef8fb8ae472412b5af2837a7caba2799c2 (diff) | |
parent | 5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 (diff) |
Merge commit '5a40295c4cf0af5ea8da9ced04a4ce7d3621a080' as 'flatcc'
Diffstat (limited to 'flatcc/test/monster_test_concat')
-rw-r--r-- | flatcc/test/monster_test_concat/CMakeLists.txt | 21 | ||||
-rw-r--r-- | flatcc/test/monster_test_concat/README.txt | 2 | ||||
-rw-r--r-- | flatcc/test/monster_test_concat/monster_test_concat.c | 24 |
3 files changed, 47 insertions, 0 deletions
diff --git a/flatcc/test/monster_test_concat/CMakeLists.txt b/flatcc/test/monster_test_concat/CMakeLists.txt new file mode 100644 index 0000000..dab13f5 --- /dev/null +++ b/flatcc/test/monster_test_concat/CMakeLists.txt @@ -0,0 +1,21 @@ +include(CTest) + +set(INC_DIR "${PROJECT_SOURCE_DIR}/include") +set(GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") +set(FBS_DIR "${PROJECT_SOURCE_DIR}/test/monster_test") + +include_directories("${GEN_DIR}" "${INC_DIR}") + +add_custom_target(gen_monster_test_concat ALL) +add_custom_command ( + TARGET gen_monster_test_concat + COMMAND ${CMAKE_COMMAND} -E make_directory "${GEN_DIR}" + # We could also use the recursive -r option, but this tests adding files manually to the output file. + COMMAND flatcc_cli -cwv --reader -o "${GEN_DIR}" "--outfile=monster_test.h" "${FBS_DIR}/attributes.fbs" "${FBS_DIR}/include_test2.fbs" "${FBS_DIR}/include_test1.fbs" "${FBS_DIR}/monster_test.fbs" DEPENDS flatcc_cli "${FBS_DIR}/monster_test.fbs" "${FBS_DIR}/include_test1.fbs" "${FBS_DIR}/include_test2.fbs" "${FBS_DIR}/attributes.fbs" +) +include_directories("${GEN_DIR}" "${INC_DIR}") +add_executable(monster_test_concat monster_test_concat.c) +add_dependencies(monster_test_concat gen_monster_test_concat) +target_link_libraries(monster_test_concat flatccrt) + +add_test(monster_test_concat monster_test_concat${CMAKE_EXECUTABLE_SUFFIX}) diff --git a/flatcc/test/monster_test_concat/README.txt b/flatcc/test/monster_test_concat/README.txt new file mode 100644 index 0000000..4924660 --- /dev/null +++ b/flatcc/test/monster_test_concat/README.txt @@ -0,0 +1,2 @@ +This test is identical to monster_test_solo, except for directing output +to a file directly with --outfile. diff --git a/flatcc/test/monster_test_concat/monster_test_concat.c b/flatcc/test/monster_test_concat/monster_test_concat.c new file mode 100644 index 0000000..3005580 --- /dev/null +++ b/flatcc/test/monster_test_concat/monster_test_concat.c @@ -0,0 +1,24 @@ +/* Minimal test with all headers generated into a single file. */ +#include "monster_test.h" + +int main(int argc, char *argv[]) +{ + int ret; + void *buf; + size_t size; + flatcc_builder_t builder, *B; + + (void)argc; + (void)argv; + + B = &builder; + flatcc_builder_init(B); + + MyGame_Example_Monster_start_as_root(B); + MyGame_Example_Monster_name_create_str(B, "MyMonster"); + MyGame_Example_Monster_end_as_root(B); + buf = flatcc_builder_get_direct_buffer(B, &size); + ret = MyGame_Example_Monster_verify_as_root(buf, size); + flatcc_builder_clear(B); + return ret; +} |