Commit 13c05a47 authored by Robert Kimball's avatar Robert Kimball Committed by Scott Cyphers

This gets all compile-time flag use into cpp files rather than headers. This…

This gets all compile-time flag use into cpp files rather than headers. This does not work if it is in a header. (#3096)
parent 6c057b87
......@@ -478,6 +478,8 @@ set(SRC ${SRC}
if(NGRAPH_JSON_ENABLE)
list(APPEND SRC serializer.cpp serializer.hpp event_tracing.cpp event_tracing.hpp)
else()
list(APPEND SRC serializer_stub.cpp)
endif()
configure_file(version.in.hpp version.hpp)
......
......@@ -62,42 +62,3 @@ namespace ngraph
/// Option may be enabled by setting the environment variable NGRAPH_SERIALIZER_OUTPUT_SHAPES
void set_serialize_output_shapes(bool enable);
}
#ifdef NGRAPH_JSON_DISABLE
// Rather than making every reference to the serializer conditionally compile here we just
// provide some null stubs to resolve link issues
// The `inline` is so we don't get multiple definitions of function
std::string inline ngraph::serialize(std::shared_ptr<ngraph::Function> func, size_t indent)
{
return "";
}
void inline ngraph::serialize(const std::string& path,
std::shared_ptr<ngraph::Function> func,
size_t indent)
{
throw std::runtime_error("serializer disabled in build");
}
void inline ngraph::serialize(std::ostream& out,
std::shared_ptr<ngraph::Function> func,
size_t indent)
{
throw std::runtime_error("serializer disabled in build");
}
std::shared_ptr<ngraph::Function> inline ngraph::deserialize(std::istream& in)
{
throw std::runtime_error("serializer disabled in build");
}
std::shared_ptr<ngraph::Function> inline ngraph::deserialize(const std::string& str)
{
throw std::runtime_error("serializer disabled in build");
}
void inline ngraph::set_serialize_output_shapes(bool enable)
{
throw std::runtime_error("serializer disabled in build");
}
#endif
//*****************************************************************************
// Copyright 2017-2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#include "ngraph/serializer.hpp"
std::string ngraph::serialize(std::shared_ptr<ngraph::Function> func, size_t indent)
{
throw std::runtime_error("serializer disabled in build");
}
void ngraph::serialize(const std::string& path,
std::shared_ptr<ngraph::Function> func,
size_t indent)
{
throw std::runtime_error("serializer disabled in build");
}
void ngraph::serialize(std::ostream& out, std::shared_ptr<ngraph::Function> func, size_t indent)
{
throw std::runtime_error("serializer disabled in build");
}
std::shared_ptr<ngraph::Function> ngraph::deserialize(std::istream& in)
{
throw std::runtime_error("serializer disabled in build");
}
std::shared_ptr<ngraph::Function> ngraph::deserialize(const std::string& str)
{
throw std::runtime_error("serializer disabled in build");
}
void ngraph::set_serialize_output_shapes(bool enable)
{
throw std::runtime_error("serializer disabled in build");
}
Markdown is supported
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