Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reader programming feature #52

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
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
71 changes: 71 additions & 0 deletions .github/workflows/config_make.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# libdmtx - Data Matrix Encoding/Decoding Library
#
# Copyright 2008, 2009 Mike Laughton. All rights reserved.
# Copyright 2012-2016 Vadim A. Misbakh-Soloviov. All rights reserved.
# Copyright 2016 Tim Zaman. All rights reserved.
#
# See LICENSE file in the main project directory for full
# terms of use and distribution.
#
# Contact:
# Vadim A. Misbakh-Soloviov <[email protected]>
# Mike Laughton <[email protected]>

name: config make
description: Build project with configure and make

on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]

workflow_dispatch:


jobs:
with_reader_prog:
name: Reader Programming

strategy:
matrix:
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Run Configure
run: ./configure --enable-static=yes --enable-shared=yes
- name: Build
run: make
- name: Build Tests
run: make check
- name: Run Test
run: |
make check
cd test/simple_test
./simple_test

without_reader_prog:
name: No reader programming

strategy:
matrix:
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Run Configure
run: ./configure --enable-static=yes --enable-shared=yes --disable-reader-programming
- name: Build
run: make
- name: Build Tests
run: make check
- name: Run Test
run: |
make check
cd test/simple_test
./simple_test
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0)
project(DMTX VERSION 0.7.7 LANGUAGES C)
project(DMTX VERSION 1.0.0 LANGUAGES C)

# DMTX library
option(DMTX_SHARED "Build DMTX as shared library" ${BUILD_SHARED_LIBS})
Expand Down
39 changes: 39 additions & 0 deletions README.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,45 @@ Finally run:
Now you should have working dmtx.dll in the folder .libs.


3.1. Building and installing the core library from different folder
-------------------------------------------------------------------

Recent MSYS2 installation uses C:\msys64 root folder, To build libdmtx:

1. install the MSYS2 packages:

$ pacman -S --needed base-devel mingw-w64-x86_64-toolchain autoconf automake make libtool

Details on how to install and setup MSYS2 environment on Windows can be found `here <https://code.visualstudio.com/docs/languages/cpp>`_
and `here <https://www.freecodecamp.org/news/how-to-install-c-and-cpp-compiler-on-windows>`_ .

2. clone git repository
3. open msys2 console and add msys' mingw64 bin folder to path environment variable

$ export PATH=$PATH:/c/msys64/mingw64/bin

4. to create configure script, run
$ ./autogen.sh

5. open the configure file and put as very first instruction the following one
LDFLAGS="-Wl,-no-undefined"

6. from within the libdmtx folder, run

$ ./configure <your building options>
$ make

Now, into .libs subfolder, you should find following files:

libdmtx.a libdmtx.la libdmtx.lai libdmtx_la-dmtx.o

Then finally run:

$ gcc -shared -o dmtx.dll libdmtx_la-dmtx.o -Wl,--out-implib,libdmtx.a

Now you should have working dmtx.dll in the folder .libs.


4. This Document
-----------------------------------------------------------------

Expand Down
9 changes: 8 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([libdmtx], [0.7.7], [https://github.com/dmtx/libdmtx/issues], [libdmtx], [https://github.com/dmtx/libdmtx])
AC_INIT([libdmtx], [1.0.0], [https://github.com/dmtx/libdmtx/issues], [libdmtx], [https://github.com/dmtx/libdmtx])
AM_INIT_AUTOMAKE([-Wall -Werror])

AC_CONFIG_MACRO_DIR([m4])
Expand All @@ -14,6 +14,13 @@ AC_PROG_CC
AC_PROG_LIBTOOL
AM_PROG_CC_C_O


AC_ARG_ENABLE([reader_programming], [AS_HELP_STRING([--disable-reader-programming], [Disable Reader Programming breaking feature.])], [], [enable_reader_programming=yes] )
AS_IF([test "x$enable_reader_programming" != "xno"], [
AC_DEFINE([HAVE_READER_PROGRAMMING], [1], [Reader Programming breaking feature.])
])


AC_SEARCH_LIBS([sin], [m] ,[], AC_MSG_ERROR([libdmtx requires libm]))
AC_SEARCH_LIBS([cos], [m] ,[], AC_MSG_ERROR([libdmtx requires libm]))
AC_SEARCH_LIBS([atan2], [m] ,[], AC_MSG_ERROR([libdmtx requires libm]))
Expand Down
25 changes: 18 additions & 7 deletions dmtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,32 @@
#include <errno.h>
#include <assert.h>
#include <math.h>
#include "dmtx.h"
#include "dmtxstatic.h"

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "dmtx.h"
#include "dmtxstatic.h"

#ifndef CALLBACK_POINT_PLOT
#define CALLBACK_POINT_PLOT(a,b,c,d)
#define CALLBACK_POINT_PLOT(a, b, c, d)
#endif

#ifndef CALLBACK_POINT_XFRM
#define CALLBACK_POINT_XFRM(a,b,c,d)
#define CALLBACK_POINT_XFRM(a, b, c, d)
#endif

#ifndef CALLBACK_MODULE
#define CALLBACK_MODULE(a,b,c,d,e)
#define CALLBACK_MODULE(a, b, c, d, e)
#endif

#ifndef CALLBACK_MATRIX
#define CALLBACK_MATRIX(a)
#endif

#ifndef CALLBACK_FINAL
#define CALLBACK_FINAL(a,b)
#define CALLBACK_FINAL(a, b)
#endif

/**
Expand Down Expand Up @@ -87,5 +88,15 @@
extern char *
dmtxVersion(void)
{
return DmtxVersion;
return DmtxVersion;
}

extern DmtxBoolean
dmtxHasReaderProgramming(void)
{
#ifdef HAVE_READER_PROGRAMMING
return DmtxTrue;
#else
return DmtxFalse;
#endif
}
Loading