提交 b92866d2 编写于 作者: M Megvii Engine Team

fix(build): fix build depends dirty file issue

GitOrigin-RevId: 435d8b5c50ca7ce6034274d06c7239bd9a35f270
上级 9d8983f3
......@@ -1224,10 +1224,24 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Write out megbrain_build_config.h It defines macros needed by both megbrain and dnn
# please don't put the configuration that is easy to change at
# megbrain_build_config.h.in for example cuda_sm_gen.h.in and git_full_hash_header.h.in,
# which will lead to CMake build dirty file issue
configure_file(src/megbrain_build_config.h.in
${CMAKE_CURRENT_BINARY_DIR}/genfiles/megbrain_build_config.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/genfiles/megbrain_build_config.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(MGE_WITH_CUDA)
configure_file(src/cuda_sm_gen.h.in
${CMAKE_CURRENT_BINARY_DIR}/genfiles/cuda_sm_gen.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/genfiles/cuda_sm_gen.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
configure_file(src/git_full_hash_header.h.in
${CMAKE_CURRENT_BINARY_DIR}/genfiles/git_full_hash_header.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/genfiles/git_full_hash_header.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
add_subdirectory(dnn)
......
......@@ -20,6 +20,10 @@
#include "megbrain/graph.h"
#include "megbrain/imperative/physical_tensor.h"
#if MEGDNN_WITH_CUDA
#include "cuda_sm_gen.h"
#endif
namespace py = pybind11;
using namespace mgb;
using namespace imperative;
......@@ -248,7 +252,11 @@ void init_common(py::module m) {
m.def("get_device_prop", &CompNode::get_device_prop);
m.def("get_supported_sm_versions", []() {
#if MEGDNN_WITH_CUDA
static const char* mge_gen_code = MGE_CUDA_GENCODE;
#else
static const char* mge_gen_code = "-1";
#endif
return mge_gen_code;
});
......
......@@ -12,6 +12,10 @@
#include "megbrain/version.h"
#include "megbrain/common.h"
#ifndef __IN_TEE_ENV__
#include "git_full_hash_header.h"
#endif
using namespace mgb;
//! some sdk do not call mgb::get_version explicitly, so we force show version for
......@@ -20,8 +24,8 @@ using namespace mgb;
#ifndef __IN_TEE_ENV__
static __attribute__((constructor)) void show_version() {
auto v = get_version();
mgb_log("init Engine with version: %d.%d.%d(%d) at git commitid: %s", v.major,
v.minor, v.patch, v.is_dev, GIT_FULL_HASH);
mgb_log("init Engine with version: %d.%d.%d(%d) @(%s)", v.major, v.minor, v.patch,
v.is_dev, GIT_FULL_HASH);
}
#endif
......
#ifndef _HEADER_MGB_CUDA_SM_GEN_CONFIG
#define _HEADER_MGB_CUDA_SM_GEN_CONFIG
#define MGE_CUDA_GENCODE "@MGE_CUDA_GENCODE@"
#endif // _HEADER_MGB_CUDA_SM_GEN_CONFIG
#ifndef _HEADER_MGB_GIT_FULL_HASH_HEADER_CONFIG
#define _HEADER_MGB_GIT_FULL_HASH_HEADER_CONFIG
#define GIT_FULL_HASH "commit id: @GIT_FULL_HASH@"
#endif // _HEADER_MGB_GIT_FULL_HASH_HEADER_CONFIG
......@@ -267,7 +267,4 @@
#define MGE_WIN_DECLSPEC_DATA
#endif
#define GIT_FULL_HASH "@GIT_FULL_HASH@"
#define MGE_CUDA_GENCODE "@MGE_CUDA_GENCODE@"
#endif // _HEADER_MGB_BUILD_CONFIG
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册