[designer] Fix Designer tool

Signed-off-by: Andrew Shkrob <andrew.shkrob.social@yandex.by>
This commit is contained in:
Andrew Shkrob 2023-07-16 18:20:27 +02:00
parent 506e07d446
commit 81a398b0b3
14 changed files with 30 additions and 99 deletions

View file

@ -29,41 +29,9 @@ add_library(${PROJECT_NAME} ALIAS ${protobuf_LIB_NAME})
# Disable Unity build for protobuf
set_target_properties(${protobuf_LIB_NAME} PROPERTIES UNITY_BUILD OFF)
set(ABSL_TARGETS
absl_check
absl_absl_log
absl_algorithm
absl_base
absl_bind_front
absl_bits
absl_btree
absl_cleanup
absl_cord
absl_core_headers
absl_debugging
absl_die_if_null
absl_dynamic_annotations
absl_flags
absl_flat_hash_map
absl_flat_hash_set
absl_function_ref
absl_hash
absl_layout
absl_log_initialize
absl_log_severity
absl_memory
absl_node_hash_map
absl_node_hash_set
absl_optional
absl_span
absl_status
absl_statusor
absl_strings
absl_synchronization
absl_time
absl_time_zone
absl_type_traits
absl_utility
absl_variant
)
foreach(target IN LISTS ABSL_TARGETS)
set_target_properties(${target} PROPERTIES UNITY_BUILD OFF)

View file

@ -22,6 +22,10 @@
#include "drape/support_manager.hpp"
#include "drape/utils/projection.hpp"
#if BUILD_DESIGNER
#include "indexer/classificator_loader.hpp"
#endif
#include "indexer/drawing_rules.hpp"
#include "indexer/map_style_reader.hpp"
#include "indexer/scales.hpp"

View file

@ -142,11 +142,6 @@ set(SRC
set(OTHER_FILES drules_struct.proto)
# Disable warnings.
set_source_files_properties(drules_struct.pb.cc PROPERTIES COMPILE_FLAGS
"$<$<CXX_COMPILER_ID:AppleClang,Clang>:-Wno-shorten-64-to-32> $<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>"
)
file(COPY ${OTHER_FILES} DESTINATION ${CMAKE_BINARY_DIR})
omim_add_library(${PROJECT_NAME} ${SRC})

View file

@ -15,7 +15,7 @@ inline uint32_t PatchMinDrawableScale(uint32_t s)
inline uint32_t PatchMaxDrawableScale(uint32_t s)
{
std::min(s + kPatchScaleShift, static_cast<uint32_t>(GetUpperStyleScale()));
return std::min(s + kPatchScaleShift, static_cast<uint32_t>(GetUpperStyleScale()));
}
#else // BUILD_DESIGNER

View file

@ -8,10 +8,7 @@
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QProcess>
#include <QtCore/QProcessEnvironment>
#include <exception>
#include <iomanip> // std::quoted
#include <regex>
#include <string>
@ -122,8 +119,3 @@ QString GetExternalPath(QString const & name, QString const & primaryPath,
}
return path;
}
QString GetProtobufEggPath()
{
return GetExternalPath("protobuf-3.3.0-py2.7.egg", "kothic", "../3party/protobuf");
}

View file

@ -21,4 +21,3 @@ QString JoinPathQt(std::initializer_list<QString> folders);
QString GetExternalPath(QString const & name, QString const & primaryPath,
QString const & secondaryPath);
QString GetProtobufEggPath();

View file

@ -24,17 +24,13 @@ void BuildDrawingRulesImpl(QString const & mapcssFile, QString const & outputDir
if (QFile(outputFile).exists())
throw std::runtime_error("Output directory is not clear");
// Add path to the protobuf EGG in the PROTOBUF_EGG_PATH environment variable
QProcessEnvironment env{QProcessEnvironment::systemEnvironment()};
env.insert("PROTOBUF_EGG_PATH", GetProtobufEggPath());
// Run the script
(void)ExecProcess("python", {
GetExternalPath("libkomwm.py", "kothic/src", "../tools/kothic/src"),
"-s", mapcssFile,
"-o", outputTemplate,
"-x", "True",
}, &env);
});
// Ensure that generated file is not empty.
if (QFile(outputFile).size() == 0)

View file

@ -22,16 +22,12 @@ QString GetStyleStatistics(QString const & mapcssMappingFile, QString const & dr
if (!QFile(drulesFile).exists())
throw std::runtime_error("drawing-rules file does not exist at " + drulesFile.toStdString());
// Add path to the protobuf EGG in the PROTOBUF_EGG_PATH environment variable.
QProcessEnvironment env{QProcessEnvironment::systemEnvironment()};
env.insert("PROTOBUF_EGG_PATH", GetProtobufEggPath());
// Run the script.
return ExecProcess("python", {
GetExternalPath("drules_info.py", "kothic/src", "../tools/python/stylesheet"),
mapcssMappingFile,
drulesFile,
}, &env);
});
}
QString GetCurrentStyleStatistics()

View file

@ -241,26 +241,26 @@ int main(int argc, char * argv[])
);
w.show();
returnCode = app.exec();
}
#ifdef BUILD_DESIGNER
if (build_style::NeedRecalculate && !mapcssFilePath.isEmpty())
{
try
if (build_style::NeedRecalculate && !mapcssFilePath.isEmpty())
{
build_style::RunRecalculationGeometryScript(mapcssFilePath);
try
{
build_style::RunRecalculationGeometryScript(mapcssFilePath);
}
catch (std::exception & e)
{
QMessageBox msgBox;
msgBox.setWindowTitle("Error");
msgBox.setText(e.what());
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
}
}
catch (std::exception & e)
{
QMessageBox msgBox;
msgBox.setWindowTitle("Error");
msgBox.setText(e.what());
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
}
}
#endif // BUILD_DESIGNER
}
LOG_SHORT(LINFO, ("Organic Maps finished with code", returnCode));
return returnCode;

View file

@ -95,7 +95,7 @@ namespace qt
indexRegenCheckBox->setChecked(enabled);
connect(indexRegenCheckBox, &QCheckBox::stateChanged, [](int i)
{
settings::Set(kEnabledAutoRegenGeomIndex, static_cast<bool>(i))
settings::Set(kEnabledAutoRegenGeomIndex, static_cast<bool>(i));
});
}
#endif

View file

@ -3,6 +3,7 @@ OMIM_ROOT = $(PROJECT_DIR)/../..
QT_PATH[arch=x86_64] = /usr/local/opt/qt@5
QT_PATH[arch=arm64] = /opt/homebrew/opt/qt@5
BOOST_ROOT = $(OMIM_ROOT)/3party/boost
PROTOBUF_PATHS = $(OMIM_ROOT)/3party/protobuf/protobuf/third_party/abseil-cpp/ $(OMIM_ROOT)/3party/protobuf/protobuf/src
// jansson is included in many libs, and is also used in headers (leaks to other libs)
HEADER_SEARCH_PATHS = $(inherited) $(OMIM_ROOT) $(BOOST_ROOT) $(OMIM_ROOT)/3party/jansson $(OMIM_ROOT)/3party/jansson/jansson/src

View file

@ -1001,10 +1001,7 @@
EXECUTABLE_PREFIX = lib;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(OMIM_ROOT)/3party/glm",
"$(OMIM_ROOT)/3party/protobuf/protobuf/src",
"$(OMIM_ROOT)/3party/protobuf/protobuf/third_party/abseil-cpp/",
"$(OMIM_ROOT)/3party/pugixml/pugixml/src",
"${PROTOBUF_PATHS}",
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
@ -1016,10 +1013,7 @@
EXECUTABLE_PREFIX = lib;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(OMIM_ROOT)/3party/glm",
"$(OMIM_ROOT)/3party/protobuf/protobuf/src",
"$(OMIM_ROOT)/3party/protobuf/protobuf/third_party/abseil-cpp/",
"$(OMIM_ROOT)/3party/pugixml/pugixml/src",
"${PROTOBUF_PATHS}",
);
PRODUCT_NAME = "$(TARGET_NAME)";
};

View file

@ -1095,8 +1095,7 @@
EXECUTABLE_PREFIX = lib;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(OMIM_ROOT)/3party/protobuf/protobuf/src",
"$(OMIM_ROOT)/3party/protobuf/protobuf/third_party/abseil-cpp/",
"${PROTOBUF_PATHS}",
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
@ -1108,8 +1107,7 @@
EXECUTABLE_PREFIX = lib;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(OMIM_ROOT)/3party/protobuf/protobuf/src",
"$(OMIM_ROOT)/3party/protobuf/protobuf/third_party/abseil-cpp/",
"${PROTOBUF_PATHS}",
);
PRODUCT_NAME = "$(TARGET_NAME)";
};

View file

@ -789,13 +789,7 @@
EXECUTABLE_PREFIX = lib;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(QT_PATH)/include",
"$(OMIM_ROOT)/3party/expat/lib",
"$(OMIM_ROOT)/3party/glm",
"$(OMIM_ROOT)/3party/protobuf/protobuf/third_party/utf8_range/",
"$(OMIM_ROOT)/3party/protobuf/protobuf/third_party/abseil-cpp/",
"$(OMIM_ROOT)/3party/protobuf/protobuf/src",
"$(OMIM_ROOT)/3party/pugixml/pugixml/src",
"${PROTOBUF_PATHS}",
);
PRODUCT_NAME = "$(TARGET_NAME)";
WARNING_CFLAGS = "-Wno-deprecated-register ";
@ -808,13 +802,7 @@
EXECUTABLE_PREFIX = lib;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(QT_PATH)/include",
"$(OMIM_ROOT)/3party/expat/lib",
"$(OMIM_ROOT)/3party/glm",
"$(OMIM_ROOT)/3party/protobuf/protobuf/third_party/utf8_range/",
"$(OMIM_ROOT)/3party/protobuf/protobuf/third_party/abseil-cpp/",
"$(OMIM_ROOT)/3party/protobuf/protobuf/src",
"$(OMIM_ROOT)/3party/pugixml/pugixml/src",
"${PROTOBUF_PATHS}",
);
PRODUCT_NAME = "$(TARGET_NAME)";
WARNING_CFLAGS = "-Wno-deprecated-register ";