update cmake for different product

pull/108/head
taoxiangdong 4 years ago
parent d5dbadc16a
commit 22db649a79

@ -64,19 +64,38 @@ if (ENABLE_OPEN_SRC)
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64)
set(ASCEND_ACL_DIR ${ASCEND_DIR}/acllib/lib64)
find_module(slog libslog.so ${ASCEND_DRIVER_DIR})
find_module(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
find_module(hccl libhccl.so ${ASCEND_RUNTIME_DIR})
find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR})
find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR})
find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR})
find_module(resource libresource.so ${ASCEND_RUNTIME_DIR})
find_module(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR})
find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR})
find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR})
find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR})
find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR})
if(PLATFORM STREQUAL "train")
find_module(slog libslog.so ${ASCEND_DRIVER_DIR})
find_module(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
find_module(hccl libhccl.so ${ASCEND_RUNTIME_DIR})
find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR})
find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR})
find_module(resource libresource.so ${ASCEND_RUNTIME_DIR})
find_module(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR})
find_module(msprofiler libmsprofiler.a ${ASCEND_RUNTIME_DIR})
find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR})
if(PRODUCT STREQUAL "flr3")
message(FATAL_ERROR "This platform is not supported in train mode, build terminated")
endif()
else if(PLATFORM STREQUAL "inference")
find_module(slog libslog.so ${ASCEND_DRIVER_DIR})
find_module(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
find_module(adump_server libadump_server.a ${ASCEND_ACL_DIR})
find_module(runtime libruntime.so ${ASCEND_ACL_DIR})
find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR})
find_module(resource libresource.so ${ASCEND_ACL_DIR})
find_module(error_manager liberror_manager.so ${ASCEND_ACL_DIR})
find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR})
find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR})
find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR})
if(NOT PRODUCT STREQUAL "flr3")
find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR})
endif()
else()
message(FATAL_ERROR "Mode param is invalid, build terminated")
endif()
endif()
set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/metadef)

@ -23,7 +23,7 @@ export BUILD_PATH="${BASEPATH}/build/"
usage()
{
echo "Usage:"
echo "sh build.sh [-j[n]] [-h] [-v] [-s] [-t] [-u] [-c]"
echo "sh build.sh [-j[n]] [-h] [-v] [-s] [-t] [-u] [-c] [-p]"
echo ""
echo "Options:"
echo " -h Print usage"
@ -32,6 +32,7 @@ usage()
echo " -j[n] Set the number of threads used for building GraphEngine, default is 8"
echo " -t Build and execute ut"
echo " -c Build ut with coverage tag"
echo " -p Build inference or train"
echo " -v Display build command"
echo "to be continued ..."
}
@ -46,8 +47,10 @@ checkopts()
ENABLE_GE_ST="off"
ENABLE_GE_COV="off"
GE_ONLY="on"
PLATFORM="inference"
PRODUCT="normal"
# Process the options
while getopts 'ustchj:v' opt
while getopts 'ustchj:p:g:v' opt
do
OPTARG=$(echo ${OPTARG} | tr '[A-Z]' '[a-z]')
case "${opt}" in
@ -77,6 +80,12 @@ checkopts()
v)
VERBOSE="VERBOSE=1"
;;
p)
PLATFORM=$OPTARG
;;
g)
PRODUCT=$OPTARG
;;
*)
echo "Undefined option: ${opt}"
usage
@ -117,7 +126,7 @@ build_graphengine()
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GE_ST=ON"
fi
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPEN_SRC=True -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}"
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPEN_SRC=True -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH} -DPLATFORM=${PLATFORM} -DPRODUCT=${PRODUCT}"
echo "${CMAKE_ARGS}"
cmake ${CMAKE_ARGS} ..
if [ $? -ne 0 ]

Loading…
Cancel
Save