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
This commit is contained in:
Fred Baksik
2019-01-08 23:52:12 -05:00
parent 72e0c115b7
commit 21ab58d3f8
20 changed files with 170 additions and 104 deletions
+1
View File
@@ -532,6 +532,7 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
} }
} }
} }
void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout) void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout)
{ {
// This only applies to INTEGRITY Applications // This only applies to INTEGRITY Applications
+65 -38
View File
@@ -2260,11 +2260,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif() endif()
if (CMake_TEST_GreenHillsMULTI) if (CMake_TEST_GreenHillsMULTI)
macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts test_cmd) macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts)
separate_arguments(_build_opts UNIX_COMMAND ${build_opts}) separate_arguments(_ghs_build_opts UNIX_COMMAND ${build_opts})
separate_arguments(_test_cmd UNIX_COMMAND ${test_cmd})
separate_arguments(_ghs_toolset_extra UNIX_COMMAND ${ghs_toolset_extra}) 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} COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/GhsMulti/${test_dir}" "${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-project test
--build-config $<CONFIGURATION> --build-config $<CONFIGURATION>
--build-options ${ghs_target_arch} ${ghs_toolset_name} ${ghs_toolset_root} ${ghs_target_platform} --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} ${ghs_os_root} ${ghs_os_dir} ${ghs_bsp_name} ${_ghs_build_opts} ${_ghs_toolset_extra}
--test-command ${_test_cmd} ${_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) macro(add_test_GhsMulti_rename_install test_name)
add_test_GhsMulti( ${test_name} GhsMultiRenameInstall ${test_name} add_test_GhsMulti( ${test_name} GhsMultiRenameInstall ${test_name}
"-DCMAKE_INSTALL_PREFIX=. -DRUN_TEST=${test_name}" "${CMAKE_CMAKE_COMMAND} -P ./cmake_install.cmake") "-DCMAKE_INSTALL_PREFIX=. -DRUN_TEST=${test_name}" ${CMAKE_CMAKE_COMMAND} -P ./cmake_install.cmake)
endmacro () 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) foreach(ghs_file IN LISTS CMake_TEST_GreenHillsMULTI_config)
# source GHS tools config file # source GHS tools config file
if(IS_ABSOLUTE ${ghs_file}) if(NOT ghs_file STREQUAL "__default__")
include(${ghs_file}) if(IS_ABSOLUTE ${ghs_file})
else() include(${ghs_file})
include(${CMAKE_BINARY_DIR}/${ghs_file}) else()
include(${CMAKE_BINARY_DIR}/${ghs_file})
endif()
endif()
if(NOT ghs_config_name)
set(ghs_config_name "__default__")
endif() endif()
# test integrity build # test integrity build
if (NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity")) 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(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "")
add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "" "") add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "")
add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "" "") add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "")
endif () endif()
add_test_GhsMulti(duplicate_source_filenames GhsMultiDuplicateSourceFilenames "" "" "") add_test_GhsMulti(duplicate_source_filenames GhsMultiDuplicateSourceFilenames "" "")
add_test_GhsMulti_rename_install(SINGLE_EXEC) add_test_GhsMulti_rename_install(SINGLE_EXEC)
add_test_GhsMulti_rename_install(SINGLE_EXEC_RENAMED) add_test_GhsMulti_rename_install(SINGLE_EXEC_RENAMED)
add_test_GhsMulti_rename_install(EXEC_AND_LIB) add_test_GhsMulti_rename_install(EXEC_AND_LIB)
add_test_GhsMulti(multiple_source_groups GhsMultiSrcGroups Default "" "") 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_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(multiple_source_groups_all_folders GhsMultiSrcGroups AllFolders "-DGHS_NO_SOURCE_GROUP_FILE=ON")
add_test_GhsMulti(unsupported_targets GhsMultiUnsupportedTargets "" "" "") add_test_GhsMulti(unsupported_targets GhsMultiUnsupportedTargets "" "")
set_tests_properties(GhsMulti.${ghs_config_name}.unsupported_targets PROPERTIES TIMEOUT 15) add_test_GhsMulti(object_library GhsMultiObjectLibrary "" "")
add_test_GhsMulti(object_library GhsMultiObjectLibrary "" "" "")
set_tests_properties(GhsMulti.${ghs_config_name}.object_library PROPERTIES TIMEOUT 15)
add_test_GhsMulti(exclude GhsMultiExclude "" "" add_test_GhsMulti(exclude GhsMultiExclude "" ""
"${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiExclude/verify.cmake") ${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiExclude/verify.cmake)
add_test_GhsMulti(interface GhsMultiInterface "" "" "") 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(transitive_link_test GhsMultiLinkTest TransitiveLink "-DRUN_TEST=NO_FLAGS" "") add_test_GhsMulti(flags_link_test GhsMultiLinkTest FlagsCheck "-DRUN_TEST=CHECK_FLAGS")
add_test_GhsMulti(flags_link_test GhsMultiLinkTest FlagsCheck "-DRUN_TEST=CHECK_FLAGS" "") add_test_GhsMulti(sub_link_test GhsMultiLinkTestSub "" "")
add_test_GhsMulti(sub_link_test GhsMultiLinkTestSub "" "" "")
add_test_GhsMulti(multiple_projects GhsMultiMultipleProjects "" "" add_test_GhsMulti(multiple_projects GhsMultiMultipleProjects "" ""
"${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake") ${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_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(compiler_options_kernel GhsMultiCompilerOptions Kernel "-DRUN_TEST=KERNEL_FLAGS -DRUN_TEST_BUILD_TYPE=DEBUG")
add_test_GhsMulti(try_compile_copy GhsMultiCopyFile "" "" "") add_test_GhsMulti(try_compile_copy GhsMultiCopyFile "" "")
add_test_GhsMulti(ghs_platform GhsMultiPlatform "" "" "") add_test_GhsMulti(ghs_platform GhsMultiPlatform "" "")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GhsMulti/${ghs_config_name}") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GhsMulti/${ghs_config_name}")
#unset ghs config variables #unset ghs config variables
unset(ghs_config_name) 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_target_platform)
unset(ghs_bsp_name) unset(ghs_bsp_name)
unset(ghs_toolset_extra) unset(ghs_toolset_extra)
endforeach(ghs_file) endforeach()
endif () endif()
if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ")
macro(add_test_VSNsightTegra name generator) macro(add_test_VSNsightTegra name generator)
@@ -5,24 +5,28 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(test C) project(test C)
if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
add_link_options("-non_shared")
endif()
if(RUN_TEST STREQUAL "RELEASE_FLAGS") if(RUN_TEST STREQUAL "RELEASE_FLAGS")
#RELEASE flags used when CMAKE_BUILD_TYPE is undefined #RELEASE flags used when CMAKE_BUILD_TYPE is undefined
string(APPEND CMAKE_C_FLAGS_RELEASE " -unexpected_release_option") string(APPEND CMAKE_C_FLAGS_RELEASE " -unexpected_release_option")
add_executable(test_none test.c) add_executable(test_none test.c)
endif() endif()
if(RUN_TEST STREQUAL "KERNEL_FLAGS") if(RUN_TEST STREQUAL "KERNEL_FLAGS")
#DEBUG flag missing when -kernel is added as a compile option #DEBUG flag missing when -kernel is added as a compile option
string(APPEND CMAKE_C_FLAGS_DEBUG " -required-debug-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) add_executable(K2 test.c)
target_compile_options(K2 PRIVATE -kernel) target_compile_options(K2 PRIVATE -kernel)
add_executable(K3 test.c) add_executable(K3 test.c)
target_compile_options(K3 PRIVATE -kernel=fast) target_compile_options(K3 PRIVATE -kernel=fast)
add_executable(K4 test.c) add_executable(K4 test.c)
target_link_options(K4 PRIVATE -kernel) target_link_options(K4 PRIVATE -kernel)
endif() endif()
@@ -12,6 +12,6 @@ add_library(libdemo
add_executable(demo main.c) add_executable(demo main.c)
target_link_libraries(demo libdemo) target_link_libraries(demo libdemo)
if(GHSMULTI) if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
target_compile_options(demo PUBLIC "-non_shared") target_link_options(demo PRIVATE "-non_shared")
endif() endif()
@@ -5,6 +5,10 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(test C) project(test C)
if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
add_link_options("-non_shared")
endif()
add_library(lib1 lib1.c) add_library(lib1 lib1.c)
set_target_properties( lib1 PROPERTIES EXCLUDE_FROM_ALL yes ) set_target_properties( lib1 PROPERTIES EXCLUDE_FROM_ALL yes )
@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(test C) project(test C)
add_link_options("-non_shared")
# create virtual AS # create virtual AS
add_executable(vas exe.c) add_executable(vas exe.c)
target_link_libraries(vas lib) target_link_libraries(vas lib)
@@ -3,6 +3,8 @@
cmake_minimum_required(VERSION 3.12 FATAL_ERROR) cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
add_link_options("-non_shared")
project(test C) project(test C)
# create virtual AS # create virtual AS
@@ -37,7 +37,7 @@ if (RUN_TEST STREQUAL "NO_FLAGS")
endif() endif()
else() else()
unset(fileName CACHE) 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
${CMAKE_CURRENT_BINARY_DIR}/link_build/exe1 ${CMAKE_CURRENT_BINARY_DIR}/link_build/exe1
) )
@@ -50,12 +50,12 @@ else()
-lcsl1 csl2 -lcsl1 csl2
-clinkexe1 -clinkexe2 -clinkexe1 -clinkexe2
-special-lib2-public-link) -special-lib2-public-link)
foreach( opt IN LISTS expected_flags ) foreach(opt IN LISTS expected_flags)
string(FIND "${fileText}" "${opt}" opt_found) string(FIND "${fileText}" "${opt}" opt_found)
if ( opt_found EQUAL -1 ) if ( opt_found EQUAL -1 )
message(SEND_ERROR "Could not find: ${opt}") message(SEND_ERROR "Could not find: ${opt}")
endif() endif()
endforeach(opt) endforeach()
unset(fileName CACHE) unset(fileName CACHE)
find_file (fileName lib1.gpj find_file (fileName lib1.gpj
@@ -67,12 +67,12 @@ else()
set(expected_flags set(expected_flags
-clinkexeA1 -clinkexeA2 -clinkexeA1 -clinkexeA2
-static-lib-flags1 -static-lib-flags2) -static-lib-flags1 -static-lib-flags2)
foreach( opt IN LISTS expected_flags ) foreach(opt IN LISTS expected_flags)
string(FIND "${fileText}" "${opt}" opt_found) string(FIND "${fileText}" "${opt}" opt_found)
if ( opt_found EQUAL -1 ) if (opt_found EQUAL -1)
message(SEND_ERROR "Could not find: ${opt}") message(SEND_ERROR "Could not find: ${opt}")
endif() endif()
endforeach(opt) endforeach()
unset(fileName CACHE) unset(fileName CACHE)
find_file (fileName lib2.gpj find_file (fileName lib2.gpj
@@ -83,10 +83,10 @@ else()
file(STRINGS ${fileName} fileText) file(STRINGS ${fileName} fileText)
set(expected_flags set(expected_flags
-clinkexeA1 -clinkexeA2) -clinkexeA1 -clinkexeA2)
foreach( opt IN LISTS expected_flags ) foreach(opt IN LISTS expected_flags)
string(FIND "${fileText}" "${opt}" opt_found) string(FIND "${fileText}" "${opt}" opt_found)
if ( opt_found EQUAL -1 ) if ( opt_found EQUAL -1 )
message(SEND_ERROR "Could not find: ${opt}") message(SEND_ERROR "Could not find: ${opt}")
endif() endif()
endforeach(opt) endforeach()
endif() endif()
@@ -5,31 +5,39 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(test C) project(test C)
if( RUN_TEST STREQUAL "CHECK_FLAGS" ) if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
add_link_options(-add-link-options1 -add-link-options2) add_link_options("-non_shared")
link_directories(link_directories_used1 link_directories_used2 "c:/absolute") endif()
link_libraries(link_libraries_used1 link_libraries_used2 )
set( CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lcsl1 csl2" ) if(RUN_TEST STREQUAL "CHECK_FLAGS")
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -clinkexe1 -clinkexe2") 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() endif()
add_executable(exe1 exe1.c) add_executable(exe1 exe1.c)
target_link_libraries(exe1 lib1) 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") if(RUN_TEST STREQUAL "CHECK_FLAGS")
set_property( TARGET exe1 APPEND PROPERTY LINK_OPTIONS --link-opt-prop1 --link-opt-prop2) 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() endif()
if( RUN_TEST STREQUAL "CHECK_FLAGS" ) if(RUN_TEST STREQUAL "CHECK_FLAGS")
set( CMAKE_STATIC_LINKER_FLAGS ${CMAKE_STATIC_LINKER_FLAGS} "-clinkexeA1 -clinkexeA2") set(CMAKE_STATIC_LINKER_FLAGS ${CMAKE_STATIC_LINKER_FLAGS} "-clinkexeA1 -clinkexeA2")
endif() endif()
add_library(lib1 STATIC func2.c func3.c func4.c) add_library(lib1 STATIC func2.c func3.c func4.c)
target_link_libraries(lib1 lib2) 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() endif()
add_library(lib2 STATIC func5.c func6.c func7.c) 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() endif()
@@ -7,3 +7,6 @@ project(test C)
add_executable(exe1 exe1.c) add_executable(exe1 exe1.c)
target_link_libraries(exe1 lib1) target_link_libraries(exe1 lib1)
if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
target_link_options(exe1 PRIVATE "-non_shared")
endif()
@@ -5,6 +5,10 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(test C) project(test C)
if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
add_link_options("-non_shared")
endif()
add_library(lib1 lib1.c) add_library(lib1 lib1.c)
add_executable(exe1 exe1.c) add_executable(exe1 exe1.c)
target_link_libraries(exe1 lib1) target_link_libraries(exe1 lib1)
@@ -3,13 +3,13 @@
#test project was generated #test project was generated
unset(fileName CACHE) unset(fileName CACHE)
find_file (fileName lib3.gpj find_file(fileName lib3.gpj
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/lib3 ${CMAKE_CURRENT_BINARY_DIR}/lib3
${CMAKE_CURRENT_BINARY_DIR}/examples ${CMAKE_CURRENT_BINARY_DIR}/examples
) )
if ( fileName ) if (fileName)
message("Found target lib3: ${fileName}") message("Found target lib3: ${fileName}")
else() else()
message(SEND_ERROR "Could not find target lib3: ${fileName}") message(SEND_ERROR "Could not find target lib3: ${fileName}")
@@ -23,7 +23,7 @@ find_file (fileName exe3.gpj
${CMAKE_CURRENT_BINARY_DIR}/examples ${CMAKE_CURRENT_BINARY_DIR}/examples
) )
if ( fileName ) if (fileName)
message("Found target exe3: ${fileName}") message("Found target exe3: ${fileName}")
else() else()
message(SEND_ERROR "Could not find target exe3: ${fileName}") message(SEND_ERROR "Could not find target exe3: ${fileName}")
@@ -37,7 +37,7 @@ find_file (fileName lib3.a
${CMAKE_CURRENT_BINARY_DIR}/examples ${CMAKE_CURRENT_BINARY_DIR}/examples
) )
if ( fileName ) if (fileName)
message(SEND_ERROR "Found target lib3: ${fileName}") message(SEND_ERROR "Found target lib3: ${fileName}")
else() else()
message("Could not find target lib3: ${fileName}") message("Could not find target lib3: ${fileName}")
@@ -51,7 +51,7 @@ find_file (fileName NAMES exe3.as exe3
${CMAKE_CURRENT_BINARY_DIR}/examples ${CMAKE_CURRENT_BINARY_DIR}/examples
) )
if ( fileName ) if (fileName)
message(SEND_ERROR "Found target exe3: ${fileName}") message(SEND_ERROR "Found target exe3: ${fileName}")
else() else()
message("Could not find target exe3: ${fileName}") message("Could not find target exe3: ${fileName}")
@@ -8,3 +8,6 @@ project(test C)
add_library(obj1 OBJECT testObj.c testObj.h sub/testObj.c testObj2.c) add_library(obj1 OBJECT testObj.c testObj.h sub/testObj.c testObj2.c)
add_executable(exe1 exe.c $<TARGET_OBJECTS:obj1>) add_executable(exe1 exe.c $<TARGET_OBJECTS:obj1>)
if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
target_link_options(exe1 PRIVATE "-non_shared")
endif()
@@ -5,9 +5,12 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(test) project(test)
message("PLATFORM_ID = ${PLATFORM_ID}")
message("CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}") message("CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}")
message("CMAKE_C_COMPILER_ID = ${CMAKE_C_COMPILER_ID}") message("CMAKE_C_COMPILER_ID = ${CMAKE_C_COMPILER_ID}")
message("CMAKE_C_COMPILER_VERSION = ${CMAKE_C_COMPILER_VERSION}") 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_PLATFORM_ID = ${CMAKE_C_PLATFORM_ID}")
message("CMAKE_C_COMPILER_ARCHITECTURE_ID = ${CMAKE_C_COMPILER_ARCHITECTURE_ID}") message("CMAKE_C_COMPILER_ARCHITECTURE_ID = ${CMAKE_C_COMPILER_ARCHITECTURE_ID}")
message("CMAKE_C_COMPILER_ABI = ${CMAKE_C_COMPILER_ABI}") 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 = ${CMAKE_CXX_COMPILER}")
message("CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}") message("CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
message("CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}") 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_PLATFORM_ID = ${CMAKE_CXX_PLATFORM_ID}")
message("CMAKE_CXX_COMPILER_ARCHITECTURE_ID = ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}") message("CMAKE_CXX_COMPILER_ARCHITECTURE_ID = ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}")
message("CMAKE_CXX_COMPILER_ABI = ${CMAKE_CXX_COMPILER_ABI}") message("CMAKE_CXX_COMPILER_ABI = ${CMAKE_CXX_COMPILER_ABI}")
+1 -3
View File
@@ -1,6 +1,4 @@
#include <stdio.h>
int main(void) int main(void)
{ {
printf("Testing...\n"); return -42;
} }
@@ -7,29 +7,33 @@ project(test C)
set(targets_to_install "") set(targets_to_install "")
if( RUN_TEST STREQUAL "SINGLE_EXEC" ) if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
add_executable(exe1 exe.c) add_link_options("-non_shared")
set(targets_to_install ${targets_to_install} exe1)
endif() endif()
if( RUN_TEST STREQUAL "SINGLE_EXEC_RENAMED" ) if(RUN_TEST STREQUAL "SINGLE_EXEC")
set(name new_name) add_executable(exe1 exe.c)
add_executable(exe1 exe.c) set(targets_to_install ${targets_to_install} exe1)
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() endif()
if( RUN_TEST STREQUAL "EXEC_AND_LIB" ) if(RUN_TEST STREQUAL "SINGLE_EXEC_RENAMED")
add_library(lib1 lib1.c) set(name new_name)
set_property(TARGET lib1 PROPERTY ARCHIVE_OUTPUT_DIRECTORY forced-$<CONFIG>) add_executable(exe1 exe.c)
set_property(TARGET lib1 PROPERTY SUFFIX .LL) set_property(TARGET exe1 PROPERTY RUNTIME_OUTPUT_DIRECTORY ${name}_bin_$<CONFIG>)
set_property(TARGET lib1 PROPERTY OUTPUT_NAME lib1_$<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()
add_executable(exe1 exe1.c) if(RUN_TEST STREQUAL "EXEC_AND_LIB")
target_link_libraries(exe1 lib1) add_library(lib1 lib1.c)
set(targets_to_install ${targets_to_install} exe1 lib1) 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() endif()
install(TARGETS ${targets_to_install} install(TARGETS ${targets_to_install}
@@ -35,6 +35,9 @@ add_executable(groups
if(TEST_PROP) if(TEST_PROP)
set_target_properties(groups PROPERTIES GHS_NO_SOURCE_GROUP_FILE ON) set_target_properties(groups PROPERTIES GHS_NO_SOURCE_GROUP_FILE ON)
endif() 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( gC FILES sub/testOBJ.h testOBJ.c testOBJ.h sub/testOBJ.c )
source_group( gA FILES test1.c test1.h) source_group( gA FILES test1.c test1.h)
source_group( gB test[65].c ) source_group( gB test[65].c )
+1 -1
View File
@@ -1 +1 @@
empty
+1 -1
View File
@@ -1 +1 @@
empty
@@ -1 +0,0 @@