-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to compile the libraries with a CMake generated project
- Loading branch information
Cameron Lowell Palmer
committed
Jul 11, 2024
1 parent
84f369d
commit f936414
Showing
35 changed files
with
1,144 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
cmake_minimum_required( VERSION 3.5 ) | ||
|
||
project( ZXingObjC VERSION 3.4.5 ) | ||
|
||
option( ZXINGOBJC_AZTEC "Aztec barcode support" TRUE ) | ||
option( ZXINGOBJC_DATAMATRIX "Datamatrix support" TRUE ) | ||
option( ZXINGOBJC_MAXICODE "Maxicode support" TRUE ) | ||
option( ZXINGOBJC_ONED "1D barcode support" TRUE ) | ||
option( ZXINGOBJC_PDF417 "PDF417 support" TRUE ) | ||
option( ZXINGOBJC_QRCODE "QR code support" TRUE ) | ||
|
||
add_subdirectory( client ) | ||
add_subdirectory( common ) | ||
add_subdirectory( core ) | ||
|
||
add_subdirectory( aztec ) | ||
add_subdirectory( datamatrix ) | ||
add_subdirectory( maxicode ) | ||
add_subdirectory( multi ) | ||
add_subdirectory( oned ) | ||
add_subdirectory( pdf417 ) | ||
add_subdirectory( qrcode ) | ||
|
||
|
||
set( SOURCE_FILES | ||
ZXMultiFormatReader.m | ||
ZXMultiFormatWriter.m ) | ||
|
||
set( HEADER_FILES | ||
ZXMultiFormatReader.h | ||
ZXMultiFormatWriter.h ) | ||
|
||
add_library( zxing SHARED ${HEADER_FILES} ${SOURCE_FILES} ) | ||
|
||
target_link_libraries( zxing PRIVATE client common core multi ) | ||
find_library( AVFOUNDATION_FRAMEWORK AVFoundation ) | ||
find_library( QUARTZCORE_FRAMEWORK QuartzCore ) | ||
target_link_libraries( zxing PRIVATE ${AVFOUNDATION_FRAMEWORK} ${QUARTZCORE_FRAMEWORK} ) | ||
|
||
if( CMAKE_SYSTEM_NAME STREQUAL Darwin ) | ||
find_library( COCOA_FRAMEWORK Cocoa ) | ||
find_library( COREMEDIA_FRAMEWORK CoreMedia ) | ||
target_link_libraries( zxing PRIVATE ${COCOA_FRAMEWORK} ${COREMEDIA_FRAMEWORK} ) | ||
endif() | ||
|
||
if( CMAKE_SYSTEM_NAME STREQUAL iOS ) | ||
find_library( UIKIT_FRAMEWORK UIKit ) | ||
find_library( COREGRAPHICS_FRAMEWORK CoreGraphics ) | ||
find_library( COREVIDEO_FRAMEWORK CoreVideo ) | ||
find_library( IMAGEIO_FRAMEWORK ImageIO ) | ||
target_link_libraries( zxing | ||
PRIVATE | ||
${COREGRAPHICS_FRAMEWORK} | ||
${COREVIDEO_FRAMEWORK} | ||
${IMAGEIO_FRAMEWORK} | ||
${UIKIT_FRAMEWORK} ) | ||
endif() | ||
|
||
set( ZXINGOBJC_PUBLIC_HEADERS ) | ||
list( APPEND ZXINGOBJC_PUBLIC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/core/ZXingObjCCore.h ) | ||
list( APPEND ZXINGOBJC_PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/ZXingObjC.h ) | ||
if( ZXINGOBJC_AZTEC ) | ||
target_link_libraries( zxing PRIVATE aztec ) | ||
target_include_directories( zxing PUBLIC aztec ) | ||
list( APPEND ZXINGOBJC_PUBLIC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/aztec/ZXingObjCAztec.h ) | ||
endif( ZXINGOBJC_AZTEC ) | ||
|
||
if( ZXINGOBJC_DATAMATRIX ) | ||
target_link_libraries( zxing PRIVATE datamatrix ) | ||
target_include_directories( zxing PUBLIC datamatrix ) | ||
list( APPEND ZXINGOBJC_PUBLIC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/datamatrix/ZXingObjCDataMatrix.h ) | ||
endif( ZXINGOBJC_DATAMATRIX ) | ||
|
||
if( ZXINGOBJC_MAXICODE ) | ||
target_link_libraries( zxing PRIVATE maxicode ) | ||
target_include_directories( zxing PUBLIC maxicode ) | ||
list( APPEND ZXINGOBJC_PUBLIC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/maxicode/ZXingObjCMaxiCode.h ) | ||
endif( ZXINGOBJC_MAXICODE ) | ||
|
||
if( ZXINGOBJC_ONED ) | ||
target_link_libraries( zxing PRIVATE oned ) | ||
target_include_directories( zxing PUBLIC oned ) | ||
list( APPEND ZXINGOBJC_PUBLIC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/oned/ZXingObjCOneD.h ) | ||
endif( ZXINGOBJC_ONED ) | ||
|
||
if( ZXINGOBJC_PDF417 ) | ||
target_link_libraries( zxing PRIVATE pdf417 ) | ||
target_include_directories( zxing PUBLIC pdf417 ) | ||
list( APPEND ZXINGOBJC_PUBLIC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/pdf417/ZXingObjCPDF417.h ) | ||
endif( ZXINGOBJC_PDF417 ) | ||
|
||
if( ZXINGOBJC_QRCODE ) | ||
target_link_libraries( zxing PRIVATE qrcode ) | ||
target_include_directories( zxing PUBLIC qrcode ) | ||
list( APPEND ZXINGOBJC_PUBLIC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/qrcode/ZXingObjCQRCode.h ) | ||
endif( ZXINGOBJC_QRCODE ) | ||
|
||
list( APPEND ZXINGOBJC_PUBLIC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/ZXMultiFormatReader.h ) | ||
list( APPEND ZXINGOBJC_PUBLIC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/ZXMultiFormatWriter.h ) | ||
set_target_properties( zxing PROPERTIES | ||
FRAMEWORK TRUE | ||
OUTPUT_NAME ZXingObjC | ||
MACOSX_FRAMEWORK_IDENTIFIER com.zxing.ZXingObjC | ||
PUBLIC_HEADER "${ZXINGOBJC_PUBLIC_HEADERS}" ) | ||
|
||
target_sources( zxing PUBLIC ${ZXINGOBJC_PUBLIC_HEADERS} ) | ||
|
||
foreach( ZXINGOBJC_PUBLIC_HEADER ${ZXINGOBJC_PUBLIC_HEADERS} ) | ||
get_filename_component( ZXINGOBJC_SUBSPEC ${ZXINGOBJC_PUBLIC_HEADER} NAME ) | ||
string( APPEND ZXINGOBJC_UMBRELLA_IMPORTS "#import <ZXingObjC/${ZXINGOBJC_SUBSPEC}>\n" ) | ||
endforeach() | ||
configure_file( ZXingObjC.h.in ${CMAKE_CURRENT_BINARY_DIR}/ZXingObjC.h ) |
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 @@ | ||
/* | ||
* Copyright 2012 ZXing authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
${ZXINGOBJC_UMBRELLA_IMPORTS} |
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.5 ) | ||
|
||
project( ZXingObjC-aztec ) | ||
|
||
set( HEADER_FILES | ||
ZXAztecWriter.h | ||
ZXingObjCAztec.h | ||
ZXAztecDetectorResult.h | ||
ZXAztecReader.h ) | ||
|
||
set( SOURCE_FILES | ||
ZXAztecDetectorResult.m | ||
ZXAztecReader.m | ||
ZXAztecWriter.m ) | ||
|
||
add_library( aztec STATIC ${HEADER_FILES} ${SOURCE_FILES} ) | ||
target_link_libraries( aztec | ||
PRIVATE | ||
common | ||
common-detector | ||
common-reedsolomon | ||
core | ||
aztec-decoder | ||
aztec-detector | ||
aztec-encoder ) | ||
target_include_directories( aztec | ||
PUBLIC | ||
${CMAKE_CURRENT_LIST_DIR} ) | ||
|
||
add_subdirectory( encoder ) | ||
add_subdirectory( decoder ) | ||
add_subdirectory( detector ) |
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 @@ | ||
cmake_minimum_required( VERSION 3.5 ) | ||
|
||
project( ZXingObjC-aztec-decoder ) | ||
|
||
set( HEADER_FILES | ||
ZXAztecDecoder.h ) | ||
|
||
set( SOURCE_FILES | ||
ZXAztecDecoder.m ) | ||
|
||
add_library( aztec-decoder OBJECT ${HEADER_FILES} ${SOURCE_FILES} ) | ||
target_link_libraries( aztec-decoder PRIVATE common ) | ||
target_include_directories( aztec-decoder | ||
PRIVATE | ||
$<TARGET_PROPERTY:aztec,INCLUDE_DIRECTORIES> | ||
PUBLIC | ||
${CMAKE_CURRENT_LIST_DIR} ) | ||
set_property( TARGET aztec-decoder APPEND_STRING PROPERTY COMPILE_FLAGS -fobjc-arc ) | ||
|
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,18 @@ | ||
cmake_minimum_required( VERSION 3.5 ) | ||
|
||
project( ZXingObjC-aztec-detector ) | ||
|
||
set( HEADER_FILES | ||
ZXAztecDetector.h ) | ||
|
||
set( SOURCE_FILES | ||
ZXAztecDetector.m ) | ||
|
||
add_library( aztec-detector OBJECT ${HEADER_FILES} ${SOURCE_FILES} ) | ||
target_include_directories( aztec-detector | ||
PRIVATE | ||
$<TARGET_PROPERTY:aztec,INCLUDE_DIRECTORIES> | ||
PUBLIC | ||
${CMAKE_CURRENT_LIST_DIR} ) | ||
set_property( TARGET aztec-detector APPEND_STRING PROPERTY COMPILE_FLAGS -fobjc-arc ) | ||
|
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,29 @@ | ||
cmake_minimum_required( VERSION 3.5 ) | ||
|
||
project( ZXingObjC-aztec-encoder ) | ||
|
||
set( HEADER_FILES | ||
ZXAztecEncoder.h | ||
ZXAztecHighLevelEncoder.h | ||
ZXAztecSimpleToken.h | ||
ZXAztecBinaryShiftToken.h | ||
ZXAztecState.h | ||
ZXAztecToken.h | ||
ZXAztecCode.h ) | ||
|
||
set( SOURCE_FILES | ||
ZXAztecToken.m | ||
ZXAztecState.m | ||
ZXAztecBinaryShiftToken.m | ||
ZXAztecCode.m | ||
ZXAztecHighLevelEncoder.m | ||
ZXAztecEncoder.m | ||
ZXAztecSimpleToken.m ) | ||
|
||
add_library( aztec-encoder OBJECT ${HEADER_FILES} ${SOURCE_FILES} ) | ||
target_link_libraries( aztec-encoder PRIVATE common common-reedsolomon ) | ||
target_include_directories( aztec-encoder | ||
PUBLIC | ||
${CMAKE_CURRENT_LIST_DIR} ) | ||
set_property( TARGET aztec-encoder APPEND_STRING PROPERTY COMPILE_FLAGS -fobjc-arc ) | ||
|
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,25 @@ | ||
cmake_minimum_required( VERSION 3.5 ) | ||
|
||
project( ZXingObjC-client ) | ||
|
||
set( HEADER_FILES | ||
ZXCaptureDelegate.h | ||
ZXCGImageLuminanceSourceInfo.h | ||
ZXImage.h | ||
ZXCGImageLuminanceSource.h | ||
ZXCapture.h ) | ||
|
||
set( SOURCE_FILES | ||
ZXImage.m | ||
ZXCapture.m | ||
ZXCGImageLuminanceSource.m | ||
ZXCGImageLuminanceSourceInfo.m ) | ||
|
||
add_library( client OBJECT ${HEADER_FILES} ${SOURCE_FILES} ) | ||
target_link_libraries( client PRIVATE common core ) | ||
target_include_directories( client | ||
PUBLIC | ||
${CMAKE_CURRENT_LIST_DIR} ) | ||
set_property( TARGET client APPEND_STRING PROPERTY COMPILE_FLAGS -fobjc-arc ) | ||
|
||
add_subdirectory( result ) |
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,88 @@ | ||
cmake_minimum_required( VERSION 3.5 ) | ||
|
||
project( ZXingObjC-client-result ) | ||
|
||
set( HEADER_FILES | ||
ZXEmailAddressParsedResult.h | ||
ZXSMSMMSResultParser.h | ||
ZXAddressBookAUResultParser.h | ||
ZXSMTPResultParser.h | ||
ZXResultParser.h | ||
ZXBizcardResultParser.h | ||
ZXTextParsedResult.h | ||
ZXURIParsedResult.h | ||
ZXTelParsedResult.h | ||
ZXProductParsedResult.h | ||
ZXGeoParsedResult.h | ||
ZXBookmarkDoCoMoResultParser.h | ||
ZXWifiParsedResult.h | ||
ZXParsedResultType.h | ||
ZXISBNParsedResult.h | ||
ZXVINParsedResult.h | ||
ZXCalendarParsedResult.h | ||
ZXSMSParsedResult.h | ||
ZXExpandedProductParsedResult.h | ||
ZXSMSTOMMSTOResultParser.h | ||
ZXVCardResultParser.h | ||
ZXURIResultParser.h | ||
ZXAbstractDoCoMoResultParser.h | ||
ZXParsedResult.h | ||
ZXEmailAddressResultParser.h | ||
ZXEmailDoCoMoResultParser.h | ||
ZXAddressBookDoCoMoResultParser.h | ||
ZXProductResultParser.h | ||
ZXVEventResultParser.h | ||
ZXTelResultParser.h | ||
ZXWifiResultParser.h | ||
ZXGeoResultParser.h | ||
ZXExpandedProductResultParser.h | ||
ZXAddressBookParsedResult.h | ||
ZXISBNResultParser.h | ||
ZXURLTOResultParser.h | ||
ZXVINResultParser.h ) | ||
|
||
set( SOURCE_FILES | ||
ZXEmailAddressResultParser.m | ||
ZXParsedResult.m | ||
ZXURIResultParser.m | ||
ZXAbstractDoCoMoResultParser.m | ||
ZXVCardResultParser.m | ||
ZXTelResultParser.m | ||
ZXVEventResultParser.m | ||
ZXProductResultParser.m | ||
ZXAddressBookDoCoMoResultParser.m | ||
ZXEmailDoCoMoResultParser.m | ||
ZXGeoResultParser.m | ||
ZXWifiResultParser.m | ||
ZXURLTOResultParser.m | ||
ZXVINResultParser.m | ||
ZXISBNResultParser.m | ||
ZXAddressBookParsedResult.m | ||
ZXExpandedProductResultParser.m | ||
ZXTextParsedResult.m | ||
ZXURIParsedResult.m | ||
ZXBizcardResultParser.m | ||
ZXResultParser.m | ||
ZXSMTPResultParser.m | ||
ZXAddressBookAUResultParser.m | ||
ZXSMSMMSResultParser.m | ||
ZXEmailAddressParsedResult.m | ||
ZXProductParsedResult.m | ||
ZXTelParsedResult.m | ||
ZXBookmarkDoCoMoResultParser.m | ||
ZXWifiParsedResult.m | ||
ZXGeoParsedResult.m | ||
ZXSMSTOMMSTOResultParser.m | ||
ZXExpandedProductParsedResult.m | ||
ZXSMSParsedResult.m | ||
ZXCalendarParsedResult.m | ||
ZXVINParsedResult.m | ||
ZXISBNParsedResult.m ) | ||
|
||
add_library( client-result OBJECT ${HEADER_FILES} ${SOURCE_FILES} ) | ||
target_link_libraries( client-result PRIVATE common core oned ) | ||
target_include_directories( client-result | ||
PUBLIC | ||
${CMAKE_CURRENT_LIST_DIR} ) | ||
set_property( TARGET client-result APPEND_STRING PROPERTY COMPILE_FLAGS -fobjc-arc ) | ||
|
Oops, something went wrong.