forked from mindspore-Ecosystem/mindspore
package codegen
This commit is contained in:
parent
563df484ad
commit
4ddb2b2066
|
@ -2,6 +2,7 @@ include(CMakePackageConfigHelpers)
|
|||
|
||||
set(RUNTIME_PKG_NAME ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME})
|
||||
set(CONVERTER_PKG_NAME ${MAIN_DIR}-${CONVERTER_COMPONENT_NAME})
|
||||
set(CODEGEN_PKG_NAME ${MAIN_DIR}-${CODEGEN_COMPONENT_NAME})
|
||||
|
||||
set(RUNTIME_ROOT_DIR ${RUNTIME_PKG_NAME}/)
|
||||
set(CONVERTER_ROOT_DIR ${CONVERTER_PKG_NAME}/)
|
||||
|
@ -175,6 +176,8 @@ elseif(WIN32)
|
|||
DESTINATION ${CONVERTER_PKG_NAME}/converter COMPONENT ${CONVERTER_COMPONENT_NAME})
|
||||
install(FILES ${glog_LIBPATH}/../bin/libglog.dll DESTINATION ${CONVERTER_PKG_NAME}/converter
|
||||
COMPONENT ${CONVERTER_COMPONENT_NAME})
|
||||
install(TARGETS codegen RUNTIME DESTINATION ${CODEGEN_PKG_NAME}/
|
||||
COMPONENT ${CODEGEN_COMPONENT_NAME})
|
||||
endif()
|
||||
if(ENABLE_TOOLS)
|
||||
install(TARGETS benchmark RUNTIME DESTINATION ${RUNTIME_PKG_NAME}/benchmark COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
|
@ -228,6 +231,8 @@ else()
|
|||
install(FILES ${glog_LIBPATH}/libglog.so.0.4.0
|
||||
DESTINATION ${CONVERTER_PKG_NAME}/third_party/glog/lib RENAME libglog.so.0
|
||||
COMPONENT ${CONVERTER_COMPONENT_NAME})
|
||||
install(TARGETS codegen RUNTIME DESTINATION ${CODEGEN_PKG_NAME}/
|
||||
COMPONENT ${CODEGEN_COMPONENT_NAME})
|
||||
endif()
|
||||
if(ENABLE_TOOLS)
|
||||
install(TARGETS benchmark RUNTIME DESTINATION ${RUNTIME_PKG_NAME}/benchmark COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
|
@ -246,7 +251,7 @@ set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
|
|||
if(PLATFORM_ARM64 OR PLATFORM_ARM32)
|
||||
set(CPACK_COMPONENTS_ALL ${RUNTIME_COMPONENT_NAME})
|
||||
else()
|
||||
set(CPACK_COMPONENTS_ALL ${RUNTIME_COMPONENT_NAME} ${CONVERTER_COMPONENT_NAME})
|
||||
set(CPACK_COMPONENTS_ALL ${RUNTIME_COMPONENT_NAME} ${CONVERTER_COMPONENT_NAME} ${CODEGEN_COMPONENT_NAME})
|
||||
endif()
|
||||
set(CPACK_PACKAGE_FILE_NAME ${MAIN_DIR})
|
||||
if(WIN32)
|
||||
|
|
|
@ -76,9 +76,11 @@ if(SUPPORT_TRAIN)
|
|||
elseif(WIN32)
|
||||
set(RUNTIME_COMPONENT_NAME train-win-x64)
|
||||
set(CONVERTER_COMPONENT_NAME train-converter-win-x64)
|
||||
set(CODEGEN_NAME train-codegen-win-x64)
|
||||
else()
|
||||
set(RUNTIME_COMPONENT_NAME train-linux-x64)
|
||||
set(CONVERTER_COMPONENT_NAME train-converter-linux-x64)
|
||||
set(CODEGEN_NAME train-codegen-linux-x64)
|
||||
endif()
|
||||
else()
|
||||
if(PLATFORM_ARM64)
|
||||
|
@ -92,6 +94,7 @@ else()
|
|||
set(RUNTIME_COMPONENT_NAME inference-win-x64-${X86_64_SIMD})
|
||||
endif()
|
||||
set(CONVERTER_COMPONENT_NAME converter-win-x64)
|
||||
set(CODEGEN_COMPONENT_NAME codegen-win-x64)
|
||||
else()
|
||||
if("${X86_64_SIMD}" STREQUAL "off")
|
||||
set(RUNTIME_COMPONENT_NAME inference-linux-x64)
|
||||
|
@ -99,6 +102,7 @@ else()
|
|||
set(RUNTIME_COMPONENT_NAME inference-linux-x64-${X86_64_SIMD})
|
||||
endif()
|
||||
set(CONVERTER_COMPONENT_NAME converter-linux-x64)
|
||||
set(CODEGEN_COMPONENT_NAME codegen-linux-x64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -34,15 +34,13 @@ ms_build_flatbuffers_lite(FBS_FILES
|
|||
)
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
MESSAGE("******Micro Debug********")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDebug -g")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDebug -g")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=default")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default")
|
||||
set(CMAKE_C_FLAGS "-Wall -Werror -ftrapv -DDebug -g -fvisibility=default ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Werror-ftrapv -DDebug -g -fvisibility=default ${CMAKE_CXX_FLAGS}")
|
||||
else()
|
||||
MESSAGE(" ******Micro Release********")
|
||||
set(CMAKE_C_FLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -w -O2 -Werror \
|
||||
set(CMAKE_C_FLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -Wall -Werror \
|
||||
-fstack-protector-all -Wno-attributes -Wno-deprecated-declarations -Wno-missing-braces ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -w -O2 -Werror \
|
||||
set(CMAKE_CXX_FLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -Wall -Werror \
|
||||
-fstack-protector-all -Wno-attributes -Wno-deprecated-declarations \
|
||||
-Wno-missing-braces -Wno-overloaded-virtual ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
|
|
@ -2,7 +2,11 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections ")
|
|||
set(MICRO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
set(LITE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
set(3RD_DIR ${TOP_DIR}/third_party)
|
||||
set(NNACL_DIR ${LITE_DIR}/nnacl)
|
||||
if(ENABLE_CONVERTER)
|
||||
set(CODEGEN_PATH ${CMAKE_BINARY_DIR}/micro/coder/codegen)
|
||||
elseif()
|
||||
set(CODEGEN_PATH ${CMAKE_BINARY_DIR}/coder/codegen)
|
||||
endif()
|
||||
|
||||
#include 3rd
|
||||
include_directories(${3RD_DIR})
|
||||
|
@ -18,4 +22,7 @@ include(${MICRO_DIR}/cmake/file_list.cmake)
|
|||
add_executable(codegen main.cc ${FILE_SET})
|
||||
add_dependencies(codegen fbs_src)
|
||||
add_dependencies(codegen fbs_inner_src)
|
||||
target_link_libraries(codegen ${SECUREC_LIBRARY})
|
||||
target_link_libraries(codegen PRIVATE ${SECUREC_LIBRARY})
|
||||
if(NOT WIN32)
|
||||
add_custom_command(TARGET codegen POST_BUILD COMMAND strip ${CODEGEN_PATH})
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue