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)
13 changes: 11 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": True,
"with_square_detector": True,
"with_classifier_detector": True,
"with_barcode_decoder": True,
Expand Down Expand Up @@ -94,10 +96,13 @@ def requirements(self):
self.requires("libpng/1.6.58", override=True)

def build_requirements(self):
# https://conan.io/center/recipes/cmake
self.tool_requires("cmake/[>=3.22]")
if not self.options.with_wasm_module: # this fails when using emsdk and seems not required there
# 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 +118,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 +152,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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
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
27 changes: 27 additions & 0 deletions setup.WASM.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/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=True" \
-o:a="&:with_uic_interpreter=True" \
-o:a="&:with_vdv_interpreter=True" \
-o:a="&:with_sbb_interpreter=True" \
-pr:h="./etc/conan/profiles/emscripten"

${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
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)

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)
10 changes: 10 additions & 0 deletions source/wasm/source/Binding.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// 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

#ifdef __EMSCRIPTEN__

EMSCRIPTEN_BINDINGS(TicketDecoder) {

};

#endif
Loading