Created
October 3, 2018 17:25
-
-
Save QiMata/f1591881a758a405b63ddfc6f63b4154 to your computer and use it in GitHub Desktop.
A CMake rewrite of the make file for Lead tools OCR example
This file contains hidden or 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
# Get machine type | |
machine_type = $(shell /usr/bin/env bash -c "arch") | |
ifeq (${machine_type}, x86_64) | |
lib_arch=x64 | |
else ifeq (${machine_type}, x64) | |
lib_arch=x64 | |
else | |
lib_arch=x86 | |
endif | |
LT_INCLUDE_DIR ?= ../../../../Include | |
LT_COMMON_DIR ?= ../Common | |
LT_LIB_DIR ?= ../../../../Bin/Lib/${lib_arch} | |
LT_LTVxx_CONFIG ?= LTV20_CONFIG | |
CC ?= gcc | |
CPPFLAGS += -DFOR_LINUX -D _GNU_SOURCE -D${LT_LTVxx_CONFIG} -I${LT_INCLUDE_DIR} -I${LT_COMMON_DIR} | |
CFLAGS += -L${LT_LIB_DIR} | |
LDFLAGS += -Wall -Wl,-rpath=$(abspath ${LT_LIB_DIR}) | |
all: ${TARGET} | |
print: | |
@echo "Building ${TARGET} Demo" | |
${TARGET}: print | |
${CC} -g ${SOURCES} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -o ${LT_LIB_DIR}/$@ | |
clean: | |
@rm -r bin 2> /dev/null || : |
This file contains hidden or 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
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") | |
set(lib_arch x64) | |
elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x64") | |
set(lib_arch x64) | |
elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86") | |
set(lib_arch x86) | |
else() | |
message(FATAL_ERROR "System architecture is not supported") | |
endif() | |
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/Lead/Include) | |
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/Lead/Bin/Lib/${lib_arch}) | |
add_compile_definitions(LTV20_CONFIG FOR_LINUX _GNU_SOURCE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment