mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
GHS: Update test suite
-- Update test suite so that CMake can use multiple toolsets
CMake_TEST_GreenHillsMULTI_config
ghs_config_name
ghs_target_arch
ghs_tools
ghs_toolset_name
ghs_os_root
ghs_os_dir
ghs_target_platform
ghs_bsp_name
-- Change ARM Integrity test to generic Integrity test
Add Monolithic build test
-- Add other GHS generator tests
This commit is contained in:
@@ -2260,31 +2260,72 @@ ${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 test_cmd)
|
||||
separate_arguments(_build_opts UNIX_COMMAND ${build_opts})
|
||||
separate_arguments(_test_cmd UNIX_COMMAND ${test_cmd})
|
||||
separate_arguments(_ghs_toolset_extra UNIX_COMMAND ${ghs_toolset_extra})
|
||||
add_test(NAME GhsMulti.${ghs_config_name}.${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} ${_build_opts} ${_ghs_toolset_extra}
|
||||
--test-command ${_test_cmd}
|
||||
)
|
||||
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 ()
|
||||
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})
|
||||
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 "" "" "")
|
||||
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 Folders "-DCMAKE_FOLDER=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(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 "" "" "")
|
||||
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" "")
|
||||
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(ghs_file)
|
||||
endif ()
|
||||
|
||||
if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ")
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(ReturnNum)
|
||||
|
||||
add_subdirectory(ReturnNum)
|
||||
94
Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt
Normal file
94
Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt
Normal file
@@ -0,0 +1,94 @@
|
||||
# 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")
|
||||
try_compile(RESULT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/build
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src
|
||||
test
|
||||
CMAKE_FLAGS -DGHS_BSP_NAME=${GHS_BSP_NAME}
|
||||
-DGHS_OS_ROOT=${GHS_OS_ROOT}
|
||||
-DGHS_TOOLSET_ROOT=${GHS_TOOLSET_ROOT}
|
||||
-DGHS_TARGET_PLATFORM=${GHS_TARGET_PLATFORM}
|
||||
-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()
|
||||
28
Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in
Normal file
28
Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in
Normal file
@@ -0,0 +1,28 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
|
||||
|
||||
project(test C)
|
||||
|
||||
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()
|
||||
4
Tests/GhsMulti/GhsMultiCompilerOptions/test.c
Normal file
4
Tests/GhsMulti/GhsMultiCompilerOptions/test.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int main(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
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)
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
int test_b()
|
||||
{
|
||||
return 2;
|
||||
@@ -0,0 +1,4 @@
|
||||
int test_f()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
int test_c()
|
||||
{
|
||||
return 1;
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
int test_d()
|
||||
{
|
||||
return 1;
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
int test_a()
|
||||
{
|
||||
return 1;
|
||||
@@ -0,0 +1,4 @@
|
||||
int test_e()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
13
Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt
Normal file
13
Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt
Normal file
@@ -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(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)
|
||||
4
Tests/GhsMulti/GhsMultiExclude/exe1.c
Normal file
4
Tests/GhsMulti/GhsMultiExclude/exe1.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiExclude/lib1.c
Normal file
4
Tests/GhsMulti/GhsMultiExclude/lib1.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
54
Tests/GhsMulti/GhsMultiExclude/verify.cmake
Normal file
54
Tests/GhsMulti/GhsMultiExclude/verify.cmake
Normal file
@@ -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()
|
||||
@@ -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")
|
||||
@@ -1,3 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test)
|
||||
|
||||
add_subdirectory(App)
|
||||
add_subdirectory(Int)
|
||||
add_subdirectory(Lib)
|
||||
@@ -0,0 +1 @@
|
||||
add_executable(AppDD AppDD.int)
|
||||
@@ -0,0 +1 @@
|
||||
add_library(Lib HelperFun.c HelperFun.h)
|
||||
@@ -0,0 +1,18 @@
|
||||
# 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)
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,5 @@
|
||||
extern int func(void);
|
||||
int main(void)
|
||||
{
|
||||
return func();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
int func(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
@@ -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 };
|
||||
@@ -0,0 +1,8 @@
|
||||
Kernel
|
||||
Filename kernel/kernel.as
|
||||
EndKernel
|
||||
|
||||
AddressSpace App
|
||||
Filename "vas/vas.as"
|
||||
Language C
|
||||
EndAddressSpace
|
||||
8
Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt
Normal file
8
Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt
Normal file
@@ -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)
|
||||
96
Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt
Normal file
96
Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt
Normal file
@@ -0,0 +1,96 @@
|
||||
# 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 -DGHS_BSP_NAME=${GHS_BSP_NAME}
|
||||
-DGHS_OS_ROOT=${GHS_OS_ROOT}
|
||||
-DGHS_OS_DIR=${GHS_OS_DIR}
|
||||
-DGHS_TOOLSET_ROOT=${GHS_TOOLSET_ROOT}
|
||||
-DGHS_TARGET_PLATFORM=${GHS_TARGET_PLATFORM}
|
||||
-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(opt)
|
||||
|
||||
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(opt)
|
||||
|
||||
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(opt)
|
||||
endif()
|
||||
35
Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in
Normal file
35
Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in
Normal file
@@ -0,0 +1,35 @@
|
||||
# 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( 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()
|
||||
6
Tests/GhsMulti/GhsMultiLinkTest/exe1.c
Normal file
6
Tests/GhsMulti/GhsMultiLinkTest/exe1.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "exe1.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return func2a() + func3a() + func4a() + func5a() + func6a() + func7a();
|
||||
}
|
||||
6
Tests/GhsMulti/GhsMultiLinkTest/exe1.h
Normal file
6
Tests/GhsMulti/GhsMultiLinkTest/exe1.h
Normal file
@@ -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);
|
||||
4
Tests/GhsMulti/GhsMultiLinkTest/func2.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTest/func2.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func2a(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiLinkTest/func3.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTest/func3.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func3a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiLinkTest/func4.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTest/func4.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func4a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiLinkTest/func5.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTest/func5.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func5a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiLinkTest/func6.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTest/func6.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func6a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiLinkTest/func7.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTest/func7.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func7a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
9
Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt
Normal file
9
Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt
Normal file
@@ -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)
|
||||
@@ -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_executable(exe1 exe1.c)
|
||||
target_link_libraries(exe1 lib1)
|
||||
6
Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.c
Normal file
6
Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "exe1.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return func2a() + func3a() + func4a() + func5a() + func6a() + func7a();
|
||||
}
|
||||
6
Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.h
Normal file
6
Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.h
Normal file
@@ -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);
|
||||
@@ -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)
|
||||
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func2.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func2.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func2a(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func3.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func3.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func3a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func4.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func4.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func4a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func5.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func5.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func5a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func6.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func6.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func6a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func7.c
Normal file
4
Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func7.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func7a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
13
Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt
Normal file
13
Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt
Normal file
@@ -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(lib1 lib1.c)
|
||||
add_executable(exe1 exe1.c)
|
||||
target_link_libraries(exe1 lib1)
|
||||
|
||||
add_subdirectory(sub)
|
||||
add_subdirectory(sub2 examples EXCLUDE_FROM_ALL)
|
||||
5
Tests/GhsMulti/GhsMultiMultipleProjects/exe1.c
Normal file
5
Tests/GhsMulti/GhsMultiMultipleProjects/exe1.c
Normal file
@@ -0,0 +1,5 @@
|
||||
extern int lib1_func(void);
|
||||
int main(void)
|
||||
{
|
||||
return lib1_func();
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiMultipleProjects/lib1.c
Normal file
4
Tests/GhsMulti/GhsMultiMultipleProjects/lib1.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int lib1_func(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
10
Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt
Normal file
10
Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt
Normal file
@@ -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)
|
||||
6
Tests/GhsMulti/GhsMultiMultipleProjects/sub/exe2.c
Normal file
6
Tests/GhsMulti/GhsMultiMultipleProjects/sub/exe2.c
Normal file
@@ -0,0 +1,6 @@
|
||||
extern int func(void);
|
||||
extern int lib1_func(void);
|
||||
int main(void)
|
||||
{
|
||||
return func() + lib1_func();
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiMultipleProjects/sub/lib2.c
Normal file
4
Tests/GhsMulti/GhsMultiMultipleProjects/sub/lib2.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
10
Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt
Normal file
10
Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt
Normal file
@@ -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)
|
||||
6
Tests/GhsMulti/GhsMultiMultipleProjects/sub2/exe3.c
Normal file
6
Tests/GhsMulti/GhsMultiMultipleProjects/sub2/exe3.c
Normal file
@@ -0,0 +1,6 @@
|
||||
extern int func(void);
|
||||
extern int lib1_func(void);
|
||||
int main(void)
|
||||
{
|
||||
return func() + lib1_func();
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiMultipleProjects/sub2/lib3.c
Normal file
4
Tests/GhsMulti/GhsMultiMultipleProjects/sub2/lib3.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
58
Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake
Normal file
58
Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake
Normal file
@@ -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()
|
||||
10
Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt
Normal file
10
Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt
Normal file
@@ -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(test C)
|
||||
|
||||
add_library(obj1 OBJECT testObj.c testObj.h sub/testObj.c testObj2.c)
|
||||
|
||||
add_executable(exe1 exe.c $<TARGET_OBJECTS:obj1>)
|
||||
8
Tests/GhsMulti/GhsMultiObjectLibrary/exe.c
Normal file
8
Tests/GhsMulti/GhsMultiObjectLibrary/exe.c
Normal file
@@ -0,0 +1,8 @@
|
||||
extern int funcOBJ(void);
|
||||
extern int funcOBJ2(void);
|
||||
extern int funcOBJs(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return funcOBJ() + funcOBJ2() + funcOBJs();
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiObjectLibrary/sub/testOBJ.c
Normal file
4
Tests/GhsMulti/GhsMultiObjectLibrary/sub/testOBJ.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int funcOBJs(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.c
Normal file
4
Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int funcOBJ(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
1
Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.h
Normal file
1
Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.h
Normal file
@@ -0,0 +1 @@
|
||||
extern int funcOBJ(void);
|
||||
4
Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ2.c
Normal file
4
Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ2.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int funcOBJ2(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
38
Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt
Normal file
38
Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt
Normal file
@@ -0,0 +1,38 @@
|
||||
# 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( 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)
|
||||
4
Tests/GhsMulti/GhsMultiRenameInstall/exe.c
Normal file
4
Tests/GhsMulti/GhsMultiRenameInstall/exe.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
5
Tests/GhsMulti/GhsMultiRenameInstall/exe1.c
Normal file
5
Tests/GhsMulti/GhsMultiRenameInstall/exe1.c
Normal file
@@ -0,0 +1,5 @@
|
||||
extern int func(void);
|
||||
int main(void)
|
||||
{
|
||||
return func();
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiRenameInstall/lib1.c
Normal file
4
Tests/GhsMulti/GhsMultiRenameInstall/lib1.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiSrcGroups/Atest3.c
Normal file
4
Tests/GhsMulti/GhsMultiSrcGroups/Atest3.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int funcA3a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
39
Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt
Normal file
39
Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt
Normal file
@@ -0,0 +1,39 @@
|
||||
# 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
|
||||
)
|
||||
|
||||
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 )
|
||||
1
Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule
Normal file
1
Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
Tests/GhsMulti/GhsMultiSrcGroups/object.o
Normal file
1
Tests/GhsMulti/GhsMultiSrcGroups/object.o
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf
Normal file
1
Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
6
Tests/GhsMulti/GhsMultiSrcGroups/s2.h
Normal file
6
Tests/GhsMulti/GhsMultiSrcGroups/s2.h
Normal file
@@ -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);
|
||||
6
Tests/GhsMulti/GhsMultiSrcGroups/s4.h
Normal file
6
Tests/GhsMulti/GhsMultiSrcGroups/s4.h
Normal file
@@ -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);
|
||||
6
Tests/GhsMulti/GhsMultiSrcGroups/s5.h
Normal file
6
Tests/GhsMulti/GhsMultiSrcGroups/s5.h
Normal file
@@ -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);
|
||||
1
Tests/GhsMulti/GhsMultiSrcGroups/standard.h
Normal file
1
Tests/GhsMulti/GhsMultiSrcGroups/standard.h
Normal file
@@ -0,0 +1 @@
|
||||
#define somthing
|
||||
6
Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.c
Normal file
6
Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "testOBJ.h"
|
||||
|
||||
int funcOBJsub(void)
|
||||
{
|
||||
return func2a() + func3a() + func4a() + func5a() + func6a() + func7a();
|
||||
}
|
||||
6
Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.h
Normal file
6
Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.h
Normal file
@@ -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);
|
||||
6
Tests/GhsMulti/GhsMultiSrcGroups/test1.c
Normal file
6
Tests/GhsMulti/GhsMultiSrcGroups/test1.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "test1.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return func2a() + func3a() + func4a() + func5a() + func6a() + func7a();
|
||||
}
|
||||
6
Tests/GhsMulti/GhsMultiSrcGroups/test1.h
Normal file
6
Tests/GhsMulti/GhsMultiSrcGroups/test1.h
Normal file
@@ -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);
|
||||
4
Tests/GhsMulti/GhsMultiSrcGroups/test2a.c
Normal file
4
Tests/GhsMulti/GhsMultiSrcGroups/test2a.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func2a(void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiSrcGroups/test3.c
Normal file
4
Tests/GhsMulti/GhsMultiSrcGroups/test3.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func3a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
1
Tests/GhsMulti/GhsMultiSrcGroups/test3.h
Normal file
1
Tests/GhsMulti/GhsMultiSrcGroups/test3.h
Normal file
@@ -0,0 +1 @@
|
||||
#define somthing
|
||||
4
Tests/GhsMulti/GhsMultiSrcGroups/test4.c
Normal file
4
Tests/GhsMulti/GhsMultiSrcGroups/test4.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func4a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiSrcGroups/test5.c
Normal file
4
Tests/GhsMulti/GhsMultiSrcGroups/test5.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func5a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiSrcGroups/test6.c
Normal file
4
Tests/GhsMulti/GhsMultiSrcGroups/test6.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func6a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
4
Tests/GhsMulti/GhsMultiSrcGroups/test7.c
Normal file
4
Tests/GhsMulti/GhsMultiSrcGroups/test7.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func7a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
11
Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.c
Normal file
11
Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.c
Normal file
@@ -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();
|
||||
}
|
||||
6
Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.h
Normal file
6
Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.h
Normal file
@@ -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);
|
||||
1
Tests/GhsMulti/GhsMultiSrcGroups/textfile.txt
Normal file
1
Tests/GhsMulti/GhsMultiSrcGroups/textfile.txt
Normal file
@@ -0,0 +1 @@
|
||||
placeholder
|
||||
1
Tests/GhsMulti/GhsMultiSrcGroups/textfile2.txt
Normal file
1
Tests/GhsMulti/GhsMultiSrcGroups/textfile2.txt
Normal file
@@ -0,0 +1 @@
|
||||
placeholder
|
||||
12
Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt
Normal file
12
Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt
Normal file
@@ -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)
|
||||
4
Tests/GhsMulti/GhsMultiUnsupportedTargets/file.c
Normal file
4
Tests/GhsMulti/GhsMultiUnsupportedTargets/file.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int func7a(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
add_executable(AppDD AppDD.int Default.bsp)
|
||||
@@ -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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user