Skip to content
Snippets Groups Projects
Unverified Commit ef6c2e2b authored by Shenghang Tsai's avatar Shenghang Tsai Committed by GitHub
Browse files

Add definition for CMAKE_BUILD_TYPE and print cmake_build_type in oneflow doctor (#5505)


* check in changes

* refine

* refine

Co-authored-by: default avataroneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com>
parent 50e1c346
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,8 @@ if(NOT uppercase_CMAKE_BUILD_TYPE MATCHES "^(DEBUG|RELEASE|RELWITHDEBINFO|MINSIZ
endif()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
add_definitions(-DONEFLOW_CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "")
option(THIRD_PARTY "Build third party" ON)
......
......@@ -48,6 +48,7 @@ def main():
print("path:", oneflow.__path__)
print("version:", oneflow.__version__)
print("cmake_build_type:", oneflow.sysconfig.cmake_build_type())
if __name__ == "__main__":
......
......@@ -57,6 +57,18 @@ ONEFLOW_API_PYBIND11_MODULE("flags", m) {
return false;
#endif // RPC_BACKEND_LOCAL
});
#define STRINGIFY(x) STRINGIFY_(x)
#define STRINGIFY_(x) #x
m.def("cmake_build_type", []() {
#ifdef ONEFLOW_CMAKE_BUILD_TYPE
return std::string(STRINGIFY(ONEFLOW_CMAKE_BUILD_TYPE));
#else
return std::string("Undefined");
#endif // ONEFLOW_CMAKE_BUILD_TYPE
});
#undef STRINGIFY
#undef STRINGIFY_
}
} // namespace oneflow
......@@ -80,3 +80,8 @@ def has_rpc_backend_grpc() -> bool:
@oneflow_export("sysconfig.has_rpc_backend_local")
def has_rpc_backend_local() -> bool:
return oneflow._oneflow_internal.flags.has_rpc_backend_local()
@oneflow_export("sysconfig.cmake_build_type")
def cmake_build_type() -> str:
return oneflow._oneflow_internal.flags.cmake_build_type()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment