tools/corrosion/test/ConfigureAndBuild.cmake
branchtransitional_engine
changeset 16067 d903f8d2395a
parent 16050 6a3dc15b78b9
equal deleted inserted replaced
16065:7b8d96fc8799 16067:d903f8d2395a
    15     GENERATOR_PLATFORM
    15     GENERATOR_PLATFORM
    16     RUST_TOOLCHAIN
    16     RUST_TOOLCHAIN
    17     CARGO_TARGET
    17     CARGO_TARGET
    18     C_COMPILER
    18     C_COMPILER
    19     CXX_COMPILER
    19     CXX_COMPILER
       
    20     C_COMPILER_TARGET
       
    21     CXX_COMPILER_TARGET
    20     SYSTEM_NAME
    22     SYSTEM_NAME
    21     EXTERNAL_CORROSION_GENERATOR
       
    22     CARGO_PROFILE
    23     CARGO_PROFILE
       
    24     OSX_ARCHITECTURES
       
    25     TOOLCHAIN_FILE
    23 )
    26 )
    24 set(multiValueArgs "PASS_THROUGH_ARGS")
    27 set(multiValueArgs "PASS_THROUGH_ARGS")
    25 cmake_parse_arguments(TEST "${options}" "${oneValueArgs}"
    28 cmake_parse_arguments(TEST "${options}" "${oneValueArgs}"
    26                       "${multiValueArgs}" ${TEST_ARG_LIST} )
    29                       "${multiValueArgs}" ${TEST_ARG_LIST} )
    27 
    30 
       
    31 set(configure_args "")
    28 if(TEST_CARGO_TARGET)
    32 if(TEST_CARGO_TARGET)
    29     set(TEST_Rust_CARGO_TARGET "-DRust_CARGO_TARGET=${TEST_CARGO_TARGET}")
    33     list(APPEND configure_args "-DRust_CARGO_TARGET=${TEST_CARGO_TARGET}")
    30 endif()
    34 endif()
    31 if(TEST_USE_INSTALLED_CORROSION)
    35 if(TEST_USE_INSTALLED_CORROSION)
    32     set(TEST_CORROSION_INSTALL "-DCORROSION_TESTS_FIND_CORROSION=ON")
    36     list(APPEND configure_args "-DCORROSION_TESTS_FIND_CORROSION=ON")
    33 endif()
    37 endif()
    34 if(TEST_GENERATOR_PLATFORM)
    38 if(TEST_GENERATOR_PLATFORM)
    35     set(TEST_GENERATOR_PLATFORM "-A${TEST_GENERATOR_PLATFORM}")
    39     list(APPEND configure_args "-A${TEST_GENERATOR_PLATFORM}")
    36 endif()
    40 endif()
    37 if(TEST_C_COMPILER)
    41 if(TEST_C_COMPILER)
    38     set(TEST_C_COMPILER "-DCMAKE_C_COMPILER=${TEST_C_COMPILER}")
    42     list(APPEND configure_args "-DCMAKE_C_COMPILER=${TEST_C_COMPILER}")
    39 endif()
    43 endif()
    40 if(TEST_CXX_COMPILER)
    44 if(TEST_CXX_COMPILER)
    41     set(TEST_CXX_COMPILER "-DCMAKE_CXX_COMPILER=${TEST_CXX_COMPILER}")
    45     list(APPEND configure_args "-DCMAKE_CXX_COMPILER=${TEST_CXX_COMPILER}")
       
    46 endif()
       
    47 if(TEST_C_COMPILER_TARGET)
       
    48     list(APPEND configure_args "-DCMAKE_C_COMPILER_TARGET=${TEST_C_COMPILER_TARGET}")
       
    49 endif()
       
    50 if(TEST_CXX_COMPILER_TARGET)
       
    51     list(APPEND configure_args "-DCMAKE_CXX_COMPILER_TARGET=${TEST_CXX_COMPILER_TARGET}")
    42 endif()
    52 endif()
    43 if(TEST_SYSTEM_NAME)
    53 if(TEST_SYSTEM_NAME)
    44     set(TEST_SYSTEM_NAME "-DCMAKE_SYSTEM_NAME=${TEST_SYSTEM_NAME}")
    54     list(APPEND configure_args "-DCMAKE_SYSTEM_NAME=${TEST_SYSTEM_NAME}")
    45 endif()
    55 endif()
    46 if(TEST_EXTERNAL_CORROSION_GENERATOR)
    56 if(TEST_OSX_ARCHITECTURES)
    47     set(TEST_EXTERNAL_CORROSION_GENERATOR
    57     list(APPEND configure_args "-DCMAKE_OSX_ARCHITECTURES=${TEST_OSX_ARCHITECTURES}")
    48         "-DCORROSION_GENERATOR_EXECUTABLE=${TEST_EXTERNAL_CORROSION_GENERATOR}"
    58 endif()
    49     )
    59 if(TEST_TOOLCHAIN_FILE)
       
    60     list(APPEND configure_args "-DCMAKE_TOOLCHAIN_FILE=${TEST_TOOLCHAIN_FILE}")
    50 endif()
    61 endif()
    51 if(TEST_CARGO_PROFILE)
    62 if(TEST_CARGO_PROFILE)
    52     set(TEST_CARGO_PROFILE "-DCARGO_PROFILE=${TEST_CARGO_PROFILE}")
    63     list(APPEND configure_args "-DCARGO_PROFILE=${TEST_CARGO_PROFILE}")
    53 endif()
    64 endif()
    54 
    65 
    55 # Remove old binary directory
    66 # Remove old binary directory
    56 file(REMOVE_RECURSE "${TEST_BINARY_DIR}")
    67 file(REMOVE_RECURSE "${TEST_BINARY_DIR}")
    57 
    68 
    63     COMMAND
    74     COMMAND
    64         "${CMAKE_COMMAND}"
    75         "${CMAKE_COMMAND}"
    65             "-G${TEST_GENERATOR}"
    76             "-G${TEST_GENERATOR}"
    66             "-DRust_TOOLCHAIN=${TEST_RUST_TOOLCHAIN}"
    77             "-DRust_TOOLCHAIN=${TEST_RUST_TOOLCHAIN}"
    67             --log-level Debug
    78             --log-level Debug
    68             ${TEST_Rust_CARGO_TARGET}
    79             ${configure_args}
    69             ${TEST_CORROSION_INSTALL}
       
    70             ${TEST_GENERATOR_PLATFORM}
       
    71             ${TEST_C_COMPILER}
       
    72             ${TEST_CXX_COMPILER}
       
    73             ${TEST_SYSTEM_NAME}
       
    74             ${TEST_EXTERNAL_CORROSION_GENERATOR}
       
    75             ${TEST_CARGO_PROFILE}
       
    76             ${TEST_PASS_THROUGH_ARGS}
    80             ${TEST_PASS_THROUGH_ARGS}
    77             -S "${TEST_SOURCE_DIR}"
    81             -S "${TEST_SOURCE_DIR}"
    78             -B "${TEST_BINARY_DIR}"
    82             -B "${TEST_BINARY_DIR}"
    79         COMMAND_ECHO STDOUT
    83         COMMAND_ECHO STDOUT
    80         RESULT_VARIABLE EXIT_CODE
    84         RESULT_VARIABLE EXIT_CODE