autodoc inital code + cmake warningns + improvements over compilation performance
This commit is contained in:
parent
c03438ba23
commit
97c3460af8
11 changed files with 56 additions and 22 deletions
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
PROJECT(Zano)
|
||||
|
||||
|
|
@ -18,6 +18,9 @@ endif()
|
|||
if(POLICY CMP0043)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0144)
|
||||
cmake_policy(SET CMP0144 NEW)
|
||||
endif()
|
||||
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
|
@ -122,6 +125,7 @@ if(MSVC)
|
|||
endforeach()
|
||||
endif()
|
||||
include_directories(SYSTEM src/platform/msc)
|
||||
configure_file(utils/Directory.Build.props.in ${CMAKE_BINARY_DIR}/Directory.Build.props)
|
||||
else()
|
||||
set(ARCH default CACHE STRING "CPU to build for: -march value or default")
|
||||
if("${ARCH}" STREQUAL "default")
|
||||
|
|
@ -258,8 +262,9 @@ elseif(NOT MSVC)
|
|||
endif()
|
||||
|
||||
if(BUILD_GUI)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5WebEngineWidgets REQUIRED)
|
||||
find_package(Qt5WebChannel REQUIRED)
|
||||
endif()
|
||||
|
||||
set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version")
|
||||
|
|
|
|||
|
|
@ -45,10 +45,23 @@ bool auto_doc_t(const std::string& prefix_name, std::string& generate_reference)
|
|||
if (!generate_reference.size()) return true;
|
||||
request_t req = get_documentation_json_struct<request_t>();
|
||||
response_t res = get_documentation_json_struct<response_t>();
|
||||
|
||||
std::string req_str;
|
||||
epee::serialization::portable_storage ps;
|
||||
req.store(ps, nullptr, true);
|
||||
ps.dump_as_json(req_str);
|
||||
|
||||
|
||||
std::string res_str;
|
||||
epee::serialization::portable_storage ps_res;
|
||||
res.store(ps_res, nullptr, true);
|
||||
ps_res.dump_as_json(res_str);
|
||||
|
||||
|
||||
std::stringstream ss;
|
||||
ss << prefix_name << ENDL
|
||||
<< "REQUEST: " << ENDL << epee::serialization::store_t_to_json(req) << ENDL << "--------------------------------" << ENDL
|
||||
<< "RESPONSE: " << ENDL << epee::serialization::store_t_to_json(res) << ENDL << "################################" << ENDL;
|
||||
<< "REQUEST: " << ENDL << req_str << ENDL << "--------------------------------" << ENDL
|
||||
<< "RESPONSE: " << ENDL << res_str << ENDL << "################################" << ENDL;
|
||||
generate_reference += ss.str();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ namespace epee
|
|||
#define BEGIN_KV_SERIALIZE_MAP() \
|
||||
public: \
|
||||
template<class t_storage> \
|
||||
bool store(t_storage& st, typename t_storage::hsection hparent_section = nullptr) const\
|
||||
bool store(t_storage& st, typename t_storage::hsection hparent_section = nullptr, bool auto_doc_mode = false) const\
|
||||
{\
|
||||
return serialize_map<true>(*this, st, hparent_section); \
|
||||
return serialize_map<true>(*this, st, hparent_section, auto_doc_mode); \
|
||||
}\
|
||||
template<class t_storage> \
|
||||
bool _load(t_storage& stg, typename t_storage::hsection hparent_section = nullptr)\
|
||||
|
|
@ -62,12 +62,15 @@ public: \
|
|||
}\
|
||||
}\
|
||||
template<bool is_store, class this_type, class t_storage> \
|
||||
static bool serialize_map(this_type& this_ref, t_storage& stg, typename t_storage::hsection hparent_section) \
|
||||
static bool serialize_map(this_type& this_ref, t_storage& stg, typename t_storage::hsection hparent_section, bool auto_doc_mode = false) \
|
||||
{
|
||||
|
||||
#define KV_SERIALIZE_N(varialble, val_name) \
|
||||
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name);
|
||||
|
||||
#define KV_SERIALIZE_N_DOC(varialble, val_name, substitute) \
|
||||
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name, auto_doc_mode, substitute);
|
||||
|
||||
#define KV_SERIALIZE_CUSTOM_N(varialble, stored_type, from_v_to_stored, from_stored_to_v, val_name) \
|
||||
epee::serialization::selector<is_store>::template serialize_custom<stored_type>(this_ref.varialble, stg, hparent_section, val_name, from_v_to_stored, from_stored_to_v);
|
||||
|
||||
|
|
@ -95,6 +98,7 @@ public: \
|
|||
#define END_KV_SERIALIZE_MAP() return true;}
|
||||
|
||||
#define KV_SERIALIZE(varialble) KV_SERIALIZE_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_DOC(varialble, substitute) KV_SERIALIZE_N_DOC( varialble, #varialble, substitute)
|
||||
#define KV_SERIALIZE_VAL_POD_AS_BLOB(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, #varialble) //skip is_pod compile time check
|
||||
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB(varialble) KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, #varialble)
|
||||
|
|
|
|||
|
|
@ -315,9 +315,9 @@ namespace epee
|
|||
struct selector<true>
|
||||
{
|
||||
template<class t_type, class t_storage>
|
||||
static bool serialize(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||
static bool serialize(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname, bool doc_mode = false, const t_type& doc_substitute = t_type())
|
||||
{
|
||||
return kv_serialize(d, stg, hparent_section, pname);
|
||||
return kv_serialize( (doc_mode ? doc_substitute:d), stg, hparent_section, pname);
|
||||
}
|
||||
|
||||
template<class t_type, class t_storage>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
cmake_minimum_required(VERSION 2.4.4)
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
||||
|
||||
project(zlib C)
|
||||
|
|
|
|||
|
|
@ -196,10 +196,10 @@ if(BUILD_GUI)
|
|||
ENABLE_SHARED_PCH(Zano QTDAEMON)
|
||||
ENABLE_SHARED_PCH_EXECUTABLE(Zano)
|
||||
|
||||
QT5_USE_MODULES(Zano WebEngineWidgets WebChannel)
|
||||
#QT5_USE_MODULES(Zano WebEngineWidgets WebChannel)
|
||||
find_package(Qt5PrintSupport REQUIRED)
|
||||
|
||||
target_link_libraries(Zano wallet rpc currency_core crypto common zlibstatic ethash Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
|
||||
target_link_libraries(Zano wallet rpc currency_core crypto common zlibstatic ethash Qt5::WebChannel Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(Zano rt)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -287,6 +287,8 @@ int main(int argc, char* argv[])
|
|||
rpc_server.handle_http_request_map(query_info, response_info, conn_context, call_found, json_rpc_reference);
|
||||
|
||||
LOG_PRINT_L0(generate_reference << ENDL << "----------------------------------------" << ENDL << json_rpc_reference);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool res = false;
|
||||
|
|
|
|||
|
|
@ -149,12 +149,13 @@ namespace currency
|
|||
std::string status;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(height)
|
||||
KV_SERIALIZE(status)
|
||||
KV_SERIALIZE_DOC(height, uint64_t(11111))
|
||||
KV_SERIALIZE_DOC(status, std::string("OK"))
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template<class t_block_complete_entry>
|
||||
struct COMMAND_RPC_GET_BLOCKS_FAST_T
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
# make it prominent in the GUI.
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
|
||||
|
||||
if(POLICY CMP0148)
|
||||
cmake_policy(SET CMP0148 OLD)
|
||||
endif()
|
||||
|
||||
# When other libraries are using a shared version of runtime libraries,
|
||||
# Google Test also has to use one.
|
||||
option(
|
||||
|
|
@ -40,7 +44,6 @@ endif()
|
|||
# ${gtest_BINARY_DIR}.
|
||||
# Language "C" is required for find_package(Threads).
|
||||
project(gtest CXX C)
|
||||
cmake_minimum_required(VERSION 2.6.2)
|
||||
|
||||
if (COMMAND set_up_hermetic_build)
|
||||
set_up_hermetic_build()
|
||||
|
|
|
|||
7
utils/Directory.Build.props.in
Normal file
7
utils/Directory.Build.props.in
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<UseMultiToolTask>true</UseMultiToolTask>
|
||||
<EnforceProcessCountAcrossBuilds>true</EnforceProcessCountAcrossBuilds>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Loading…
Add table
Reference in a new issue