Skip to content

Commit 3a91dd3

Browse files
author
Wish
committed
update makefile
1 parent 98723f5 commit 3a91dd3

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

CMakeLists.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ set(CMAKE_BUILD_TYPE Debug)
88
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/workspace)
99
set(HAS_PYTHON ON)
1010

11-
# 取决于你的设备,这是编译cu文件的配置,一般可以不用设置,除非你调用了特定函数例如half新特性
11+
# 如果要支持python则设置python路径
12+
set(PythonRoot "/data/datav/newbb/lean/anaconda3/envs/torch1.8")
13+
set(PythonName "python3.9")
14+
1215
# 如果你是不同显卡,请设置为显卡对应的号码参考这里:https://developer.nvidia.com/zh-cn/cuda-gpus#compute
1316
set(CUDA_GEN_CODE "-gencode=arch=compute_75,code=sm_75")
1417

@@ -27,10 +30,6 @@ set(TENSORRT_DIR "/data/sxai/lean/TensorRT-8.0.1.6-cuda10.2-cudnn8.2")
2730
# 因为protobuf,需要用特定版本,所以这里指定路径
2831
set(PROTOBUF_DIR "/data/sxai/lean/protobuf3.11.4")
2932

30-
# 如果要支持python则设置python路径
31-
set(PythonDIR "/data/datav/newbb/lean/anaconda3/envs/torch1.8")
32-
set(PythonName "python3.9")
33-
3433

3534
find_package(CUDA REQUIRED)
3635
find_package(OpenCV)
@@ -57,9 +56,9 @@ link_directories(
5756
)
5857

5958
if("${HAS_PYTHON}" STREQUAL "ON")
60-
message("Usage Python ${PythonDIR}")
61-
include_directories(${PythonDIR}/include/${PythonName})
62-
link_directories(${PythonDIR}/lib)
59+
message("Usage Python ${PythonRoot}")
60+
include_directories(${PythonRoot}/include/${PythonName})
61+
link_directories(${PythonRoot}/lib)
6362
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_PYTHON")
6463
endif()
6564

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ lean_tensor_rt := /data/sxai/lean/TensorRT-8.0.1.6-cuda10.2-cudnn8.2
2626
lean_cudnn := /data/sxai/lean/cudnn8.2.2.26
2727
lean_opencv := /data/sxai/lean/opencv4.2.0
2828
lean_cuda := /data/sxai/lean/cuda10.2
29-
lean_python := /data/datav/newbb/lean/anaconda3/envs/torch1.8
3029
use_python := true
30+
python_root := /data/datav/newbb/lean/anaconda3/envs/torch1.8
31+
python_name := python3.9
3132

3233
include_paths := src \
3334
src/application \
@@ -55,9 +56,9 @@ link_librarys := opencv_core opencv_imgproc opencv_videoio opencv_imgcodecs \
5556
support_define :=
5657

5758
ifeq ($(use_python), true)
58-
include_paths += $(lean_python)/include/python3.9
59-
library_paths += $(lean_python)/lib
60-
link_librarys += python3.9
59+
include_paths += $(python_root)/include/$(python_name)
60+
library_paths += $(python_root)/lib
61+
link_librarys += $(python_name)
6162
support_define += -DHAS_PYTHON
6263
endif
6364

@@ -67,6 +68,7 @@ library_paths := $(foreach item,$(library_paths),-L$(item))
6768
link_librarys := $(foreach item,$(link_librarys),-l$(item))
6869

6970
# 如果是其他显卡,请修改-gencode=arch=compute_75,code=sm_75为对应显卡的能力
71+
# 显卡对应的号码参考这里:https://developer.nvidia.com/zh-cn/cuda-gpus#compute
7072
cpp_compile_flags := -std=c++11 -fPIC -m64 -g -fopenmp -w -O0 $(support_define)
7173
cu_compile_flags := -std=c++11 -m64 -Xcompiler -fPIC -g -w -gencode=arch=compute_75,code=sm_75 -O0 $(support_define)
7274
link_flags := -pthread -fopenmp -Wl,-rpath='$$ORIGIN'

0 commit comments

Comments
 (0)