load("@rules_cc//cc:defs.bzl", "cc_library") exports_files(["config"]) # Mirrors the CMake configure_file step in lib/CMakeLists.txt that embeds the # canonical NetworkConfiguration_1 schema into a generated translation unit so # blob migration can bootstrap a per-slot component without a filesystem read. genrule( name = "network_configuration_default_schema_cpp", srcs = [ "lib/ocpp/v2/network_configuration_default_schema.cpp.in", "config/common/component_config/standardized/NetworkConfiguration_1.json", ], outs = ["generated/network_configuration_default_schema.cpp"], cmd = """python3 - "$(location lib/ocpp/v2/network_configuration_default_schema.cpp.in)" "$(location config/common/component_config/standardized/NetworkConfiguration_1.json)" "$@" <<'PYEOF' import sys tpl_path, json_path, out_path = sys.argv[1], sys.argv[2], sys.argv[3] with open(tpl_path) as f: tpl = f.read() with open(json_path) as f: js = f.read() with open(out_path, 'w') as f: f.write(tpl.replace('@OCPP_NETWORK_CONFIGURATION_DEFAULT_SCHEMA_JSON@', js)) PYEOF """, visibility = ["//visibility:private"], ) cc_library( name = "websocketpp_utils", hdrs = glob([ "3rd_party/websocketpp_utils/*.hpp", ]), includes = ["3rd_party"], visibility = ["//visibility:private"], ) cc_library( name = "libocpp", srcs = glob([ "lib/ocpp/common/*.cpp", "lib/ocpp/common/database/*.cpp", "lib/ocpp/v16/*.cpp", "lib/ocpp/v2/*.cpp", "lib/ocpp/v2/functional_blocks/*.cpp", "lib/ocpp/v21/functional_blocks/*.cpp", "lib/ocpp/common/websocket/*.cpp", "lib/ocpp/v16/messages/*.cpp", "lib/ocpp/v2/messages/*.cpp", "lib/ocpp/v21/messages/*.cpp", ]) + [":network_configuration_default_schema_cpp"], hdrs = glob([ "include/**/*.hpp", ]), strip_include_prefix = "include", visibility = ["//visibility:public"], deps = [ ":websocketpp_utils", "//third-party/bazel/openssl:crypto", "//third-party/bazel/openssl:ssl", "@com_github_nlohmann_json//:json", "@com_github_HowardHinnant_date//:date", "//lib/everest/framework:framework", "//lib/everest/timer:libtimer", "//lib/everest/evse_security:libevse-security", "@com_github_pboettch_json-schema-validator//:json-schema-validator", "@com_github_warmcatt_libwebsockets//:libwebsockets", "//lib/everest/sqlite:everest-sqlite", ], copts = [ "-std=c++17", "-Wimplicit-fallthrough", "-Wno-error=switch-enum", # boost.date_time 1.87.0 has incomplete switch statements ], defines = [ "LIBOCPP_ENABLE_V16=1", "LIBOCPP_ENABLE_V2=1", "MIGRATION_FILE_VERSION_V16=1", "MIGRATION_FILE_VERSION_V2=6", "MIGRATION_DEVICE_MODEL_FILE_VERSION_V2=3", ], # See https://github.com/HowardHinnant/date/issues/324 local_defines = [ "BUILD_TZ_LIB=ON", "USE_SYSTEM_TZ_DB=ON", "USE_OS_TZDB=1", "USE_AUTOLOAD=0", "HAS_REMOTE_API=0", ], )