forked from zxing/zxing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in INT-2172-add-conan-recipe (pull request #1)
INT-2172 add conan recipe Remove zxing-cli binary Approved-by: David Wagner <david.wagner@pix4d.com> Approved-by: David Sinuela <david.sinuela@pix4d.com> Approved-by: Salah Missri <salah.missri@pix4d.com> Approved-by: Alessandro Degano <alessandro.degano@pix4d.com>
- Loading branch information
Showing
6 changed files
with
96 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.DS_Store | ||
/.idea/ | ||
/build/ | ||
/test_package/build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from conans import ConanFile, CMake, tools | ||
|
||
class ZxingConan(ConanFile): | ||
name = 'zxing' | ||
lib_version = '3.3.3' | ||
revision = '2' | ||
version = '{}-{}'.format(lib_version, revision) | ||
settings = 'os', 'compiler', 'build_type', 'arch' | ||
description = 'Zxing recipe' | ||
url = 'git@bitbucket.org:pix4d/zxing.git' | ||
license = 'GNU LESSER GENERAL PUBLIC LICENSE' | ||
generators = 'cmake' | ||
scm = { | ||
'type': 'git', | ||
'revision': 'auto', | ||
'url': 'auto', | ||
} | ||
|
||
def build(self): | ||
cmake_args = { | ||
'CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS': 'TRUE', | ||
'BUILD_SHARED_LIBS': 'TRUE', | ||
'WITH_OPENCV': 'OFF', | ||
} | ||
cmake = CMake(self, parallel=True) | ||
cmake.configure(build_dir='build', defs=cmake_args) | ||
cmake.build(target='install') | ||
|
||
def package_info(self): | ||
self.cpp_info.includedirs = ['include'] | ||
self.cpp_info.libdirs = ['lib'] | ||
self.cpp_info.bindirs = ['bin'] | ||
self.cpp_info.libs = ['zxing'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(ZxingTest) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
|
||
if (UNIX) | ||
conan_set_find_paths() | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") | ||
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) | ||
if (APPLE) | ||
set(CMAKE_INSTALL_RPATH "@executable_path/../lib") | ||
else() | ||
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") | ||
endif() | ||
else() | ||
conan_basic_setup() | ||
endif() | ||
|
||
find_package(zxing REQUIRED) | ||
find_library(ZXING_LIBRARY NAMES zxing PATHS ${CONAN_LIB_DIRS_ZXING}) | ||
|
||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
add_executable(testApp main.cpp) | ||
target_link_libraries(testApp PRIVATE ${ZXING_LIBRARY}) | ||
target_include_directories(testApp PRIVATE ${CONAN_INCLUDE_DIRS_ZXING}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from conans import ConanFile, CMake | ||
import os | ||
|
||
class ZxingTestConan(ConanFile): | ||
settings = 'os', 'compiler', 'build_type', 'arch' | ||
generators = 'cmake' | ||
|
||
def imports(self): | ||
self.copy('*.dll', src='bin', dst='bin') | ||
self.copy('*.dylib*', src='lib', dst='lib') | ||
self.copy('*.so*', src='lib', dst='lib') | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
self.run(os.path.join(os.curdir, 'bin', 'testApp')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <iostream> | ||
#include <zxing/qrcode/QRCodeReader.h> | ||
|
||
int main() | ||
{ | ||
zxing::qrcode::QRCodeReader reader; | ||
|
||
std::cout << "Compile & Link Zxing test application correctly" << std::endl; | ||
return EXIT_SUCCESS; | ||
} |