From 21ab58d3f8782e80145f14eb6e72926c9d17afc6 Mon Sep 17 00:00:00 2001 From: Fred Baksik Date: Tue, 8 Jan 2019 23:52:12 -0500 Subject: GHS: Update test suite -- Allow for testing default toolset settings If CMake_TEST_GreenHillsMULTI_config is not defined then just run the GHS tests using defaults. -- Handle paths that contain spaces -- Update test suite to use "-non_shared" linker option Fixes linking issue if GHS is not shipped with shared libraries -- Other minor cleanup --- Source/cmGhsMultiTargetGenerator.cxx | 1 + Tests/CMakeLists.txt | 103 +++++++++++++-------- .../GhsMultiCompilerOptions/CMakeLists.txt.in | 28 +++--- .../CMakeLists.txt | 4 +- Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt | 4 + .../GhsMultiIntegrityDD/CMakeLists.txt | 2 + .../GhsMultiIntegrityMonolith/CMakeLists.txt | 2 + Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt | 16 ++-- Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in | 38 +++++--- .../GhsMultiLinkTestSub/sub_exe/CMakeLists.txt | 3 + .../GhsMultiMultipleProjects/CMakeLists.txt | 4 + .../GhsMulti/GhsMultiMultipleProjects/verify.cmake | 10 +- .../GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt | 3 + Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt | 4 + Tests/GhsMulti/GhsMultiPlatform/file1.c | 4 +- .../GhsMulti/GhsMultiRenameInstall/CMakeLists.txt | 40 ++++---- Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt | 3 + Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule | 2 +- Tests/GhsMulti/GhsMultiSrcGroups/object.o | 2 +- Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf | 1 - 20 files changed, 170 insertions(+), 104 deletions(-) diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 4588901..19605e4 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -532,6 +532,7 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( } } } + void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout) { // This only applies to INTEGRITY Applications diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 87bd27e..d78811d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2260,11 +2260,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() if (CMake_TEST_GreenHillsMULTI) - macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts test_cmd) - separate_arguments(_build_opts UNIX_COMMAND ${build_opts}) - separate_arguments(_test_cmd UNIX_COMMAND ${test_cmd}) + 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}) - add_test(NAME GhsMulti.${ghs_config_name}.${test_name} + 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/GhsMulti/${test_dir}" @@ -2273,51 +2280,71 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-project test --build-config $ --build-options ${ghs_target_arch} ${ghs_toolset_name} ${ghs_toolset_root} ${ghs_target_platform} - ${ghs_os_root} ${ghs_os_dir} ${ghs_bsp_name} ${_build_opts} ${_ghs_toolset_extra} - --test-command ${_test_cmd} + ${ghs_os_root} ${ghs_os_dir} ${ghs_bsp_name} ${_ghs_build_opts} ${_ghs_toolset_extra} + ${_ghs_test_command} ) - endmacro () + 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 () + "-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(IS_ABSOLUTE ${ghs_file}) - include(${ghs_file}) - else() - include(${CMAKE_BINARY_DIR}/${ghs_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(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 "" "" "") - set_tests_properties(GhsMulti.${ghs_config_name}.unsupported_targets PROPERTIES TIMEOUT 15) - add_test_GhsMulti(object_library GhsMultiObjectLibrary "" "" "") - set_tests_properties(GhsMulti.${ghs_config_name}.object_library PROPERTIES TIMEOUT 15) + 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 "" "" "") - set_tests_properties(GhsMulti.${ghs_config_name}.interface PROPERTIES TIMEOUT 15) - 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 "" "" "") + ${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 "" "" "") + ${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) @@ -2329,8 +2356,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release unset(ghs_target_platform) unset(ghs_bsp_name) unset(ghs_toolset_extra) - endforeach(ghs_file) - endif () + endforeach() + endif() if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") macro(add_test_VSNsightTegra name generator) diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in index d425631..fc24d90 100644 --- a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in @@ -5,24 +5,28 @@ 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) + #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") + #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(K1 test.c) -add_executable(K2 test.c) -target_compile_options(K2 PRIVATE -kernel) + 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(K3 test.c) + target_compile_options(K3 PRIVATE -kernel=fast) -add_executable(K4 test.c) -target_link_options(K4 PRIVATE -kernel) + add_executable(K4 test.c) + target_link_options(K4 PRIVATE -kernel) endif() diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt index 520e65f..a1f152f 100644 --- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt @@ -12,6 +12,6 @@ add_library(libdemo 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/GhsMulti/GhsMultiExclude/CMakeLists.txt b/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt index 329cb3f..0448cf2 100644 --- a/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt @@ -5,6 +5,10 @@ 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 ) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt index 3d0642d..d4cbf04 100644 --- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt @@ -5,6 +5,8 @@ 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) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt index 741fece..c5db155 100644 --- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) +add_link_options("-non_shared") + project(test C) # create virtual AS diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt index dfb72ce..da80b51 100644 --- a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt @@ -37,7 +37,7 @@ if (RUN_TEST STREQUAL "NO_FLAGS") endif() else() unset(fileName CACHE) - find_file (fileName exe1.gpj + find_file(fileName exe1.gpj ${CMAKE_CURRENT_BINARY_DIR}/link_build ${CMAKE_CURRENT_BINARY_DIR}/link_build/exe1 ) @@ -50,12 +50,12 @@ else() -lcsl1 csl2 -clinkexe1 -clinkexe2 -special-lib2-public-link) - foreach( opt IN LISTS expected_flags ) + 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(opt) + endforeach() unset(fileName CACHE) find_file (fileName lib1.gpj @@ -67,12 +67,12 @@ else() set(expected_flags -clinkexeA1 -clinkexeA2 -static-lib-flags1 -static-lib-flags2) - foreach( opt IN LISTS expected_flags ) + foreach(opt IN LISTS expected_flags) string(FIND "${fileText}" "${opt}" opt_found) - if ( opt_found EQUAL -1 ) + if (opt_found EQUAL -1) message(SEND_ERROR "Could not find: ${opt}") endif() - endforeach(opt) + endforeach() unset(fileName CACHE) find_file (fileName lib2.gpj @@ -83,10 +83,10 @@ else() file(STRINGS ${fileName} fileText) set(expected_flags -clinkexeA1 -clinkexeA2) - foreach( opt IN LISTS expected_flags ) + 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(opt) + endforeach() endif() diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in index 4cf86a2..58c2115 100644 --- a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in +++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in @@ -5,31 +5,39 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(test C) -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") +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) + +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") +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") + +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) + +if(RUN_TEST STREQUAL "CHECK_FLAGS") + target_link_options(lib2 PUBLIC -special-lib2-public-link) endif() diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt index 55f693d..f49e33d 100644 --- a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt @@ -7,3 +7,6 @@ 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/GhsMultiMultipleProjects/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt index d01c4d2..9e077a9 100644 --- a/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt @@ -5,6 +5,10 @@ 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) diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake b/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake index e00cbb3..3855215 100644 --- a/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake @@ -3,13 +3,13 @@ #test project was generated unset(fileName CACHE) -find_file (fileName lib3.gpj +find_file(fileName lib3.gpj ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/lib3 ${CMAKE_CURRENT_BINARY_DIR}/examples ) -if ( fileName ) +if (fileName) message("Found target lib3: ${fileName}") else() message(SEND_ERROR "Could not find target lib3: ${fileName}") @@ -23,7 +23,7 @@ find_file (fileName exe3.gpj ${CMAKE_CURRENT_BINARY_DIR}/examples ) -if ( fileName ) +if (fileName) message("Found target exe3: ${fileName}") else() message(SEND_ERROR "Could not find target exe3: ${fileName}") @@ -37,7 +37,7 @@ find_file (fileName lib3.a ${CMAKE_CURRENT_BINARY_DIR}/examples ) -if ( fileName ) +if (fileName) message(SEND_ERROR "Found target lib3: ${fileName}") else() message("Could not find target lib3: ${fileName}") @@ -51,7 +51,7 @@ find_file (fileName NAMES exe3.as exe3 ${CMAKE_CURRENT_BINARY_DIR}/examples ) -if ( fileName ) +if (fileName) message(SEND_ERROR "Found target exe3: ${fileName}") else() message("Could not find target exe3: ${fileName}") diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt b/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt index 7fe91bc..a025814 100644 --- a/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt @@ -8,3 +8,6 @@ project(test C) add_library(obj1 OBJECT testObj.c testObj.h sub/testObj.c testObj2.c) add_executable(exe1 exe.c $) +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + target_link_options(exe1 PRIVATE "-non_shared") +endif() diff --git a/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt b/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt index 222aa17..b177887 100644 --- a/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt @@ -5,9 +5,12 @@ 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}") @@ -16,6 +19,7 @@ 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}") diff --git a/Tests/GhsMulti/GhsMultiPlatform/file1.c b/Tests/GhsMulti/GhsMultiPlatform/file1.c index 6f7c837..4132aa4 100644 --- a/Tests/GhsMulti/GhsMultiPlatform/file1.c +++ b/Tests/GhsMulti/GhsMultiPlatform/file1.c @@ -1,6 +1,4 @@ -#include - int main(void) { - printf("Testing...\n"); + return -42; } diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt index f10b2f0..f5792b4 100644 --- a/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt @@ -7,29 +7,33 @@ project(test C) set(targets_to_install "") -if( RUN_TEST STREQUAL "SINGLE_EXEC" ) -add_executable(exe1 exe.c) -set(targets_to_install ${targets_to_install} exe1) +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") 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_$) -set_property(TARGET exe1 PROPERTY OUTPUT_NAME ${name}_$) -set_property(TARGET exe1 PROPERTY SUFFIX .bin) -set(targets_to_install ${targets_to_install} exe1) +if(RUN_TEST STREQUAL "SINGLE_EXEC") + add_executable(exe1 exe.c) + 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-$) -set_property(TARGET lib1 PROPERTY SUFFIX .LL) -set_property(TARGET lib1 PROPERTY OUTPUT_NAME lib1_$) +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_$) + set_property(TARGET exe1 PROPERTY OUTPUT_NAME ${name}_$) + 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-$) + set_property(TARGET lib1 PROPERTY SUFFIX .LL) + set_property(TARGET lib1 PROPERTY OUTPUT_NAME lib1_$) -add_executable(exe1 exe1.c) -target_link_libraries(exe1 lib1) -set(targets_to_install ${targets_to_install} exe1 lib1) + 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} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt index a4f84ca..93a1afc 100644 --- a/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt @@ -35,6 +35,9 @@ add_executable(groups 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 ) diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule b/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule index 8b13789..c6cac69 100644 --- a/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule +++ b/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule @@ -1 +1 @@ - +empty diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/object.o b/Tests/GhsMulti/GhsMultiSrcGroups/object.o index 8b13789..c6cac69 100644 --- a/Tests/GhsMulti/GhsMultiSrcGroups/object.o +++ b/Tests/GhsMulti/GhsMultiSrcGroups/object.o @@ -1 +1 @@ - +empty diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf b/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf index 8b13789..e69de29 100644 --- a/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf +++ b/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf @@ -1 +0,0 @@ - -- cgit v0.12