Skip to content

Commit aeffb15

Browse files
committed
Init
Signed-off-by: yuanlu <[email protected]>
0 parents  commit aeffb15

30 files changed

+8760
-0
lines changed

.gitignore

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
### CUDA template
2+
*.i
3+
*.ii
4+
*.gpu
5+
*.ptx
6+
*.cubin
7+
*.fatbin
8+
9+
### C++ template
10+
# Prerequisites
11+
*.d
12+
13+
# Compiled Object files
14+
*.slo
15+
*.lo
16+
*.o
17+
*.obj
18+
19+
# Precompiled Headers
20+
*.gch
21+
*.pch
22+
23+
# Compiled Dynamic libraries
24+
*.so
25+
*.dylib
26+
*.dll
27+
28+
# Fortran module files
29+
*.mod
30+
*.smod
31+
32+
# Compiled Static libraries
33+
*.lai
34+
*.la
35+
*.a
36+
*.lib
37+
38+
# Executables
39+
*.exe
40+
*.out
41+
*.app
42+
43+
### JetBrains template
44+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
45+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
46+
47+
# User-specific stuff
48+
.idea/**/workspace.xml
49+
.idea/**/tasks.xml
50+
.idea/**/usage.statistics.xml
51+
.idea/**/dictionaries
52+
.idea/**/shelf
53+
54+
# AWS User-specific
55+
.idea/**/aws.xml
56+
57+
# Generated files
58+
.idea/**/contentModel.xml
59+
60+
# Sensitive or high-churn files
61+
.idea/**/dataSources/
62+
.idea/**/dataSources.ids
63+
.idea/**/dataSources.local.xml
64+
.idea/**/sqlDataSources.xml
65+
.idea/**/dynamic.xml
66+
.idea/**/uiDesigner.xml
67+
.idea/**/dbnavigator.xml
68+
69+
# Gradle
70+
.idea/**/gradle.xml
71+
.idea/**/libraries
72+
73+
# Gradle and Maven with auto-import
74+
# When using Gradle or Maven with auto-import, you should exclude module files,
75+
# since they will be recreated, and may cause churn. Uncomment if using
76+
# auto-import.
77+
# .idea/artifacts
78+
# .idea/compiler.xml
79+
# .idea/jarRepositories.xml
80+
# .idea/modules.xml
81+
# .idea/*.iml
82+
# .idea/modules
83+
# *.iml
84+
# *.ipr
85+
86+
# CMake
87+
cmake-build-*/
88+
89+
# Mongo Explorer plugin
90+
.idea/**/mongoSettings.xml
91+
92+
# File-based project format
93+
*.iws
94+
95+
# IntelliJ
96+
out/
97+
98+
# mpeltonen/sbt-idea plugin
99+
.idea_modules/
100+
101+
# JIRA plugin
102+
atlassian-ide-plugin.xml
103+
104+
# Cursive Clojure plugin
105+
.idea/replstate.xml
106+
107+
# SonarLint plugin
108+
.idea/sonarlint/
109+
110+
# Crashlytics plugin (for Android Studio and IntelliJ)
111+
com_crashlytics_export_strings.xml
112+
crashlytics.properties
113+
crashlytics-build.properties
114+
fabric.properties
115+
116+
# Editor-based Rest Client
117+
.idea/httpRequests
118+
119+
# Android studio 3.1+ serialized cache file
120+
.idea/caches/build_file_checksums.ser
121+
122+
### CMake template
123+
CMakeLists.txt.user
124+
CMakeCache.txt
125+
CMakeFiles
126+
CMakeScripts
127+
Testing
128+
Makefile
129+
cmake_install.cmake
130+
install_manifest.txt
131+
compile_commands.json
132+
CTestTestfile.cmake
133+
_deps
134+

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "lib/serial"]
2+
path = lib/serial
3+
url = https://github.com/ifr-cv/serial.git

.idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/NUEDC-2023.iml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/deployment.xml

+61
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/other.xml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/saveactions_settings.xml

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CMakeLists.txt

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
#设置项目名称
3+
set(PROJECT_NAME NUEDC_2023)
4+
#建立项目
5+
set(CMAKE_CUDA_ARCHITECTURES 70)
6+
set(CMAKE_CXX_STANDARD 17)
7+
set(CMAKE_CUDA_STANDARD 17)
8+
set(CMAKE_C_FLAGS -pthread)
9+
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
10+
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
11+
12+
13+
project(${PROJECT_NAME} LANGUAGES CXX C CUDA)
14+
15+
set(CMAKE_SYSROOT "${SYSROOT_PATH}")
16+
set(CMAKE_FIND_ROOT_PATH "${SYSROOT_PATH}" "${CMAKE_PREFIX_PATH}" "${TOOLCHAIN_PATH}")
17+
18+
19+
if (CMAKE_HOST_SYSTEM_NAME MATCHES "Linux")
20+
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Werror=return-type -Wno-unused-variable")
21+
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall -Werror=return-type -Wno-unused-variable")
22+
if (CMAKE_BUILD_TYPE STREQUAL Release)
23+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -flto -march=native")
24+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -flto -march=native")
25+
add_definitions(-DDEBUG=false)
26+
elseif (CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
27+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -flto -march=native -g")
28+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -flto -march=native -g")
29+
add_definitions(-DDEBUG=false)
30+
elseif (CMAKE_BUILD_TYPE STREQUAL MinSizeRel)
31+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -flto -march=native")
32+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -flto -march=native")
33+
add_definitions(-DDEBUG=false)
34+
else ()
35+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g")
36+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g")
37+
add_definitions(-DDEBUG=true)
38+
endif ()
39+
else ()
40+
add_compile_definitions(WIN32_LEAN_AND_MEAN)
41+
add_compile_definitions(DEBUG=true)
42+
endif ()
43+
44+
#寻找CUDA库
45+
find_package(CUDA REQUIRED)
46+
message(STATUS "CUDA version: ${CUDA_VERSION}")
47+
message(STATUS " libraries: ${CUDA_LIBRARIES}")
48+
message(STATUS " include path: ${CUDA_INCLUDE_DIRS}")
49+
50+
if (CMAKE_BUILD_TYPE STREQUAL Release) # nvcc flags
51+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -std=c++${CMAKE_CXX_STANDARD})
52+
elseif (CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
53+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -G;-g;-std=c++${CMAKE_CXX_STANDARD})
54+
elseif (CMAKE_BUILD_TYPE STREQUAL MinSizeRel)
55+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -std=c++${CMAKE_CXX_STANDARD})
56+
else ()
57+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC;-G;-g;-std=c++${CMAKE_CXX_STANDARD})
58+
endif ()
59+
60+
include_directories(${CUDA_INCLUDE_DIRS})
61+
link_directories(${CUDA_LIBRARY_DIRS})
62+
63+
#寻找OpenCV库
64+
FIND_PACKAGE(OpenCV REQUIRED)
65+
MESSAGE(STATUS "OpenCV version: ${OpenCV_VERSION}")
66+
MESSAGE(STATUS " libraries: ${OpenCV_LIBRARY_DIRS}")
67+
MESSAGE(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
68+
MESSAGE(STATUS " libs: ${OpenCV_LIBS}")
69+
include_directories(${OpenCV_INCLUDE_DIRS})
70+
link_directories(${OpenCV_LIBRARY_DIRS})
71+
72+
73+
#打印调试信息
74+
MESSAGE(STATUS "Project: ${PROJECT_NAME}")
75+
76+
77+
include_directories(lib/serial/include)
78+
include_directories(inc)
79+
if (CMAKE_HOST_SYSTEM_NAME MATCHES "Linux")
80+
include_directories(lib/Daheng/arm-linux)
81+
else ()
82+
include_directories(lib/Daheng/win)
83+
endif ()
84+
85+
86+
aux_source_directory(${PROJECT_SOURCE_DIR}/lib/basic LIB_BASIC)
87+
aux_source_directory(${PROJECT_SOURCE_DIR}/lib/SORT/sort-c++ LIB_SORT)
88+
89+
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/serial)
90+
91+
file(GLOB_RECURSE SRCX src/*.cpp src/*.cu)
92+
add_executable(${PROJECT_NAME} ${SRCX})
93+
94+
95+
set_property(TARGET ${PROJECT_NAME} PROPERTY CUDA_ARCHITECTURES 70)
96+
97+
target_link_libraries(${PROJECT_NAME}
98+
serial
99+
${OpenCV_LIBS}
100+
${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY} ${CUDA_LIBRARY}
101+
)
102+
103+
if (CMAKE_HOST_SYSTEM_NAME MATCHES "Linux")
104+
TARGET_LINK_LIBRARIES(${PROJECT_NAME} gxiapi.so -lpthread -lm)
105+
set_target_properties(${PROJECT_NAME} PROPERTIES
106+
CUDA_SEPARABLE_COMPILATION ON
107+
CUDA_RESOLVE_DEVICE_SYMBOLS ON
108+
)
109+
else ()
110+
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
111+
"$ENV{Daheng_Imaging_GalaxySDK}\\Samples\\VC SDK\\lib\\x64\\GxIAPI.lib"
112+
"$ENV{Daheng_Imaging_GalaxySDK}\\Samples\\VC SDK\\lib\\x64\\DxImageProc.lib"
113+
)
114+
set_target_properties(${PROJECT_NAME} PROPERTIES
115+
CUDA_SEPARABLE_COMPILATION ON
116+
CUDA_RESOLVE_DEVICE_SYMBOLS ON
117+
)
118+
endif ()

0 commit comments

Comments
 (0)