-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
90 lines (68 loc) · 3.06 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(DOC_REASSEMBLY)
# Find includes and libraries
include_directories(${DOC_REASSEMBLY_SOURCE_DIR}/include)
find_package(OpenCV REQUIRED)
get_filename_component(CMAKE_PREFIX_PATH "${Libtorch_REL_PATH}"
ABSOLUTE BASE_DIR "${DOC_REASSEMBLY_SOURCE_DIR}")
message("-- Liborch package search path: " ${CMAKE_PREFIX_PATH})
find_package(Torch REQUIRED)
if (APPLE)
# Add tesseract lib directory
link_directories(/usr/local/lib)
endif()
# OpenMP
find_package(OpenMP)
if (OPENMP_FOUND)
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
# Set default variables
set(SRC_ROOT_PATH ${DOC_REASSEMBLY_SOURCE_DIR}/src)
set(CMAKE_CXX_STANDARD 11)
if (${CMAKE_BUILD_TYPE} MATCHES "Release")
set(EXECUTABLE_OUTPUT_PATH ${DOC_REASSEMBLY_SOURCE_DIR}/bin/release)
else()
set(DEBUG_FLAG "-DDEBUG")
set(EXECUTABLE_OUTPUT_PATH ${DOC_REASSEMBLY_SOURCE_DIR}/bin/debug)
endif()
# Debug cmake
set(CMAKE_VERBOSE_MAKEFILE ON)
# utils
add_library(utils ${SRC_ROOT_PATH}/utils.cpp)
target_link_libraries(utils ${OpenCV_LIBRARIES})
# evaluator
set(EVALUATOR_PATH ${SRC_ROOT_PATH}/evaluator)
add_library(compatibility-net ${EVALUATOR_PATH}/compatibility_net.cpp)
target_link_libraries(compatibility-net ${TORCH_LIBRARIES})
add_library(compatibility-dataset ${EVALUATOR_PATH}/compatibility_dataset.cpp)
target_link_libraries(compatibility-dataset ${TORCH_LIBRARIES} ${OpenCV_LIBRARIES})
add_executable(build-dataset ${EVALUATOR_PATH}/build_dataset.cpp)
target_link_libraries(build-dataset ${OpenCV_LIBRARIES} utils)
add_executable(train-evaluator ${EVALUATOR_PATH}/train_evaluator.cpp)
target_link_libraries(train-evaluator ${TORCH_LIBRARIES} compatibility-net compatibility-dataset utils)
add_executable(test-realdata ${EVALUATOR_PATH}/test_realdata.cpp)
target_link_libraries(test-realdata ${TORCH_LIBRARIES} ${OpenCV_LIBRARIES} compatibility-net)
# add-noise
add_executable(add-noise ${SRC_ROOT_PATH}/add_noise.cpp)
target_link_libraries(add-noise ${OpenCV_LIBRARIES})
# debug-tool
add_executable(debug-tool ${SRC_ROOT_PATH}/debug_tool.cpp)
target_link_libraries(debug-tool ${OpenCV_LIBRARIES} tesseract utils)
# generator
set(GENERATOR_PATH ${SRC_ROOT_PATH}/generator)
aux_source_directory(${GENERATOR_PATH} GENERATOR_SRC)
add_executable(generator ${GENERATOR_SRC})
target_link_libraries(generator ${OpenCV_LIBRARIES} tesseract utils)
# ocr-extractor
add_library(ocr-extractor ${SRC_ROOT_PATH}/ocr_extractor.cpp)
target_link_libraries(ocr-extractor ${OpenCV_LIBRARIES})
# solver
set(SOLVER_PATH ${SRC_ROOT_PATH}/solver)
aux_source_directory(${SOLVER_PATH} SOLVER_SRC)
add_library(path_manager ${SOLVER_PATH}/path_manager.cpp)
add_library(KM ${SOLVER_PATH}/KM.cpp)
add_executable(solver ${SOLVER_SRC})
target_compile_definitions(solver PUBLIC ${DEBUG_FLAG})
target_link_libraries(solver ${OpenCV_LIBRARIES} ${TORCH_LIBRARIES} tesseract utils ocr-extractor compatibility-net path_manager KM)