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

Build system tweaks #62

Open
wants to merge 3 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
27 changes: 19 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ include(source_files.cmake)

if(WIN32)
include_directories(core/lib/win32)
set(CMAKE_DEBUG_POSTFIX -debug)
if(CMAKE_BUILD_TYPE EQUAL Debug)
set(CMAKE_DEBUG_POSTFIX d)
endif()
endif()

# OpenCV classes
find_package(OpenCV)
find_package(OpenCV QUIET)
if(OpenCV_FOUND)
list(APPEND LIBZXING_FILES
opencv/src/zxing/MatSource.cpp
Expand All @@ -55,10 +57,17 @@ if(OpenCV_FOUND)
endif()

include_directories(core/src)
add_library(libzxing ${LIBZXING_FILES})
add_library(libzxing SHARED ${LIBZXING_FILES})
set_target_properties(libzxing PROPERTIES PREFIX "")

find_package(Iconv)
include(GenerateExportHeader)
generate_export_header(libzxing EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/zxing_export.h)
target_include_directories(libzxing PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<INSTALL_INTERFACE:include>
)

find_package(Iconv QUIET)
if(ICONV_FOUND)
include_directories(${ICONV_INCLUDE_DIR})
target_link_libraries(libzxing ${ICONV_LIBRARIES})
Expand All @@ -85,13 +94,15 @@ file(GLOB_RECURSE ZXING_FILES
add_executable(zxing ${ZXING_FILES})
target_link_libraries(zxing libzxing)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zxing_export.h
DESTINATION include
)
install(TARGETS zxing libzxing EXPORT zxing-targets
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include
)

install(EXPORT zxing-targets DESTINATION lib/zxing/cmake NAMESPACE zxing::)

install(
Expand Down
6 changes: 4 additions & 2 deletions core/src/zxing/BarcodeFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* limitations under the License.
*/

#include <zxing_export.h>

namespace zxing {

class BarcodeFormat {
Expand Down Expand Up @@ -48,11 +50,11 @@ class BarcodeFormat {
UPC_EAN_EXTENSION
};

BarcodeFormat(Value v) : value(v) {}
BarcodeFormat(Value v) : value(v) {}
const Value value;
operator Value () const {return value;}

static char const* barcodeFormatNames[];
static LIBZXING_EXPORT char const* barcodeFormatNames[];
};

}
Expand Down
55 changes: 28 additions & 27 deletions core/src/zxing/DecodeHints.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* limitations under the License.
*/

#include <zxing_export.h>
#include <zxing/BarcodeFormat.h>
#include <zxing/ResultPointCallback.h>

Expand All @@ -35,34 +36,34 @@ class DecodeHints {
Ref<ResultPointCallback> callback;

public:
static const DecodeHintType AZTEC_HINT = 1 << BarcodeFormat::AZTEC;
static const DecodeHintType CODABAR_HINT = 1 << BarcodeFormat::CODABAR;
static const DecodeHintType CODE_39_HINT = 1 << BarcodeFormat::CODE_39;
static const DecodeHintType CODE_93_HINT = 1 << BarcodeFormat::CODE_93;
static const DecodeHintType CODE_128_HINT = 1 << BarcodeFormat::CODE_128;
static const DecodeHintType DATA_MATRIX_HINT = 1 << BarcodeFormat::DATA_MATRIX;
static const DecodeHintType EAN_8_HINT = 1 << BarcodeFormat::EAN_8;
static const DecodeHintType EAN_13_HINT = 1 << BarcodeFormat::EAN_13;
static const DecodeHintType ITF_HINT = 1 << BarcodeFormat::ITF;
static const DecodeHintType MAXICODE_HINT = 1 << BarcodeFormat::MAXICODE;
static const DecodeHintType PDF_417_HINT = 1 << BarcodeFormat::PDF_417;
static const DecodeHintType QR_CODE_HINT = 1 << BarcodeFormat::QR_CODE;
static const DecodeHintType RSS_14_HINT = 1 << BarcodeFormat::RSS_14;
static const DecodeHintType RSS_EXPANDED_HINT = 1 << BarcodeFormat::RSS_EXPANDED;
static const DecodeHintType UPC_A_HINT = 1 << BarcodeFormat::UPC_A;
static const DecodeHintType UPC_E_HINT = 1 << BarcodeFormat::UPC_E;
static const DecodeHintType UPC_EAN_EXTENSION_HINT = 1 << BarcodeFormat::UPC_EAN_EXTENSION;
static LIBZXING_EXPORT const DecodeHintType AZTEC_HINT = 1 << BarcodeFormat::AZTEC;
static LIBZXING_EXPORT const DecodeHintType CODABAR_HINT = 1 << BarcodeFormat::CODABAR;
static LIBZXING_EXPORT const DecodeHintType CODE_39_HINT = 1 << BarcodeFormat::CODE_39;
static LIBZXING_EXPORT const DecodeHintType CODE_93_HINT = 1 << BarcodeFormat::CODE_93;
static LIBZXING_EXPORT const DecodeHintType CODE_128_HINT = 1 << BarcodeFormat::CODE_128;
static LIBZXING_EXPORT const DecodeHintType DATA_MATRIX_HINT = 1 << BarcodeFormat::DATA_MATRIX;
static LIBZXING_EXPORT const DecodeHintType EAN_8_HINT = 1 << BarcodeFormat::EAN_8;
static LIBZXING_EXPORT const DecodeHintType EAN_13_HINT = 1 << BarcodeFormat::EAN_13;
static LIBZXING_EXPORT const DecodeHintType ITF_HINT = 1 << BarcodeFormat::ITF;
static LIBZXING_EXPORT const DecodeHintType MAXICODE_HINT = 1 << BarcodeFormat::MAXICODE;
static LIBZXING_EXPORT const DecodeHintType PDF_417_HINT = 1 << BarcodeFormat::PDF_417;
static LIBZXING_EXPORT const DecodeHintType QR_CODE_HINT = 1 << BarcodeFormat::QR_CODE;
static LIBZXING_EXPORT const DecodeHintType RSS_14_HINT = 1 << BarcodeFormat::RSS_14;
static LIBZXING_EXPORT const DecodeHintType RSS_EXPANDED_HINT = 1 << BarcodeFormat::RSS_EXPANDED;
static LIBZXING_EXPORT const DecodeHintType UPC_A_HINT = 1 << BarcodeFormat::UPC_A;
static LIBZXING_EXPORT const DecodeHintType UPC_E_HINT = 1 << BarcodeFormat::UPC_E;
static LIBZXING_EXPORT const DecodeHintType UPC_EAN_EXTENSION_HINT = 1 << BarcodeFormat::UPC_EAN_EXTENSION;

static const DecodeHintType TRYHARDER_HINT = 1 << 31;
static const DecodeHintType CHARACTER_SET = 1 << 30;
// static const DecodeHintType ALLOWED_LENGTHS = 1 << 29;
// static const DecodeHintType ASSUME_CODE_39_CHECK_DIGIT = 1 << 28;
static const DecodeHintType ASSUME_GS1 = 1 << 27;
// static const DecodeHintType NEED_RESULT_POINT_CALLBACK = 1 << 26;
static const DecodeHints PRODUCT_HINT;
static const DecodeHints ONED_HINT;
static const DecodeHints DEFAULT_HINT;
static LIBZXING_EXPORT const DecodeHintType TRYHARDER_HINT = 1 << 31;
static LIBZXING_EXPORT const DecodeHintType CHARACTER_SET = 1 << 30;
// static LIBZXING_EXPORT const DecodeHintType ALLOWED_LENGTHS = 1 << 29;
// static LIBZXING_EXPORT const DecodeHintType ASSUME_CODE_39_CHECK_DIGIT = 1 << 28;
static LIBZXING_EXPORT const DecodeHintType ASSUME_GS1 = 1 << 27;
// static LIBZXING_EXPORT const DecodeHintType NEED_RESULT_POINT_CALLBACK = 1 << 26;

static LIBZXING_EXPORT const DecodeHints PRODUCT_HINT;
static LIBZXING_EXPORT const DecodeHints ONED_HINT;
static LIBZXING_EXPORT const DecodeHints DEFAULT_HINT;

DecodeHints();
DecodeHints(DecodeHintType init);
Expand Down