diff --git a/CMakeLists.txt b/CMakeLists.txt index 780e1f17..35a2b391 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,10 +24,21 @@ ################################################################################ cmake_minimum_required ( VERSION 3.5.0 ) +project ("rocm-validation-suite") if ( ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) message(FATAL "In-source build is not allowed") endif () +enable_testing() + +# Prerequisite - Check if rocblas was already installed +find_package (rocblas) +if(rocblas_FOUND) + message(STATUS "rocblas found") +else() + message(FATAL_ERROR "rocblas not found !!! Install rocblas to proceed ...") +endif(rocblas_FOUND) + set(ROCM_PATH "/opt/rocm" CACHE PATH "ROCM install path") set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "CMAKE installation directory") set(ROCR_INC_DIR "${ROCM_PATH}/include" CACHE PATH "Contains header files exported by ROC Runtime" FORCE) @@ -36,7 +47,6 @@ set(HIP_INC_DIR "${ROCM_PATH}/hip" ) set(HIP_INC_DIR "${ROCM_PATH}/hip" CACHE PATH "Contains header files exported by ROC Runtime" FORCE) set(ROCT_INC_DIR "${ROCM_PATH}/include" CACHE PATH "Contains header files exported by ROC Trunk" FORCE) -execute_process(COMMAND ln -s /usr/bin/python3 /usr/bin/python) # # If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their @@ -45,20 +55,17 @@ execute_process(COMMAND ln -s /usr/bin/python3 /usr/bin/python) # if(DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of -build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug -Release RelWithDebInfo MinSizeRel.") + build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug + Release RelWithDebInfo MinSizeRel.") else() set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, -options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release -RelWithDebInfo MinSizeRel.") + options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release + RelWithDebInfo MinSizeRel.") endif() -project ("rocm-validation-suite") -enable_testing() #include ( CTest ) -if (NOT CMAKE_CONFIGURATION_TYPES) -# message( "CMAKE_CONFIGURATION_TYPES not set") +if(NOT CMAKE_CONFIGURATION_TYPES) # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") @@ -70,17 +77,15 @@ execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/rvs_os_helper.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE ) -if(result) +if (result) message(FATAL_ERROR "Could not obtain OS type: ${result}") endif() message(STATUS "RVS_OS_TYPE: ${RVS_OS_TYPE}") if (${RVS_OS_TYPE} STREQUAL "ubuntu") set(RVS_OS_TYPE_NUM 1) - execute_process(COMMAND sudo apt-get install rocblas --assume-yes) elseif ((${RVS_OS_TYPE} STREQUAL "centos") OR (${RVS_OS_TYPE} STREQUAL "rhel") OR (${RVS_OS_TYPE} STREQUAL "sles")) set(RVS_OS_TYPE_NUM 2) - execute_process(COMMAND sudo yum -y install rocblas ) else() set(RVS_OS_TYPE_NUM 0) endif() @@ -89,7 +94,7 @@ message(STATUS "RVS_OS_TYPE_NUM: ${RVS_OS_TYPE_NUM}") ## Set default module path if not already set if ( NOT DEFINED CMAKE_MODULE_PATH ) set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/" ) -endif () +endif() ## Include common cmake modules include ( utils )