|
|
|
@@ -2,8 +2,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare") |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder") |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch") |
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-uninitialized -Wno-deprecated-declarations -Wno-delete-non-abstract-non-virtual-dtor -Wno-constant-conversion -Wno-unknown-warning-option") |
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-uninitialized -Wno-deprecated-declarations |
|
|
|
-Wno-delete-non-abstract-non-virtual-dtor |
|
|
|
-Wno-constant-conversion -Wno-unknown-warning-option") |
|
|
|
else() |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized") |
|
|
|
endif() |
|
|
|
@@ -14,33 +16,33 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format") |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes") |
|
|
|
|
|
|
|
############################# Options ################################ |
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") |
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") |
|
|
|
add_definitions(-D _CRT_RAND_S) |
|
|
|
endif () |
|
|
|
if (ENABLE_ACL) |
|
|
|
endif() |
|
|
|
if(ENABLE_ACL) |
|
|
|
add_definitions(-D ENABLE_ACL) |
|
|
|
message(STATUS "ACL module is enabled") |
|
|
|
endif () |
|
|
|
if (ENABLE_GPUQUE) |
|
|
|
endif() |
|
|
|
if(ENABLE_GPUQUE) |
|
|
|
add_definitions(-D ENABLE_GPUQUE) |
|
|
|
message(STATUS "GPU queue is enabled") |
|
|
|
endif () |
|
|
|
if (ENABLE_TDTQUE) |
|
|
|
endif() |
|
|
|
if(ENABLE_TDTQUE) |
|
|
|
add_definitions(-D ENABLE_TDTQUE) |
|
|
|
message(STATUS "TDT queue is enabled") |
|
|
|
endif () |
|
|
|
if (MS_BUILD_GRPC) |
|
|
|
set (ENABLE_CACHE true) |
|
|
|
endif() |
|
|
|
if(MS_BUILD_GRPC) |
|
|
|
set(ENABLE_CACHE true) |
|
|
|
add_definitions(-D ENABLE_CACHE) |
|
|
|
message(STATUS "Cache is enabled") |
|
|
|
endif() |
|
|
|
|
|
|
|
# conde coverage |
|
|
|
# option(ENABLE_COVERAGE "Enable code coverage report" OFF) |
|
|
|
# if (ENABLE_COVERAGE) |
|
|
|
# if(ENABLE_COVERAGE) |
|
|
|
# include(${CMAKE_SOURCE_DIR}/cmake/CodeCoverage.cmake) |
|
|
|
# append_coverage_compiler_flags() |
|
|
|
# endif () |
|
|
|
# endif() |
|
|
|
|
|
|
|
########### Set up the include directories ########################### |
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/mindspore/ccsrc) |
|
|
|
@@ -59,9 +61,9 @@ include_directories(${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/kernels |
|
|
|
# compile flags |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default") |
|
|
|
|
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Darwin") |
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Darwin") |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-abstract-non-virtual-dtor") |
|
|
|
else () |
|
|
|
else() |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-rpath,$ORIGIN:$ORIGIN/lib") |
|
|
|
endif() |
|
|
|
|
|
|
|
@@ -95,17 +97,17 @@ add_dependencies(engine-ir-datasetops core) |
|
|
|
add_dependencies(engine-ir-datasetops-source core) |
|
|
|
add_dependencies(engine-ir-cache core) |
|
|
|
|
|
|
|
if (ENABLE_ACL) |
|
|
|
if(ENABLE_ACL) |
|
|
|
add_dependencies(kernels-dvpp-image core dvpp-utils) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
|
|
|
|
if (ENABLE_PYTHON) |
|
|
|
if(ENABLE_PYTHON) |
|
|
|
add_dependencies(APItoPython core) |
|
|
|
endif () |
|
|
|
if (ENABLE_TDTQUE) |
|
|
|
endif() |
|
|
|
if(ENABLE_TDTQUE) |
|
|
|
add_dependencies(engine-tdt core) |
|
|
|
endif () |
|
|
|
if (ENABLE_CACHE) |
|
|
|
endif() |
|
|
|
if(ENABLE_CACHE) |
|
|
|
add_dependencies(APItoPython engine-cache-client) |
|
|
|
add_dependencies(cpp-API engine-cache-client) |
|
|
|
add_dependencies(engine-ir-cache engine-cache-client) |
|
|
|
@@ -114,7 +116,7 @@ if (ENABLE_CACHE) |
|
|
|
add_dependencies(engine-datasetops engine-cache-client) |
|
|
|
add_dependencies(engine-cache-client core) |
|
|
|
add_dependencies(engine-cache-server core) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
################### Create _c_dataengine Library ###################### |
|
|
|
set(submodules |
|
|
|
$<TARGET_OBJECTS:core> |
|
|
|
@@ -143,42 +145,42 @@ set(submodules |
|
|
|
$<TARGET_OBJECTS:text-kernels> |
|
|
|
) |
|
|
|
|
|
|
|
if (ENABLE_ACL) |
|
|
|
if(ENABLE_ACL) |
|
|
|
set(submodules |
|
|
|
${submodules} |
|
|
|
$<TARGET_OBJECTS:kernels-dvpp-image> |
|
|
|
$<TARGET_OBJECTS:dvpp-utils>) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
|
|
|
|
if (ENABLE_PYTHON) |
|
|
|
if(ENABLE_PYTHON) |
|
|
|
set(submodules |
|
|
|
${submodules} |
|
|
|
$<TARGET_OBJECTS:APItoPython>) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
|
|
|
|
if (ENABLE_TDTQUE) |
|
|
|
if(ENABLE_TDTQUE) |
|
|
|
add_library(_c_dataengine SHARED ${submodules} $<TARGET_OBJECTS:engine-tdt>) |
|
|
|
else () |
|
|
|
else() |
|
|
|
add_library(_c_dataengine SHARED ${submodules}) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
|
|
|
|
if (ENABLE_PYTHON) |
|
|
|
if(ENABLE_PYTHON) |
|
|
|
set_target_properties(_c_dataengine PROPERTIES |
|
|
|
PREFIX "${PYTHON_MODULE_PREFIX}" |
|
|
|
SUFFIX "${PYTHON_MODULE_EXTENSION}" |
|
|
|
) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
|
|
|
|
###################################################################### |
|
|
|
|
|
|
|
################# Link with external libraries ######################## |
|
|
|
target_link_libraries(_c_dataengine PRIVATE mindspore mindspore_gvar) |
|
|
|
|
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Darwin") |
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Darwin") |
|
|
|
set(CMAKE_MACOSX_RPATH 1) |
|
|
|
set(CMAKE_INSTALL_RPATH "@loader_path/lib;@loader_path") |
|
|
|
set_target_properties(_c_dataengine PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH}") |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
|
|
|
|
set(targetso $<TARGET_FILE:_c_dataengine>) |
|
|
|
set(target_tiny "libtinyxml") |
|
|
|
@@ -225,7 +227,7 @@ function(changerpath targetso linkso) |
|
|
|
COMMENT "install tool name") |
|
|
|
endfunction() |
|
|
|
|
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Darwin") |
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Darwin") |
|
|
|
changerpath(${targetso} ${target_tiny}) |
|
|
|
changerpath(${targetso} ${target_icuuc}) |
|
|
|
add_dependencies(link_${target_icuuc} link_${target_tiny}) |
|
|
|
@@ -235,70 +237,74 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin") |
|
|
|
add_dependencies(link_${target_icui18n} link_${target_icudata}) |
|
|
|
endif() |
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") |
|
|
|
if (ENABLE_PYTHON) |
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") |
|
|
|
if(ENABLE_PYTHON) |
|
|
|
target_link_libraries(_c_dataengine PRIVATE mindspore::pybind11_module ${PYTHON_LIBRARIES} ${SECUREC_LIBRARY}) |
|
|
|
else () |
|
|
|
else() |
|
|
|
target_link_libraries(_c_dataengine PRIVATE ${SECUREC_LIBRARY}) |
|
|
|
endif () |
|
|
|
else () |
|
|
|
endif() |
|
|
|
else() |
|
|
|
set(ICU_LIB mindspore::icuuc mindspore::icudata mindspore::icui18n) |
|
|
|
if (ENABLE_PYTHON) |
|
|
|
if(ENABLE_PYTHON) |
|
|
|
target_link_libraries(_c_dataengine PRIVATE mindspore::pybind11_module -ldl ${SECUREC_LIBRARY}) |
|
|
|
else () |
|
|
|
else() |
|
|
|
target_link_libraries(_c_dataengine PRIVATE -ldl ${SECUREC_LIBRARY}) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
target_link_libraries(_c_dataengine PUBLIC mindspore::sentencepiece) |
|
|
|
endif() |
|
|
|
|
|
|
|
target_link_libraries(_c_dataengine PUBLIC mindspore::jpeg_turbo mindspore::turbojpeg mindspore::opencv_core mindspore::opencv_imgcodecs |
|
|
|
mindspore::opencv_imgproc mindspore::tinyxml2 mindspore::sentencepiece_train ${ICU_LIB}) |
|
|
|
if (ENABLE_GPUQUE) |
|
|
|
target_link_libraries(_c_dataengine PUBLIC mindspore::jpeg_turbo mindspore::turbojpeg mindspore::opencv_core |
|
|
|
mindspore::opencv_imgcodecs mindspore::opencv_imgproc mindspore::tinyxml2 |
|
|
|
mindspore::sentencepiece_train ${ICU_LIB}) |
|
|
|
if(ENABLE_GPUQUE) |
|
|
|
target_link_libraries(_c_dataengine PRIVATE gpu_queue |
|
|
|
${CUDNN_LIBRARY_PATH} |
|
|
|
${CUDA_PATH}/lib64/libcudart.so |
|
|
|
${CUDA_PATH}/lib64/stubs/libcuda.so) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
|
|
|
|
if (ENABLE_TDTQUE) |
|
|
|
if(ENABLE_TDTQUE) |
|
|
|
target_link_libraries(_c_dataengine PRIVATE ${TSDCLIENT}) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
|
|
|
|
add_dependencies(_c_dataengine _c_mindrecord) |
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") |
|
|
|
set(MINDRECORD_LINK_OBJECT ${CMAKE_BINARY_DIR}/mindspore/ccsrc/minddata/mindrecord/CMakeFiles/_c_mindrecord.dir/objects.a) |
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") |
|
|
|
set(MINDRECORD_LINK_OBJECT |
|
|
|
${CMAKE_BINARY_DIR}/mindspore/ccsrc/minddata/mindrecord/CMakeFiles/_c_mindrecord.dir/objects.a) |
|
|
|
target_link_libraries(_c_dataengine PRIVATE _c_mindrecord ${MINDRECORD_LINK_OBJECT} mindspore::sqlite) |
|
|
|
else () |
|
|
|
else() |
|
|
|
target_link_libraries(_c_dataengine PRIVATE _c_mindrecord) |
|
|
|
if (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU)) |
|
|
|
if(ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU)) |
|
|
|
target_link_libraries(_c_dataengine PRIVATE mindspore::pslite ${zeromq_DIRPATH}/zmq_install/lib/libzmq.a) |
|
|
|
if (${ENABLE_IBVERBS} STREQUAL "ON") |
|
|
|
if(${ENABLE_IBVERBS} STREQUAL "ON") |
|
|
|
target_link_libraries(_c_dataengine PRIVATE ibverbs rdmacm) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
target_link_libraries(_c_dataengine PRIVATE ps_cache) |
|
|
|
endif () |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
add_dependencies(_c_dataengine mindspore_shared_lib) |
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") |
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") |
|
|
|
set(MINDSPORE_LINK_OBJECT ${CMAKE_BINARY_DIR}/mindspore/ccsrc/cxx_api/CMakeFiles/mindspore_shared_lib.dir/objects.a) |
|
|
|
target_link_libraries(_c_dataengine PRIVATE mindspore_shared_lib ${MINDSPORE_LINK_OBJECT}) |
|
|
|
else() |
|
|
|
if (ENABLE_ACL) |
|
|
|
if(ENABLE_ACL) |
|
|
|
target_link_libraries(_c_dataengine PRIVATE mindspore_shared_lib) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
if (USE_GLOG) |
|
|
|
if(USE_GLOG) |
|
|
|
target_link_libraries(_c_dataengine PRIVATE mindspore::glog) |
|
|
|
else () |
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux") |
|
|
|
else() |
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux") |
|
|
|
target_link_options(_c_dataengine PRIVATE -Wl,-init,mindspore_log_init) |
|
|
|
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin") |
|
|
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") |
|
|
|
set_target_properties(_c_dataengine PROPERTIES MACOSX_RPATH ON) |
|
|
|
endif () |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
if (MS_BUILD_GRPC) |
|
|
|
if(MS_BUILD_GRPC) |
|
|
|
target_link_libraries(_c_dataengine PRIVATE mindspore::grpc++) |
|
|
|
endif () |
|
|
|
endif() |
|
|
|
|
|
|
|
set_target_properties(_c_dataengine PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH}) |