-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
52 lines (40 loc) · 1.85 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
cmake_minimum_required(VERSION 3.17.0)
set(ProjectName "cuttlefish" CACHE STRING "Project Name")
project(${ProjectName})
set(CMAKE_CXX_STANDARD 17)
set( CMAKE_CONFIGURATION_TYPES "Debug;Release;Native" )
set( CMAKE_CXX_FLAGS "" )
set( CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -Og -march=core2 -mtune=native -ggdb3" )
set( CMAKE_CXX_FLAGS_RELEASE "-w -O2 -march=core2 -mtune=generic" )
set( CMAKE_CXX_FLAGS_NATIVE "-w -Os --fast-math -march=native -mtune=native" )
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Release )
endif()
set(ProjectDir "${CMAKE_SOURCE_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb3")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=native")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RELEASE")
endif()
set(ProjectIncludeDirectories ${CMAKE_CURRENT_BINARY_DIR})
set(ProjectLibs "-lpthread")
file(GLOB ProjectFiles
"${ProjectDir}/src/*.hh"
"${ProjectDir}/src/*.cc"
)
source_group("project" FILES ${ProjectFiles})
find_package(Qt6 COMPONENTS Widgets Core5Compat REQUIRED)
find_package(OpenCV COMPONENTS core imgproc features2d REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(ProjectBinary "cuttlefish")
set(ProjectOldBinary "cuttleold")
add_executable(${ProjectBinary} ${ProjectFiles})
install(TARGETS ${ProjectBinary} RUNTIME DESTINATION "bin/")
set_target_properties(${ProjectBinary} PROPERTIES INCLUDE_DIRECTORIES ${ProjectIncludeDirectories})
set_target_properties(${ProjectBinary} PROPERTIES PROJECT_LABEL "${ProjectName}")
target_link_libraries(${ProjectBinary} ${ProjectLibs} Qt6::Widgets Qt6::Core5Compat opencv_core opencv_imgproc opencv_features2d)