Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 69f0b7f

Browse files
fix build: add cmake support for culane
1 parent b4e04d4 commit 69f0b7f

2 files changed

Lines changed: 68 additions & 2 deletions

File tree

‎evaluation/culane/CMakeLists.txt‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
project(seg_label_generate)
4+
5+
set(CMAKE_CXX_STANDARD 11)
6+
7+
add_definitions(
8+
-DCPU_ONLY
9+
)
10+
11+
set(EXECUTE_COMMAND find src/ -name "*.cpp")
12+
13+
execute_process(
14+
COMMAND ${EXECUTE_COMMAND}
15+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
16+
OUTPUT_VARIABLE CXX_SRCS_RAW
17+
)
18+
string(REPLACE "\n" ";" CXX_SRCS ${CXX_SRCS_RAW}) # drop blank line
19+
20+
add_executable(${PROJECT_NAME}
21+
${CXX_SRCS}
22+
)
23+
24+
set(dep_libs "")
25+
26+
#--- OpenCV
27+
# You may switch different version of OpenCV like this:
28+
# set(OpenCV_DIR "/usr/local/opencv-4.3.0" CACHE PATH "")
29+
find_package(OpenCV REQUIRED
30+
COMPONENTS core highgui imgproc imgcodecs
31+
)
32+
if(NOT OpenCV_FOUND) # if not OpenCV 4.x/3.x, then imgcodecs are not found
33+
find_package(OpenCV REQUIRED COMPONENTS core highgui imgproc)
34+
endif()
35+
36+
list(APPEND dep_libs
37+
PUBLIC ${OpenCV_LIBS}
38+
)
39+
40+
#--- OpenMP
41+
find_package(OpenMP)
42+
if(NOT TARGET OpenMP::OpenMP_CXX AND (OpenMP_CXX_FOUND OR OPENMP_FOUND))
43+
target_compile_options(${PROJECT_NAME} PRIVATE ${OpenMP_CXX_FLAGS})
44+
endif()
45+
46+
if(OpenMP_CXX_FOUND OR OPENMP_FOUND)
47+
message(STATUS "Building with OpenMP")
48+
if(OpenMP_CXX_FOUND)
49+
list(APPEND dep_libs PUBLIC OpenMP::OpenMP_CXX)
50+
else()
51+
list(APPEND dep_libs PRIVATE "${OpenMP_CXX_FLAGS}")
52+
endif()
53+
endif()
54+
55+
# --- target config with include dirs / libs
56+
target_link_libraries(${PROJECT_NAME}
57+
${dep_libs}
58+
)
59+
60+
target_include_directories(${PROJECT_NAME}
61+
PUBLIC include
62+
)

‎evaluation/culane/Makefile‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ PROJECT_NAME:= evaluate
55
INCLUDE_DIRS := include
66
LIBRARY_DIRS := lib
77

8+
# You may switch different versions of opencv like this:
9+
# export PKG_CONFIG_PATH=/usr/local/opencv-4.1.1/lib/pkgconfig:$PKG_CONFIG_PATH
10+
# then use `pkg-config opencv4 --cflags --libs` since `opencv4.pc` is found
11+
812
COMMON_FLAGS := -DCPU_ONLY
9-
CXXFLAGS := -std=c++11 -fopenmp
10-
LDFLAGS := -fopenmp -Wl,-rpath,./lib
13+
CXXFLAGS := -std=c++11 -fopenmp`pkg-config --cflags opencv`
14+
LDFLAGS := -fopenmp -Wl,-rpath,./lib`pkg-config --libs opencv`
1115

1216
BUILD_DIR := build
1317

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /