diff options
Diffstat (limited to 'Tests/GhsMulti/GhsMultiDepOrder')
-rw-r--r-- | Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/GhsMulti/GhsMultiDepOrder/exec/exe1.c | 8 | ||||
-rw-r--r-- | Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/GhsMulti/GhsMultiDepOrder/lib/func1.c | 17 | ||||
-rw-r--r-- | Tests/GhsMulti/GhsMultiDepOrder/lib/lib1.h | 3 | ||||
-rw-r--r-- | Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt | 28 | ||||
-rw-r--r-- | Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.c.in | 16 | ||||
-rw-r--r-- | Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.h.in | 7 |
9 files changed, 119 insertions, 0 deletions
diff --git a/Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt new file mode 100644 index 0000000..2e2871b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt @@ -0,0 +1,12 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +#set_property( GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 1) +add_subdirectory(exec) +add_subdirectory(lib) +add_subdirectory(protolib) +add_dependencies(lib1 proto) diff --git a/Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt new file mode 100644 index 0000000..85ee805 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt @@ -0,0 +1,11 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +add_executable(exe1 exe1.c) +target_link_libraries(exe1 lib1) +target_include_directories(exe1 PRIVATE "${test_BINARY_DIR}") +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + target_link_options(exe1 PRIVATE "-non_shared") +endif() diff --git a/Tests/GhsMulti/GhsMultiDepOrder/exec/exe1.c b/Tests/GhsMulti/GhsMultiDepOrder/exec/exe1.c new file mode 100644 index 0000000..fbf4ed4 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/exec/exe1.c @@ -0,0 +1,8 @@ +#include "lib1.h" +#include "p.h" + +int main(void) +{ + return func1() + func2() + func3() + func1p() + func2p() + func3p() + + PROTO1 + PROTO2 + PROTO3; +} diff --git a/Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt new file mode 100644 index 0000000..ae30fa2 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt @@ -0,0 +1,17 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +add_library(lib1 STATIC + func1.c lib1.h + "${test_BINARY_DIR}/protolib/proto1.c" + "${test_BINARY_DIR}/protolib/proto1.h") +set_source_files_properties( + "${test_BINARY_DIR}/protolib/proto1.c" + "${test_BINARY_DIR}/protolib/proto1.h" + PROPERTIES GENERATED 1) +target_include_directories(lib1 PRIVATE "${test_BINARY_DIR}/protolib" + PUBLIC .) +add_custom_command( TARGET lib1 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${test_BINARY_DIR}/protolib/proto1.h" "${test_BINARY_DIR}/p.h" + COMMENT "Copy ${test_BINARY_DIR}/protolib/proto1.h ${test_BINARY_DIR}/p.h" + BYPRODUCTS "${test_BINARY_DIR}/p.h") diff --git a/Tests/GhsMulti/GhsMultiDepOrder/lib/func1.c b/Tests/GhsMulti/GhsMultiDepOrder/lib/func1.c new file mode 100644 index 0000000..53334fe --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/lib/func1.c @@ -0,0 +1,17 @@ +#include "lib1.h" +#include "proto1.h" + +int func1(void) +{ + return 1 + PROTO1; +} + +int func2(void) +{ + return 2 + PROTO2; +} + +int func3(void) +{ + return 3 + PROTO3; +} diff --git a/Tests/GhsMulti/GhsMultiDepOrder/lib/lib1.h b/Tests/GhsMulti/GhsMultiDepOrder/lib/lib1.h new file mode 100644 index 0000000..5e99f02 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/lib/lib1.h @@ -0,0 +1,3 @@ +extern int func1(void); +extern int func2(void); +extern int func3(void); diff --git a/Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt new file mode 100644 index 0000000..8cb6869 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt @@ -0,0 +1,28 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +add_custom_target(proto ALL + DEPENDS proto1.c + proto1.h + SOURCES + ${test_SOURCE_DIR}/protolib/proto1.c.in + ${test_SOURCE_DIR}/protolib/proto1.h.in + COMMENT "Creating proto files") + +add_custom_command( + OUTPUT proto1.c + COMMAND ${CMAKE_COMMAND} -E copy + ${test_SOURCE_DIR}/protolib/proto1.c.in proto1.c + DEPENDS ${test_SOURCE_DIR}/protolib/proto1.c.in + COMMENT "generate proto C files" +) + +add_custom_command( + OUTPUT proto1.h + COMMAND ${CMAKE_COMMAND} -E copy + ${test_SOURCE_DIR}/protolib/proto1.h.in proto1.h + DEPENDS ${test_SOURCE_DIR}/protolib/proto1.h.in + COMMENT "generate proto H files" +) diff --git a/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.c.in b/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.c.in new file mode 100644 index 0000000..0efb1bd --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.c.in @@ -0,0 +1,16 @@ +#include "proto1.h" + +int func1p(void) +{ + return 1; +} + +int func2p(void) +{ + return 2; +} + +int func3p(void) +{ + return 3; +} diff --git a/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.h.in b/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.h.in new file mode 100644 index 0000000..f2f93af --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.h.in @@ -0,0 +1,7 @@ +extern int func1p(void); +extern int func2p(void); +extern int func3p(void); + +#define PROTO1 0x1 +#define PROTO2 0x2 +#define PROTO3 0x3 |