diff options
author | Brad King <brad.king@kitware.com> | 2019-01-18 11:58:23 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-18 11:58:35 (GMT) |
commit | 65a3abf999b30117447c2e62581fbcaec56aadd9 (patch) | |
tree | de9fc205fbcd9bf0fba74c82752a45bff4024bf9 /Tests | |
parent | 2e7d4029f42430ac7339d15ae7b6f849b0f7e429 (diff) | |
parent | 21ab58d3f8782e80145f14eb6e72926c9d17afc6 (diff) | |
download | CMake-65a3abf999b30117447c2e62581fbcaec56aadd9.zip CMake-65a3abf999b30117447c2e62581fbcaec56aadd9.tar.gz CMake-65a3abf999b30117447c2e62581fbcaec56aadd9.tar.bz2 |
Merge topic 'GHS_updates'
21ab58d3f8 GHS: Update test suite
72e0c115b7 GHS: Add Compiler ID detection
436cc5e991 GHS: try_compile() now uses GHS platform variables
4a1ec0de3d GHS: Fix toolset selection
1a66acdef2 GHS: Append ".gpj" to target name when generating build command
0c9e47d7cd GHS: Integrity Application updates
8044318431 GHS: Add support for some of the source file properties
73092b2213 GHS: Add support for object libraries
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2231
Diffstat (limited to 'Tests')
108 files changed, 1087 insertions, 71 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6b166d6..d78811d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2260,32 +2260,104 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() if (CMake_TEST_GreenHillsMULTI) - macro(add_test_GhsMulti name primaryTarget bspName) - add_test(NAME GhsMulti.${name} COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/GhsMulti" - "${CMake_BINARY_DIR}/Tests/GhsMulti/${name}" - --build-generator "Green Hills MULTI" - --build-project ReturnNum - --build-config $<CONFIGURATION> - --build-options -DGHS_PRIMARY_TARGET=${primaryTarget} - -DGHS_BSP_NAME=${bspName} - ) - endmacro () - add_test_GhsMulti("arm_integrity_simarm" "arm_integrity.tgt" "simarm") - add_test_GhsMulti("arm64_integrity_simarm" "arm64_integrity.tgt" "simarm") - add_test(NAME GhsMulti.duplicate_source_filenames + macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts) + separate_arguments(_ghs_build_opts UNIX_COMMAND ${build_opts}) + separate_arguments(_ghs_toolset_extra UNIX_COMMAND ${ghs_toolset_extra}) + if(${ARGC} GREATER 4) + set(_ghs_test_command --test-command ${ARGN}) + endif() + if(ghs_config_name STREQUAL "__default__") + set(_ghs_test_name "${test_name}") + else() + set(_ghs_test_name "${ghs_config_name}.${test_name}") + endif() + add_test(NAME GhsMulti.${_ghs_test_name} COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test - "${CMake_SOURCE_DIR}/Tests/GhsMultiDuplicateSourceFilenames" - "${CMake_BINARY_DIR}/Tests/GhsMultiDuplicateSourceFilenames" + "${CMake_SOURCE_DIR}/Tests/GhsMulti/${test_dir}" + "${CMake_BINARY_DIR}/Tests/GhsMulti/${ghs_config_name}/${test_dir}/${bin_sub_dir}" --build-generator "Green Hills MULTI" - --build-project ReturnNum + --build-project test --build-config $<CONFIGURATION> - --build-options -DGHS_PRIMARY_TARGET=arm_integrity.tgt - -DGHS_BSP_NAME="simarm" + --build-options ${ghs_target_arch} ${ghs_toolset_name} ${ghs_toolset_root} ${ghs_target_platform} + ${ghs_os_root} ${ghs_os_dir} ${ghs_bsp_name} ${_ghs_build_opts} ${_ghs_toolset_extra} + ${_ghs_test_command} ) - endif () + unset(_ghs_build_opts) + unset(_ghs_toolset_extra) + unset(_ghs_test_command) + unset(_ghs_test_name) + endmacro() + macro(add_test_GhsMulti_rename_install test_name) + add_test_GhsMulti( ${test_name} GhsMultiRenameInstall ${test_name} + "-DCMAKE_INSTALL_PREFIX=. -DRUN_TEST=${test_name}" ${CMAKE_CMAKE_COMMAND} -P ./cmake_install.cmake) + endmacro() + #unset ghs config variables + unset(ghs_config_name) + unset(ghs_target_arch) + unset(ghs_toolset_root) + unset(ghs_toolset_name) + unset(ghs_os_root) + unset(ghs_os_dir) + unset(ghs_target_platform) + unset(ghs_bsp_name) + unset(ghs_toolset_extra) + if(NOT CMake_TEST_GreenHillsMULTI_config) + #if list of config settings not defined then just run once as default + set(CMake_TEST_GreenHillsMULTI_config "__default__") + endif() + foreach(ghs_file IN LISTS CMake_TEST_GreenHillsMULTI_config) + # source GHS tools config file + if(NOT ghs_file STREQUAL "__default__") + if(IS_ABSOLUTE ${ghs_file}) + include(${ghs_file}) + else() + include(${CMAKE_BINARY_DIR}/${ghs_file}) + endif() + endif() + if(NOT ghs_config_name) + set(ghs_config_name "__default__") + endif() + # test integrity build + if (NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity")) + add_test_GhsMulti(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "") + add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "") + add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "") + endif() + add_test_GhsMulti(duplicate_source_filenames GhsMultiDuplicateSourceFilenames "" "") + add_test_GhsMulti_rename_install(SINGLE_EXEC) + add_test_GhsMulti_rename_install(SINGLE_EXEC_RENAMED) + add_test_GhsMulti_rename_install(EXEC_AND_LIB) + add_test_GhsMulti(multiple_source_groups GhsMultiSrcGroups Default "") + add_test_GhsMulti(multiple_source_groups_folders GhsMultiSrcGroups PropFolders "-DTEST_PROP=ON") + add_test_GhsMulti(multiple_source_groups_all_folders GhsMultiSrcGroups AllFolders "-DGHS_NO_SOURCE_GROUP_FILE=ON") + add_test_GhsMulti(unsupported_targets GhsMultiUnsupportedTargets "" "") + add_test_GhsMulti(object_library GhsMultiObjectLibrary "" "") + add_test_GhsMulti(exclude GhsMultiExclude "" "" + ${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiExclude/verify.cmake) + add_test_GhsMulti(interface GhsMultiInterface "" "") + add_test_GhsMulti(transitive_link_test GhsMultiLinkTest TransitiveLink "-DRUN_TEST=NO_FLAGS") + add_test_GhsMulti(flags_link_test GhsMultiLinkTest FlagsCheck "-DRUN_TEST=CHECK_FLAGS") + add_test_GhsMulti(sub_link_test GhsMultiLinkTestSub "" "") + add_test_GhsMulti(multiple_projects GhsMultiMultipleProjects "" "" + ${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake) + add_test_GhsMulti(compiler_options_none GhsMultiCompilerOptions None "-DRUN_TEST=RELEASE_FLAGS -DRUN_TEST_BUILD_TYPE=\"\"") + add_test_GhsMulti(compiler_options_kernel GhsMultiCompilerOptions Kernel "-DRUN_TEST=KERNEL_FLAGS -DRUN_TEST_BUILD_TYPE=DEBUG") + add_test_GhsMulti(try_compile_copy GhsMultiCopyFile "" "") + add_test_GhsMulti(ghs_platform GhsMultiPlatform "" "") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GhsMulti/${ghs_config_name}") + #unset ghs config variables + unset(ghs_config_name) + unset(ghs_target_arch) + unset(ghs_toolset_root) + unset(ghs_toolset_name) + unset(ghs_os_root) + unset(ghs_os_dir) + unset(ghs_target_platform) + unset(ghs_bsp_name) + unset(ghs_toolset_extra) + endforeach() + endif() if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") macro(add_test_VSNsightTegra name generator) diff --git a/Tests/GhsMulti/CMakeLists.txt b/Tests/GhsMulti/CMakeLists.txt deleted file mode 100644 index 6e15ba9..0000000 --- a/Tests/GhsMulti/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(ReturnNum) - -add_subdirectory(ReturnNum) diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt new file mode 100644 index 0000000..4a3f5c2 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt @@ -0,0 +1,92 @@ +# 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) + +message("Copy project") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/src/CMakeLists.txt COPYONLY) + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test.c + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src +) + +message("Building project") +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +try_compile(RESULT + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/src + test + CMAKE_FLAGS + -DRUN_TEST=${RUN_TEST} + -DCMAKE_BUILD_TYPE=${RUN_TEST_BUILD_TYPE} + OUTPUT_VARIABLE OUTPUT) + +message("Output from build:\n${OUTPUT}") +if (RUN_TEST STREQUAL "RELEASE_FLAGS") + find_file (fileName test_none.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/test_none + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-unexpected_release_option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( NOT opt_found EQUAL -1 ) + message(SEND_ERROR "Release option found: ${opt}") + endif() +else() + unset(fileName CACHE) + find_file (fileName K1.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K1 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() + + unset(fileName CACHE) + find_file (fileName K2.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K2 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() + + unset(fileName CACHE) + find_file (fileName K3.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K3 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() + + unset(fileName CACHE) + find_file (fileName K4.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K4 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() +endif() diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in new file mode 100644 index 0000000..fc24d90 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in @@ -0,0 +1,32 @@ +# 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) + +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") +endif() + +if(RUN_TEST STREQUAL "RELEASE_FLAGS") + #RELEASE flags used when CMAKE_BUILD_TYPE is undefined + string(APPEND CMAKE_C_FLAGS_RELEASE " -unexpected_release_option") + add_executable(test_none test.c) +endif() + +if(RUN_TEST STREQUAL "KERNEL_FLAGS") + #DEBUG flag missing when -kernel is added as a compile option + string(APPEND CMAKE_C_FLAGS_DEBUG " -required-debug-option") + + add_executable(K1 test.c) + + add_executable(K2 test.c) + target_compile_options(K2 PRIVATE -kernel) + + add_executable(K3 test.c) + target_compile_options(K3 PRIVATE -kernel=fast) + + add_executable(K4 test.c) + target_link_options(K4 PRIVATE -kernel) +endif() diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/test.c b/Tests/GhsMulti/GhsMultiCompilerOptions/test.c new file mode 100644 index 0000000..95f2e8e --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/test.c @@ -0,0 +1,4 @@ +int main(void) +{ + return -1; +} diff --git a/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt new file mode 100644 index 0000000..d6d007d --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt @@ -0,0 +1,30 @@ +# 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(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +try_compile(RESULT + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_SOURCE_DIR}/test.c + OUTPUT_VARIABLE OUTPUT + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_library" +) + +message(STATUS "Output from build:\n${OUTPUT}") + +if(NOT RESULT) + message(SEND_ERROR "try_compile() failed") +endif() + +if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/test_library") + if (IS_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test_library") + message(SEND_ERROR "library is folder !") + else() + message(STATUS "library seems okay") + endif() +else() + message(SEND_ERROR "library is not found !") +endif() diff --git a/Tests/GhsMulti/GhsMultiCopyFile/test.c b/Tests/GhsMulti/GhsMultiCopyFile/test.c new file mode 100644 index 0000000..5c657b5 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCopyFile/test.c @@ -0,0 +1,4 @@ +int lib(int x) +{ + return -x; +} diff --git a/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt index 82a014b..a1f152f 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt @@ -1,15 +1,17 @@ cmake_minimum_required(VERSION 3.5) -project(demo C) +project(test C) add_library(libdemo test.c + testCase.c subfolder_test.c subfolder_test_0.c "subfolder/test.c" + subfolder/testcase.c ) add_executable(demo main.c) target_link_libraries(demo libdemo) -if(GHSMULTI) - target_compile_options(demo PUBLIC "-non_shared") +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + target_link_options(demo PRIVATE "-non_shared") endif() diff --git a/Tests/GhsMultiDuplicateSourceFilenames/main.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/main.c index d5b7914..d4ef7bb 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/main.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/main.c @@ -2,6 +2,8 @@ int test_a(void); int test_b(void); int test_c(void); int test_d(void); +int test_e(void); +int test_f(void); int main(int argc, char* argv[]) { @@ -9,5 +11,7 @@ int main(int argc, char* argv[]) test_b(); test_c(); test_d(); + test_e(); + test_f(); return 0; } diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c index e1e1759..5d857dd 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c @@ -1,4 +1,3 @@ - int test_b() { return 2; diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c new file mode 100644 index 0000000..66ee6f3 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c @@ -0,0 +1,4 @@ +int test_f() +{ + return 1; +} diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c index c552e6a..83589ba 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c @@ -1,4 +1,3 @@ - int test_c() { return 1; diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c index 170b33d..82f9a52 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c @@ -1,4 +1,3 @@ - int test_d() { return 1; diff --git a/Tests/GhsMultiDuplicateSourceFilenames/test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c index 5ffcbdf..feba80e 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c @@ -1,4 +1,3 @@ - int test_a() { return 1; diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c new file mode 100644 index 0000000..943c19d --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c @@ -0,0 +1,4 @@ +int test_e() +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt b/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt new file mode 100644 index 0000000..0448cf2 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiExclude/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. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") +endif() + +add_library(lib1 lib1.c) +set_target_properties( lib1 PROPERTIES EXCLUDE_FROM_ALL yes ) + +add_library(lib2 EXCLUDE_FROM_ALL lib1.c) + +add_executable(exe1 exe1.c) diff --git a/Tests/GhsMulti/GhsMultiExclude/exe1.c b/Tests/GhsMulti/GhsMultiExclude/exe1.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/GhsMulti/GhsMultiExclude/exe1.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/GhsMulti/GhsMultiExclude/lib1.c b/Tests/GhsMulti/GhsMultiExclude/lib1.c new file mode 100644 index 0000000..b35e9cc --- /dev/null +++ b/Tests/GhsMulti/GhsMultiExclude/lib1.c @@ -0,0 +1,4 @@ +int func(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiExclude/verify.cmake b/Tests/GhsMulti/GhsMultiExclude/verify.cmake new file mode 100644 index 0000000..0467b5a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiExclude/verify.cmake @@ -0,0 +1,54 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#test project was generated +unset(fileName CACHE) +find_file (fileName lib1.gpj + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib1 + ) + +if (fileName) + message("Found target lib1: ${fileName}") +else() + message(SEND_ERROR "Could not find target lib1: ${fileName}") +endif() + +#test project was built +unset(fileName CACHE) +find_file (fileName lib1.a + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib1 + ) + +if (fileName) + message(SEND_ERROR "Found target lib1: ${fileName}") +else() + message("Could not find target lib1: ${fileName}") +endif() + +#test project was generated +unset(fileName CACHE) +find_file (fileName lib2.gpj + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib2 + ) + +if (fileName) + message("Found target lib2 ${fileName}") +else() + message(SEND_ERROR "Could not find target lib2: ${fileName}") +endif() + +#test project was built +unset(fileName CACHE) +find_file (fileName lib2.a + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib2 + ) + +if (fileName) + message(SEND_ERROR "Found target lib2: ${fileName}") +else() + message("Could not find target lib2: ${fileName}") +endif() diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt new file mode 100644 index 0000000..d4cbf04 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt @@ -0,0 +1,19 @@ +# 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) + +add_link_options("-non_shared") + +# create virtual AS +add_executable(vas exe.c) +target_link_libraries(vas lib) +add_library(lib func.c) + +# create dynamic download INTEGRITY application +add_executable(dynamic) +set_target_properties(dynamic PROPERTIES ghs_integrity_app ON) +target_compile_options(dynamic PRIVATE -dynamic) +add_dependencies(dynamic vas) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/exe.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/exe.c new file mode 100644 index 0000000..29ad70a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/exe.c @@ -0,0 +1,5 @@ +extern int func(void); +int main(void) +{ + return func(); +} diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/func.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/func.c new file mode 100644 index 0000000..b35e9cc --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/func.c @@ -0,0 +1,4 @@ +int func(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/CMakeLists.txt index 2adbd4e..e431217 100644 --- a/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Lib) add_executable(App Main.c) +target_include_directories(App PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../Lib) target_link_libraries(App Lib) target_compile_options(App PUBLIC "-non_shared") diff --git a/Tests/GhsMulti/ReturnNum/App/Main.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/Main.c index db8d658..db8d658 100644 --- a/Tests/GhsMulti/ReturnNum/App/Main.c +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/Main.c diff --git a/Tests/GhsMulti/ReturnNum/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/CMakeLists.txt index 7bcc5f9..92254e6 100644 --- a/Tests/GhsMulti/ReturnNum/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/CMakeLists.txt @@ -1,3 +1,6 @@ +cmake_minimum_required(VERSION 3.1) +project(test) + add_subdirectory(App) add_subdirectory(Int) add_subdirectory(Lib) diff --git a/Tests/GhsMulti/ReturnNum/Int/AppDD.int b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/AppDD.int index 9e22b5e..5035d58 100644 --- a/Tests/GhsMulti/ReturnNum/Int/AppDD.int +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/AppDD.int @@ -7,6 +7,6 @@ Kernel EndKernel AddressSpace App - Filename "App/App.as" + Filename "App/App" Language C EndAddressSpace diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/CMakeLists.txt new file mode 100644 index 0000000..d173c01 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(AppDD AppDD.int) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt new file mode 100644 index 0000000..00e0f59 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt @@ -0,0 +1 @@ +add_library(Lib HelperFun.c HelperFun.h) diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/HelperFun.c index 61922bb..61922bb 100644 --- a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/HelperFun.c diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/HelperFun.h index 00971b0..00971b0 100644 --- a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/HelperFun.h diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt new file mode 100644 index 0000000..c5db155 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt @@ -0,0 +1,20 @@ +# 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_link_options("-non_shared") + +project(test C) + +# create virtual AS +add_executable(vas exe.c) +target_link_libraries(vas lib) +add_library(lib func.c) + +# create kernel +add_executable(kernel kernel.c) +target_link_options(kernel PRIVATE -kernel) + +# create monolith INTEGRITY application +add_executable(monolith test.int) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/exe.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/exe.c new file mode 100644 index 0000000..29ad70a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/exe.c @@ -0,0 +1,5 @@ +extern int func(void); +int main(void) +{ + return func(); +} diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/func.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/func.c new file mode 100644 index 0000000..c302418 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/func.c @@ -0,0 +1,5 @@ + +int func(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c new file mode 100644 index 0000000..d1bce33 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c @@ -0,0 +1,15 @@ +#include "INTEGRITY.h" +#include "boottable.h" + +void main() +{ + Exit(0); +} + +/* This global table will be filled in during the Integrate phase with */ +/* information about the AddressSpaces, Tasks, and Objects that are to be */ +/* created. If you do not plan to use Integrate, you may omit this file from + */ +/* the kernel, and the boot table code will then not be included. */ + +GlobalTable TheGlobalTable = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int new file mode 100644 index 0000000..361793a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int @@ -0,0 +1,8 @@ +Kernel + Filename kernel +EndKernel + +AddressSpace App + Filename vas + Language C +EndAddressSpace diff --git a/Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt b/Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt new file mode 100644 index 0000000..fa0dce0 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt @@ -0,0 +1,8 @@ +# 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) + +add_library(iface INTERFACE) diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt new file mode 100644 index 0000000..da80b51 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt @@ -0,0 +1,92 @@ +# 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) + +message("Copy project") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/link_src/CMakeLists.txt COPYONLY) + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/exe1.c + ${CMAKE_CURRENT_SOURCE_DIR}/exe1.h + ${CMAKE_CURRENT_SOURCE_DIR}/func2.c + ${CMAKE_CURRENT_SOURCE_DIR}/func3.c + ${CMAKE_CURRENT_SOURCE_DIR}/func4.c + ${CMAKE_CURRENT_SOURCE_DIR}/func5.c + ${CMAKE_CURRENT_SOURCE_DIR}/func6.c + ${CMAKE_CURRENT_SOURCE_DIR}/func7.c + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/link_src +) + +message("Building project") +try_compile(RESULT + ${CMAKE_CURRENT_BINARY_DIR}/link_build + ${CMAKE_CURRENT_BINARY_DIR}/link_src + test + CMAKE_FLAGS + -DRUN_TEST=${RUN_TEST} + -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} + OUTPUT_VARIABLE OUTPUT) + +message("Output from build:\n${OUTPUT}") +if (RUN_TEST STREQUAL "NO_FLAGS") + if(NOT RESULT) + message(SEND_ERROR "Could not build test project (1)!") + endif() +else() + unset(fileName CACHE) + find_file(fileName exe1.gpj + ${CMAKE_CURRENT_BINARY_DIR}/link_build + ${CMAKE_CURRENT_BINARY_DIR}/link_build/exe1 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(expected_flags + -add-link-options1 -add-link-options2 + link_directories_used1 link_directories_used2 "c:/absolute" + link_libraries_used1 link_libraries_used2 + -lcsl1 csl2 + -clinkexe1 -clinkexe2 + -special-lib2-public-link) + foreach(opt IN LISTS expected_flags) + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Could not find: ${opt}") + endif() + endforeach() + + unset(fileName CACHE) + find_file (fileName lib1.gpj + ${CMAKE_CURRENT_BINARY_DIR}/link_build + ${CMAKE_CURRENT_BINARY_DIR}/link_build/lib1 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(expected_flags + -clinkexeA1 -clinkexeA2 + -static-lib-flags1 -static-lib-flags2) + foreach(opt IN LISTS expected_flags) + string(FIND "${fileText}" "${opt}" opt_found) + if (opt_found EQUAL -1) + message(SEND_ERROR "Could not find: ${opt}") + endif() + endforeach() + + unset(fileName CACHE) + find_file (fileName lib2.gpj + ${CMAKE_CURRENT_BINARY_DIR}/link_build + ${CMAKE_CURRENT_BINARY_DIR}/link_build/lib2 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(expected_flags + -clinkexeA1 -clinkexeA2) + foreach(opt IN LISTS expected_flags) + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Could not find: ${opt}") + endif() + endforeach() +endif() diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in new file mode 100644 index 0000000..58c2115 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in @@ -0,0 +1,43 @@ +# 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) + +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") +endif() + +if(RUN_TEST STREQUAL "CHECK_FLAGS") + add_link_options(-add-link-options1 -add-link-options2) + link_directories(link_directories_used1 link_directories_used2 "c:/absolute") + link_libraries(link_libraries_used1 link_libraries_used2 ) + set( CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lcsl1 csl2" ) + set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -clinkexe1 -clinkexe2") +endif() + +add_executable(exe1 exe1.c) +target_link_libraries(exe1 lib1) + +if(RUN_TEST STREQUAL "CHECK_FLAGS") + set_property(TARGET exe1 APPEND_STRING PROPERTY LINK_FLAGS "--link-flag-prop1 --link-flag-prop2") + set_property(TARGET exe1 APPEND PROPERTY LINK_OPTIONS --link-opt-prop1 --link-opt-prop2) +endif() + +if(RUN_TEST STREQUAL "CHECK_FLAGS") + set(CMAKE_STATIC_LINKER_FLAGS ${CMAKE_STATIC_LINKER_FLAGS} "-clinkexeA1 -clinkexeA2") +endif() + +add_library(lib1 STATIC func2.c func3.c func4.c) +target_link_libraries(lib1 lib2) + +if(RUN_TEST STREQUAL "CHECK_FLAGS") + set_property(TARGET lib1 APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS "-static-lib-flags1 -static-lib-flags2") +endif() + +add_library(lib2 STATIC func5.c func6.c func7.c) + +if(RUN_TEST STREQUAL "CHECK_FLAGS") + target_link_options(lib2 PUBLIC -special-lib2-public-link) +endif() diff --git a/Tests/GhsMulti/GhsMultiLinkTest/exe1.c b/Tests/GhsMulti/GhsMultiLinkTest/exe1.c new file mode 100644 index 0000000..f21c126 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/exe1.c @@ -0,0 +1,6 @@ +#include "exe1.h" + +int main(void) +{ + return func2a() + func3a() + func4a() + func5a() + func6a() + func7a(); +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/exe1.h b/Tests/GhsMulti/GhsMultiLinkTest/exe1.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/exe1.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func2.c b/Tests/GhsMulti/GhsMultiLinkTest/func2.c new file mode 100644 index 0000000..8f66fba --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func2.c @@ -0,0 +1,4 @@ +int func2a(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func3.c b/Tests/GhsMulti/GhsMultiLinkTest/func3.c new file mode 100644 index 0000000..57c7a6f --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func3.c @@ -0,0 +1,4 @@ +int func3a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func4.c b/Tests/GhsMulti/GhsMultiLinkTest/func4.c new file mode 100644 index 0000000..109fd7b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func4.c @@ -0,0 +1,4 @@ +int func4a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func5.c b/Tests/GhsMulti/GhsMultiLinkTest/func5.c new file mode 100644 index 0000000..f28a705 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func5.c @@ -0,0 +1,4 @@ +int func5a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func6.c b/Tests/GhsMulti/GhsMultiLinkTest/func6.c new file mode 100644 index 0000000..bf77406 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func6.c @@ -0,0 +1,4 @@ +int func6a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func7.c b/Tests/GhsMulti/GhsMultiLinkTest/func7.c new file mode 100644 index 0000000..6a4a9a1 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func7.c @@ -0,0 +1,4 @@ +int func7a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt new file mode 100644 index 0000000..145dac0 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt @@ -0,0 +1,9 @@ +# 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) + +add_subdirectory(sub_exe) +add_subdirectory(sub_lib) diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt new file mode 100644 index 0000000..f49e33d --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/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) + +add_executable(exe1 exe1.c) +target_link_libraries(exe1 lib1) +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + target_link_options(exe1 PRIVATE "-non_shared") +endif() diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.c new file mode 100644 index 0000000..f21c126 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.c @@ -0,0 +1,6 @@ +#include "exe1.h" + +int main(void) +{ + return func2a() + func3a() + func4a() + func5a() + func6a() + func7a(); +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.h b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt new file mode 100644 index 0000000..9039730 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt @@ -0,0 +1,7 @@ +# 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 func2.c func3.c func4.c) +target_link_libraries(lib1 lib2) + +add_library(lib2 STATIC func5.c func6.c func7.c) diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func2.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func2.c new file mode 100644 index 0000000..8f66fba --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func2.c @@ -0,0 +1,4 @@ +int func2a(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func3.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func3.c new file mode 100644 index 0000000..57c7a6f --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func3.c @@ -0,0 +1,4 @@ +int func3a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func4.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func4.c new file mode 100644 index 0000000..109fd7b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func4.c @@ -0,0 +1,4 @@ +int func4a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func5.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func5.c new file mode 100644 index 0000000..f28a705 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func5.c @@ -0,0 +1,4 @@ +int func5a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func6.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func6.c new file mode 100644 index 0000000..bf77406 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func6.c @@ -0,0 +1,4 @@ +int func6a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func7.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func7.c new file mode 100644 index 0000000..6a4a9a1 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func7.c @@ -0,0 +1,4 @@ +int func7a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt new file mode 100644 index 0000000..9e077a9 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/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. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") +endif() + +add_library(lib1 lib1.c) +add_executable(exe1 exe1.c) +target_link_libraries(exe1 lib1) + +add_subdirectory(sub) +add_subdirectory(sub2 examples EXCLUDE_FROM_ALL) diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/exe1.c b/Tests/GhsMulti/GhsMultiMultipleProjects/exe1.c new file mode 100644 index 0000000..b9cdd61 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/exe1.c @@ -0,0 +1,5 @@ +extern int lib1_func(void); +int main(void) +{ + return lib1_func(); +} diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/lib1.c b/Tests/GhsMulti/GhsMultiMultipleProjects/lib1.c new file mode 100644 index 0000000..5100945 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/lib1.c @@ -0,0 +1,4 @@ +int lib1_func(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt new file mode 100644 index 0000000..0d83bc3 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt @@ -0,0 +1,10 @@ +# 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(test2 C) + +add_library(lib2 lib2.c) +add_executable(exe2 exe2.c) +target_link_libraries(exe2 lib1 lib2) diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub/exe2.c b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/exe2.c new file mode 100644 index 0000000..9238cf3 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/exe2.c @@ -0,0 +1,6 @@ +extern int func(void); +extern int lib1_func(void); +int main(void) +{ + return func() + lib1_func(); +} diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub/lib2.c b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/lib2.c new file mode 100644 index 0000000..b35e9cc --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/lib2.c @@ -0,0 +1,4 @@ +int func(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt new file mode 100644 index 0000000..e42e7fb --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt @@ -0,0 +1,10 @@ +# 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(test3 C) + +add_library(lib3 lib3.c) +add_executable(exe3 exe3.c) +target_link_libraries(exe3 lib1 lib3) diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/exe3.c b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/exe3.c new file mode 100644 index 0000000..9238cf3 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/exe3.c @@ -0,0 +1,6 @@ +extern int func(void); +extern int lib1_func(void); +int main(void) +{ + return func() + lib1_func(); +} diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/lib3.c b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/lib3.c new file mode 100644 index 0000000..b35e9cc --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/lib3.c @@ -0,0 +1,4 @@ +int func(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake b/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake new file mode 100644 index 0000000..3855215 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake @@ -0,0 +1,58 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#test project was generated +unset(fileName CACHE) +find_file(fileName lib3.gpj + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib3 + ${CMAKE_CURRENT_BINARY_DIR}/examples + ) + +if (fileName) + message("Found target lib3: ${fileName}") +else() + message(SEND_ERROR "Could not find target lib3: ${fileName}") +endif() + +#test project was generated +unset(fileName CACHE) +find_file (fileName exe3.gpj + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/exe3 + ${CMAKE_CURRENT_BINARY_DIR}/examples + ) + +if (fileName) + message("Found target exe3: ${fileName}") +else() + message(SEND_ERROR "Could not find target exe3: ${fileName}") +endif() + +#test project was not built +unset(fileName CACHE) +find_file (fileName lib3.a + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib3 + ${CMAKE_CURRENT_BINARY_DIR}/examples + ) + +if (fileName) + message(SEND_ERROR "Found target lib3: ${fileName}") +else() + message("Could not find target lib3: ${fileName}") +endif() + +unset(fileName CACHE) +find_file (fileName NAMES exe3.as exe3 + HINTS + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/exe3 + ${CMAKE_CURRENT_BINARY_DIR}/examples + ) + +if (fileName) + message(SEND_ERROR "Found target exe3: ${fileName}") +else() + message("Could not find target exe3: ${fileName}") +endif() diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt b/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt new file mode 100644 index 0000000..a025814 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt @@ -0,0 +1,13 @@ +# 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) + +add_library(obj1 OBJECT testObj.c testObj.h sub/testObj.c testObj2.c) + +add_executable(exe1 exe.c $<TARGET_OBJECTS:obj1>) +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + target_link_options(exe1 PRIVATE "-non_shared") +endif() diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/exe.c b/Tests/GhsMulti/GhsMultiObjectLibrary/exe.c new file mode 100644 index 0000000..c2c5a19 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/exe.c @@ -0,0 +1,8 @@ +extern int funcOBJ(void); +extern int funcOBJ2(void); +extern int funcOBJs(void); + +int main(void) +{ + return funcOBJ() + funcOBJ2() + funcOBJs(); +} diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/sub/testOBJ.c b/Tests/GhsMulti/GhsMultiObjectLibrary/sub/testOBJ.c new file mode 100644 index 0000000..5228ef2 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/sub/testOBJ.c @@ -0,0 +1,4 @@ +int funcOBJs(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.c b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.c new file mode 100644 index 0000000..ec6f2c3 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.c @@ -0,0 +1,4 @@ +int funcOBJ(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.h b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.h new file mode 100644 index 0000000..9aef431 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.h @@ -0,0 +1 @@ +extern int funcOBJ(void); diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ2.c b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ2.c new file mode 100644 index 0000000..b6a9b93 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ2.c @@ -0,0 +1,4 @@ +int funcOBJ2(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt b/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt new file mode 100644 index 0000000..b177887 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt @@ -0,0 +1,34 @@ +# 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) + +message("PLATFORM_ID = ${PLATFORM_ID}") + +message("CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}") +message("CMAKE_C_COMPILER_ID = ${CMAKE_C_COMPILER_ID}") +message("CMAKE_C_COMPILER_VERSION = ${CMAKE_C_COMPILER_VERSION}") +message("CMAKE_C_COMPILER_VERSION_INTERNAL = ${CMAKE_C_COMPILER_VERSION_INTERNAL}") +message("CMAKE_C_PLATFORM_ID = ${CMAKE_C_PLATFORM_ID}") +message("CMAKE_C_COMPILER_ARCHITECTURE_ID = ${CMAKE_C_COMPILER_ARCHITECTURE_ID}") +message("CMAKE_C_COMPILER_ABI = ${CMAKE_C_COMPILER_ABI}") +message("CMAKE_C_STANDARD_COMPUTED_DEFAULT = ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}") + +message("CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}") +message("CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}") +message("CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}") +message("CMAKE_CXX_COMPILER_VERSION_INTERNAL = ${CMAKE_CXX_COMPILER_VERSION_INTERNAL}") +message("CMAKE_CXX_PLATFORM_ID = ${CMAKE_CXX_PLATFORM_ID}") +message("CMAKE_CXX_COMPILER_ARCHITECTURE_ID = ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}") +message("CMAKE_CXX_COMPILER_ABI = ${CMAKE_CXX_COMPILER_ABI}") +message("CMAKE_CXX_STANDARD_COMPUTED_DEFAULT = ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}") + +if(CMAKE_C_COMPILER AND NOT CMAKE_C_COMPILER_ID STREQUAL "GHS") + message(FATAL_ERROR "CMAKE_C_COMPILER_ID != GHS") +endif() + +if(CMAKE_CXX_COMPILER AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "GHS") + message(FATAL_ERROR "CMAKE_CXX_COMPILER_ID != GHS") +endif() diff --git a/Tests/GhsMulti/GhsMultiPlatform/file1.c b/Tests/GhsMulti/GhsMultiPlatform/file1.c new file mode 100644 index 0000000..4132aa4 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiPlatform/file1.c @@ -0,0 +1,4 @@ +int main(void) +{ + return -42; +} diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt new file mode 100644 index 0000000..f5792b4 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt @@ -0,0 +1,42 @@ +# 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(targets_to_install "") + +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") +endif() + +if(RUN_TEST STREQUAL "SINGLE_EXEC") + add_executable(exe1 exe.c) + set(targets_to_install ${targets_to_install} exe1) +endif() + +if(RUN_TEST STREQUAL "SINGLE_EXEC_RENAMED") + set(name new_name) + add_executable(exe1 exe.c) + set_property(TARGET exe1 PROPERTY RUNTIME_OUTPUT_DIRECTORY ${name}_bin_$<CONFIG>) + set_property(TARGET exe1 PROPERTY OUTPUT_NAME ${name}_$<CONFIG>) + set_property(TARGET exe1 PROPERTY SUFFIX .bin) + set(targets_to_install ${targets_to_install} exe1) +endif() + +if(RUN_TEST STREQUAL "EXEC_AND_LIB") + add_library(lib1 lib1.c) + set_property(TARGET lib1 PROPERTY ARCHIVE_OUTPUT_DIRECTORY forced-$<CONFIG>) + set_property(TARGET lib1 PROPERTY SUFFIX .LL) + set_property(TARGET lib1 PROPERTY OUTPUT_NAME lib1_$<CONFIG>) + + add_executable(exe1 exe1.c) + target_link_libraries(exe1 lib1) + set(targets_to_install ${targets_to_install} exe1 lib1) +endif() + +install(TARGETS ${targets_to_install} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static) diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/exe.c b/Tests/GhsMulti/GhsMultiRenameInstall/exe.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/GhsMulti/GhsMultiRenameInstall/exe.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/exe1.c b/Tests/GhsMulti/GhsMultiRenameInstall/exe1.c new file mode 100644 index 0000000..29ad70a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiRenameInstall/exe1.c @@ -0,0 +1,5 @@ +extern int func(void); +int main(void) +{ + return func(); +} diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/lib1.c b/Tests/GhsMulti/GhsMultiRenameInstall/lib1.c new file mode 100644 index 0000000..b35e9cc --- /dev/null +++ b/Tests/GhsMulti/GhsMultiRenameInstall/lib1.c @@ -0,0 +1,4 @@ +int func(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/Atest3.c b/Tests/GhsMulti/GhsMultiSrcGroups/Atest3.c new file mode 100644 index 0000000..9c9c1d9 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/Atest3.c @@ -0,0 +1,4 @@ +int funcA3a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt new file mode 100644 index 0000000..93a1afc --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt @@ -0,0 +1,45 @@ +# 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(CMAKE_FOLDER ON) +add_executable(groups + test1.c + test1.h + test2a.c + test4.c + test5.c + test6.c + test7.c + standard.h + testOBJ.c + testOBJ.h + sub/testOBJ.c + sub/testOBJ.h + textfile.txt + textfile2.txt + test3.c + Atest3.c +# object.o + resource.pdf + cmake.rule + s5.h + s2.h + s4.h + standard.h + ) + +if(TEST_PROP) + set_target_properties(groups PROPERTIES GHS_NO_SOURCE_GROUP_FILE ON) +endif() +if(CMAKE_C_COMPILER_ID MATCHES "GHS") + target_link_options(groups PRIVATE "-non_shared") +endif() +source_group( gC FILES sub/testOBJ.h testOBJ.c testOBJ.h sub/testOBJ.c ) +source_group( gA FILES test1.c test1.h) +source_group( gB test[65].c ) +source_group( gC\\gD FILES test7.c ) +source_group( docs FILES textfile.txt ) diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule b/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule new file mode 100644 index 0000000..c6cac69 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule @@ -0,0 +1 @@ +empty diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/object.o b/Tests/GhsMulti/GhsMultiSrcGroups/object.o new file mode 100644 index 0000000..c6cac69 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/object.o @@ -0,0 +1 @@ +empty diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf b/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/s2.h b/Tests/GhsMulti/GhsMultiSrcGroups/s2.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/s2.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/s4.h b/Tests/GhsMulti/GhsMultiSrcGroups/s4.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/s4.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/s5.h b/Tests/GhsMulti/GhsMultiSrcGroups/s5.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/s5.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/standard.h b/Tests/GhsMulti/GhsMultiSrcGroups/standard.h new file mode 100644 index 0000000..2773a55 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/standard.h @@ -0,0 +1 @@ +#define somthing diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.c b/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.c new file mode 100644 index 0000000..90ea9b9 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.c @@ -0,0 +1,6 @@ +#include "testOBJ.h" + +int funcOBJsub(void) +{ + return func2a() + func3a() + func4a() + func5a() + func6a() + func7a(); +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.h b/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test1.c b/Tests/GhsMulti/GhsMultiSrcGroups/test1.c new file mode 100644 index 0000000..94f818a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test1.c @@ -0,0 +1,6 @@ +#include "test1.h" + +int main(void) +{ + return func2a() + func3a() + func4a() + func5a() + func6a() + func7a(); +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test1.h b/Tests/GhsMulti/GhsMultiSrcGroups/test1.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test1.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test2a.c b/Tests/GhsMulti/GhsMultiSrcGroups/test2a.c new file mode 100644 index 0000000..8f66fba --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test2a.c @@ -0,0 +1,4 @@ +int func2a(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test3.c b/Tests/GhsMulti/GhsMultiSrcGroups/test3.c new file mode 100644 index 0000000..57c7a6f --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test3.c @@ -0,0 +1,4 @@ +int func3a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test3.h b/Tests/GhsMulti/GhsMultiSrcGroups/test3.h new file mode 100644 index 0000000..2773a55 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test3.h @@ -0,0 +1 @@ +#define somthing diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test4.c b/Tests/GhsMulti/GhsMultiSrcGroups/test4.c new file mode 100644 index 0000000..109fd7b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test4.c @@ -0,0 +1,4 @@ +int func4a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test5.c b/Tests/GhsMulti/GhsMultiSrcGroups/test5.c new file mode 100644 index 0000000..f28a705 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test5.c @@ -0,0 +1,4 @@ +int func5a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test6.c b/Tests/GhsMulti/GhsMultiSrcGroups/test6.c new file mode 100644 index 0000000..bf77406 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test6.c @@ -0,0 +1,4 @@ +int func6a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test7.c b/Tests/GhsMulti/GhsMultiSrcGroups/test7.c new file mode 100644 index 0000000..6a4a9a1 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test7.c @@ -0,0 +1,4 @@ +int func7a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.c b/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.c new file mode 100644 index 0000000..e86e2a4 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.c @@ -0,0 +1,11 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); + +int funcOBJ(void) +{ + return func2a() + func3a() + func4a() + func5a() + func6a() + func7a(); +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.h b/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/textfile.txt b/Tests/GhsMulti/GhsMultiSrcGroups/textfile.txt new file mode 100644 index 0000000..48cdce8 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/textfile.txt @@ -0,0 +1 @@ +placeholder diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/textfile2.txt b/Tests/GhsMulti/GhsMultiSrcGroups/textfile2.txt new file mode 100644 index 0000000..48cdce8 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/textfile2.txt @@ -0,0 +1 @@ +placeholder diff --git a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt b/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt new file mode 100644 index 0000000..ed3094b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiUnsupportedTargets/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) + +add_custom_target(testTarget ALL echo this is a test) + +add_library(sharedLib SHARED file.c) + +add_library(moduleLib MODULE file.c) diff --git a/Tests/GhsMulti/GhsMultiUnsupportedTargets/file.c b/Tests/GhsMulti/GhsMultiUnsupportedTargets/file.c new file mode 100644 index 0000000..6a4a9a1 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiUnsupportedTargets/file.c @@ -0,0 +1,4 @@ +int func7a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt deleted file mode 100644 index 44c5de1..0000000 --- a/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_executable(AppDD AppDD.int Default.bsp) diff --git a/Tests/GhsMulti/ReturnNum/Int/Default.bsp b/Tests/GhsMulti/ReturnNum/Int/Default.bsp deleted file mode 100644 index 224ec29..0000000 --- a/Tests/GhsMulti/ReturnNum/Int/Default.bsp +++ /dev/null @@ -1,35 +0,0 @@ -# Target description File for the Integrate utility for use with the -# INTEGRITY real-time operating system by Green Hills Software. -# Before editing this file, refer to your Integrate documentation. -# default.bsp is appropriate for INTEGRITY applications which are -# fully linked with the kernel (for RAM or ROM) or dynamically downloaded. -# -# MinimumAddress must match the value of .ramend in the linker directives -# file used for the KernelSpace program - see default.ld for more info. -# The MaximumAddress used here allows memory mappings to be specified -# for up to the 16 MB mark in RAM. Intex will not permit programs -# that require more memory for its mappings. If the board has less -# memory, this number can be reduced by the user. - -Target - MinimumAddress .ramend - MaximumAddress .ramlimit - Clock StandardTick - EndClock - Clock HighResTimer - EndClock - IODevice "SerialDev0" - InitialKernelObjects 200 - DefaultStartIt false - DefaultMaxPriority 255 - DefaultPriority 127 - DefaultWeight 1 - DefaultMaxWeight 255 - DefaultHeapSize 0x10000 - LastVirtualAddress 0x3fffffff - PageSize 0x1000 - ArchitectedPageSize 0x1000 - ArchitectedPageSize 0x10000 - ArchitectedPageSize 0x100000 - DefaultMemoryRegionSize 0x20000 -EndTarget diff --git a/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt deleted file mode 100644 index 9c822da..0000000 --- a/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library(Lib HelperFun.c HelperFun.h)
\ No newline at end of file |