Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ IF (WITH_PYTHON_MODULE)
add_subdirectory(source/python)
ENDIF()

IF (WITH_WASM_MODULE)
add_subdirectory(source/wasm)
ENDIF()

add_subdirectory(source/test)
10 changes: 9 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class TicketDecoderConan(ConanFile):
name = 'ticket-decoder'
version = 'v0.20'
version = 'v0.21'
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps"
options = {
Expand All @@ -18,6 +18,7 @@ class TicketDecoderConan(ConanFile):
"with_ticket_analyzer": [True, False],
"with_ticket_decoder": [True, False],
"with_python_module": [True, False],
"with_wasm_module": [True, False],
"with_square_detector": [True, False],
"with_classifier_detector": [True, False],
"with_barcode_decoder": [True, False],
Expand All @@ -35,6 +36,7 @@ class TicketDecoderConan(ConanFile):
"with_ticket_analyzer": True,
"with_ticket_decoder": True,
"with_python_module": True,
"with_wasm_module": False,
"with_square_detector": True,
"with_classifier_detector": True,
"with_barcode_decoder": True,
Expand Down Expand Up @@ -96,8 +98,10 @@ def requirements(self):
def build_requirements(self):
# https://conan.io/center/recipes/cmake
self.tool_requires("cmake/[>=3.22]")

#https://conan.io/center/recipes/ninja
self.tool_requires("ninja/[>=1.13]")

# https://conan.io/center/recipes/gtest
self.test_requires("gtest/1.17.0")

Expand All @@ -113,6 +117,9 @@ def generate(self):
if self.options.with_python_module:
TicketDecoderConan.add_config_switch(toolchain, "WITH_PYTHON_MODULE")

if self.options.with_wasm_module:
TicketDecoderConan.add_config_switch(toolchain, "WITH_WASM_MODULE")

if self.options.with_square_detector:
TicketDecoderConan.add_config_switch(toolchain, "WITH_SQUARE_DETECTOR")

Expand Down Expand Up @@ -144,6 +151,7 @@ def configure(self):
self.output.highlight("with_ticket_analyzer: " + str(self.options.with_ticket_analyzer))
self.output.highlight("with_ticket_decoder: " + str(self.options.with_ticket_decoder))
self.output.highlight("with_python_module: " + str(self.options.with_python_module))
self.output.highlight("with_wasm_module: " + str(self.options.with_wasm_module))
self.output.highlight("with_square_detector: " + str(self.options.with_square_detector))
self.output.highlight("with_classifier_detector: " + str(self.options.with_classifier_detector))
self.output.highlight("with_barcode_decoder: " + str(self.options.with_barcode_decoder))
Expand Down
10 changes: 10 additions & 0 deletions etc/conan/profiles/emscripten
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
os=Emscripten
arch=wasm64
compiler=clang
compiler.version=16
compiler.libcxx=libc++
compiler.cppstd=20

[tool_requires]
emsdk/3.1.73
2 changes: 2 additions & 0 deletions etc/poppler/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class PopplerCppConan(ConanFile):
"with_ticket_analyzer": None,
"with_ticket_decoder": None,
"with_python_module": None,
"with_wasm_module": None,
"with_square_detector": None,
"with_classifier_detector": None,
"with_barcode_decoder": None,
Expand Down Expand Up @@ -73,6 +74,7 @@ def configure(self):
self.options.rm_safe("with_ticket_analyzer")
self.options.rm_safe("with_ticket_decoder")
self.options.rm_safe("with_python_module")
self.options.rm_safe("with_wasm_module")
self.options.rm_safe("with_square_detector")
self.options.rm_safe("with_classifier_detector")
self.options.rm_safe("with_barcode_decoder")
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[project]
name = "ticket-decoder"
version = "v0.20.1"
version = "v0.21.0"
description = "Train ticket barcode to json decoding library, using zxing-cpp decoding in combination with record interpreter, to transform content into json structure"
license = "GPL-3.0-or-later"
authors = [ { name = "user4223" } ]
Expand Down Expand Up @@ -66,6 +66,7 @@ options-all = [
"&:with_ticket_analyzer=False",
"&:with_ticket_decoder=False",
"&:with_python_module=True",
"&:with_wasm_module=False",
"&:with_square_detector=False",
"&:with_classifier_detector=False",
"&:with_barcode_decoder=True",
Expand Down
1 change: 1 addition & 0 deletions setup.All.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ${WORKSPACE_ROOT}/etc/conan-install.sh ${BUILD_TYPE} \
-o:a="&:with_ticket_analyzer=True" \
-o:a="&:with_ticket_decoder=True" \
-o:a="&:with_python_module=True" \
-o:a="&:with_wasm_module=False" \
-o:a="&:with_square_detector=True" \
-o:a="&:with_classifier_detector=True" \
-o:a="&:with_barcode_decoder=True" \
Expand Down
1 change: 1 addition & 0 deletions setup.Decoder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ${WORKSPACE_ROOT}/etc/conan-install.sh ${BUILD_TYPE} \
-o:a="&:with_ticket_analyzer=False" \
-o:a="&:with_ticket_decoder=True" \
-o:a="&:with_python_module=False" \
-o:a="&:with_wasm_module=False" \
-o:a="&:with_square_detector=False" \
-o:a="&:with_classifier_detector=False" \
-o:a="&:with_barcode_decoder=True" \
Expand Down
28 changes: 28 additions & 0 deletions setup.WASM.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: (C) 2022 user4223 and (other) contributors to ticket-decoder <https://github.com/user4223/ticket-decoder>
# SPDX-License-Identifier: GPL-3.0-or-later

set -o errexit

readonly WORKSPACE_ROOT="$(readlink -f $(dirname "$0"))"
readonly BUILD_TYPE=${1:-Release}

${WORKSPACE_ROOT}/etc/conan-config.sh
${WORKSPACE_ROOT}/etc/conan-install.sh ${BUILD_TYPE} \
-o:a="&:with_ticket_analyzer=False" \
-o:a="&:with_ticket_decoder=False" \
-o:a="&:with_python_module=False" \
-o:a="&:with_wasm_module=True" \
-o:a="&:with_square_detector=False" \
-o:a="&:with_classifier_detector=False" \
-o:a="&:with_barcode_decoder=True" \
-o:a="&:with_pdf_input=True" \
-o:a="&:with_signature_verifier=False" \
-o:a="&:with_uic_interpreter=True" \
-o:a="&:with_vdv_interpreter=True" \
-o:a="&:with_sbb_interpreter=True" \
-pr:h="./etc/conan/profiles/emscripten" \
-pr:b="./etc/conan/profiles/macos15"

${WORKSPACE_ROOT}/etc/cmake-config.sh ${BUILD_TYPE}
${WORKSPACE_ROOT}/build.sh ${BUILD_TYPE} ${@:2}
2 changes: 1 addition & 1 deletion source/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: (C) 2022 user4223 and (other) contributors to ticket-decoder <https://github.com/user4223/ticket-decoder>
# SPDX-License-Identifier: GPL-3.0-or-later

project(ticket-decoder)
project(ticket-decoder-app)

find_package(tclap REQUIRED)

Expand Down
2 changes: 1 addition & 1 deletion source/app/source/analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

int main(int argc, char **argv)
{
auto cmd = TCLAP::CmdLine("ticket-analyzer", ' ', "v0.20");
auto cmd = TCLAP::CmdLine("ticket-analyzer", ' ', "v0.21");
auto const verboseArg = TCLAP::SwitchArg(
"v", "verbose",
"More verbose debug logging",
Expand Down
2 changes: 1 addition & 1 deletion source/app/source/decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

int main(int argc, char **argv)
{
auto cmd = TCLAP::CmdLine("ticket-decoder", ' ', "v0.20");
auto cmd = TCLAP::CmdLine("ticket-decoder", ' ', "v0.21");
auto const verboseArg = TCLAP::SwitchArg(
"v", "verbose",
"More verbose debug logging",
Expand Down
11 changes: 11 additions & 0 deletions source/wasm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: (C) 2026 user4223 and (other) contributors to ticket-decoder <https://github.com/user4223/ticket-decoder>
# SPDX-License-Identifier: GPL-3.0-or-later

PROJECT(ticket-decoder-wasm)

AUX_SOURCE_DIRECTORY("source" PROJECT_SOURCE)
file(GLOB PROJECT_INCLUDES "include/*.h")

ADD_LIBRARY(${PROJECT_NAME} STATIC ${PROJECT_SOURCE} ${PROJECT_INCLUDES})
target_include_directories(${PROJECT_NAME} PRIVATE)
target_link_libraries(${PROJECT_NAME} PRIVATE)
23 changes: 23 additions & 0 deletions source/wasm/source/Binding.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: (C) 2026 user4223 and (other) contributors to ticket-decoder <https://github.com/user4223/ticket-decoder>
// SPDX-License-Identifier: GPL-3.0-or-later

#include <emscripten/bind.h>

#include "lib/infrastructure/include/Context.h"

#include "lib/api/include/DecoderFacade.h"

class DecoderFacadeWrapper
{
std::string decodeBase64(std::string const &base64)
{
return "hello world";
}
};

EMSCRIPTEN_BINDINGS(TicketDecoder) {

emscripten::class_<DecoderFacadeWrapper>("DecoderFacade")
.constructor<>()
.function("decodeBase64", &DecoderFacadeWrapper::decodeBase64);
};
Loading