Skip to content

Commit

Permalink
Rename libs to match project name + Refactor ifndef
Browse files Browse the repository at this point in the history
  • Loading branch information
vietanhdev committed Mar 4, 2021
1 parent bae28e5 commit 6939b78
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 130 deletions.
41 changes: 30 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)

# Specify project title
project(CarSmartCam)
project(OpenADAS)

# Setup for Qt GUI
set(CMAKE_AUTOMOC ON)
Expand Down Expand Up @@ -62,29 +62,48 @@ add_definitions(${Qt5Widgets_DEFINITIONS})
# without -fPIE. We add that here.
set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")

# Build the libraries with -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

add_subdirectory("src/sensors")
add_subdirectory("src/perception")

# add required source, header, ui and resource files
add_executable(
${PROJECT_NAME}
"src/main.cpp"
"src/utils/common.cpp"
"src/utils/file_storage.cpp"
)

# Build the libraries with -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
"resources.qrc"
"src/ui/main_window.cpp"
"src/ui/main_window.ui"
"src/ui/dark_theme/dark_style.qrc"
"src/ui/dark_theme/dark_style.cpp"
"src/ui/traffic_sign_images.cpp"
"src/ui/camera_wizard/camera_wizard.cpp"
"src/ui/camera_wizard/instruction_page/instruction_page.cpp"
"src/ui/camera_wizard/instruction_page/instruction_page.ui"
"src/ui/camera_wizard/measurement_page/measurement_page.cpp"
"src/ui/camera_wizard/measurement_page/measurement_page.ui"
"src/ui/camera_wizard/four_point_select_page/four_point_select_page.cpp"
"src/ui/camera_wizard/four_point_select_page/four_point_select_page.ui"
"src/ui/warnings/collision_warning_controller.cpp"
"src/ui/warnings/traffic_sign_monitor.cpp"
"src/ui/simulation/simulation.ui"
"src/ui/simulation/simulation.cpp"
"src/ui/simulation/can_bus_emitter.cpp"

"src/perception/camera_model/birdview_model.cpp"
"src/perception/camera_model/camera_model.cpp"
)
target_compile_options(${PROJECT_NAME} PRIVATE -fPIC)

add_subdirectory("src/sensors")
add_subdirectory("src/perception")
add_subdirectory("src/ui")

# Link required libs
target_link_libraries(${PROJECT_NAME}
${CPP_FS_LIB}
car_sensors
perception
ui
openadas_car_sensors
openadas_perception
nvonnxparser
stdc++fs
${Qt5Widgets_LIBRARIES}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Advanced driver-assistance system using Jetson Nano
# OpenADAS - An advanced driver-assistance system using Jetson Nano

An advanced driver-assistance system on Jetson Nano embedded computer with four main functions: forward collision warning, lane departure warning, traffic sign recognition and overspeed warning. This repository contains source code for Jetson Nano, not including the source code for model training and conversion.

Expand Down Expand Up @@ -74,13 +74,13 @@ sudo bash setup_vcan.sh

- Run
```
./CarSmartCam
./OpenADAS
```

This will starts the program in full screen and touch mode. If you want to use a computer mouse, add `--on_dev_machine` option:

```
./CarSmartCam --on_dev_machine
./OpenADAS --on_dev_machine
```

#### Known issues
Expand Down
3 changes: 0 additions & 3 deletions documentation/Modules.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/configs/config_can_bus.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined(CONFIG_CAN_BUS_H)
#ifndef CONFIG_CAN_BUS_H
#define CONFIG_CAN_BUS_H


Expand Down
2 changes: 1 addition & 1 deletion src/configs/config_lane_detection.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined(CONFIG_LANE_DETECTION_H)
#ifndef CONFIG_LANE_DETECTION_H
#define CONFIG_LANE_DETECTION_H

#define LANE_DETECTION_BATCH_SIZE 1
Expand Down
2 changes: 1 addition & 1 deletion src/configs/config_sign_classification.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined(CONFIG_SIGN_CLASSIFICATION_H)
#ifndef CONFIG_SIGN_CLASSIFICATION_H
#define CONFIG_SIGN_CLASSIFICATION_H

#define DEBUG_WRITE_SIGN_CROPS false
Expand Down
4 changes: 2 additions & 2 deletions src/perception/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ add_subdirectory(lane_detection)
include_directories("..")

add_library(
perception
openadas_perception
"camera_model/birdview_model.cpp"
"camera_model/camera_model.cpp"
)

target_link_libraries(perception object_detector lane_detector car_sensors)
target_link_libraries(openadas_perception openadas_object_detector openadas_lane_detector openadas_car_sensors)

2 changes: 1 addition & 1 deletion src/perception/camera_model/birdview_model.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined(BIRDVIEW_MODEL_H)
#ifndef BIRDVIEW_MODEL_H
#define BIRDVIEW_MODEL_H

#include <opencv2/opencv.hpp>
Expand Down
4 changes: 2 additions & 2 deletions src/perception/camera_model/four_points.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(UTILS_H)
#define UTILS_H
#ifndef FOUR_POINTS_H
#define FOUR_POINTS_H

#include <opencv2/opencv.hpp>

Expand Down
8 changes: 4 additions & 4 deletions src/perception/lane_detection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ include_directories(
file(GLOB UFF_MODEL_CPP ../common/uff_models/common/*.cpp)
file(GLOB UNET_CPP ../common/uff_models/unet/*.cpp)

cuda_add_library(lane_detector lane_detector.cpp ${UFF_MODEL_CPP} ${UNET_CPP} ../../utils/timer.cpp)
cuda_add_library(openadas_lane_detector lane_detector.cpp ${UFF_MODEL_CPP} ${UNET_CPP} ../../utils/timer.cpp)

# Use C++ 17
target_compile_features(lane_detector PRIVATE cxx_std_17)
target_compile_features(openadas_lane_detector PRIVATE cxx_std_17)
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
set (CPP_FS_LIB "stdc++fs")
endif()

target_link_libraries(lane_detector
target_link_libraries(openadas_lane_detector
${TENSORRT_LIBRARY_INFER}
${OpenCV_LIBS}
${CPP_FS_LIB}
Expand All @@ -54,5 +54,5 @@ cuda_add_executable(test_lane_detector
test_lane_detector.cpp
)
target_link_libraries(test_lane_detector
lane_detector
openadas_lane_detector
)
8 changes: 4 additions & 4 deletions src/perception/object_detection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ include_directories(${CUDA_INCLUDE_DIRS}

file(GLOB CPP_SRC ../common/onnx_models/*.cpp *.cpp)
file(GLOB CU_SRC ../common/onnx_models/*.cu)
cuda_add_library(object_detector SHARED ${CPP_SRC} ${CU_SRC})
cuda_add_library(openadas_object_detector SHARED ${CPP_SRC} ${CU_SRC})
# Use C++ 17
target_compile_features(object_detector PRIVATE cxx_std_17)
target_compile_features(openadas_object_detector PRIVATE cxx_std_17)
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
set (CPP_FS_LIB "stdc++fs")
endif()
target_link_libraries(object_detector
target_link_libraries(openadas_object_detector
${TENSORRT_LIBRARY_INFER}
${OpenCV_LIBS}
${CPP_FS_LIB}
nvonnxparser
nvonnxparser_runtime
sign_classifier
openadas_sign_classifier
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
cmake_minimum_required(VERSION 3.5)
project(sign_classifier)

find_package(CUDA REQUIRED)

find_path(TENSORRT_INCLUDE_DIR NvInfer.h
Expand Down Expand Up @@ -33,15 +30,15 @@ include_directories(${CUDA_INCLUDE_DIRS}
file(GLOB UFF_MODEL_CPP ../../common/uff_models/common/*.cpp)
file(GLOB NET_CPP ../../common/uff_models/classification_net/*.cpp)

cuda_add_library(sign_classifier SHARED sign_classifier.cpp ${UFF_MODEL_CPP} ${NET_CPP})
cuda_add_library(openadas_sign_classifier SHARED sign_classifier.cpp ${UFF_MODEL_CPP} ${NET_CPP})

# Use C++ 17
target_compile_features(sign_classifier PRIVATE cxx_std_17)
target_compile_features(openadas_sign_classifier PRIVATE cxx_std_17)
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
set (CPP_FS_LIB "stdc++fs")
endif()

target_link_libraries(sign_classifier
target_link_libraries(openadas_sign_classifier
${TENSORRT_LIBRARY_INFER}
${OpenCV_LIBS}
${CPP_FS_LIB}
Expand All @@ -53,5 +50,5 @@ target_link_libraries(sign_classifier

cuda_add_executable(test_sign_classifier test_sign_classifier.cpp)
target_link_libraries(test_sign_classifier
sign_classifier
openadas_sign_classifier
)
6 changes: 3 additions & 3 deletions src/sensors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ add_library(can_reader
libs/can_lib/can_lib.cpp
)

add_library(car_sensors car_status.cpp car_gps_reader.cpp)
target_link_libraries(car_sensors NemaTode can_reader)
add_library(openadas_car_sensors car_status.cpp car_gps_reader.cpp)
target_link_libraries(openadas_car_sensors NemaTode can_reader)

add_executable(test_car_gps_reader test_car_gps_reader.cpp)
target_link_libraries(test_car_gps_reader car_sensors)
target_link_libraries(test_car_gps_reader openadas_car_sensors)

2 changes: 1 addition & 1 deletion src/sensors/can_reader.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined(CAN_READER_H)
#ifndef CAN_READER_H
#define CAN_READER_H

#include <getopt.h>
Expand Down
80 changes: 0 additions & 80 deletions src/ui/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion src/ui/simulation/can_bus_emitter.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined(CAN_BUS_EMITTER_H)
#ifndef CAN_BUS_EMITTER_H
#define CAN_BUS_EMITTER_H


Expand Down
2 changes: 1 addition & 1 deletion src/ui/warnings/collision_warning_controller.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined(COLLISION_WARNING_CONTROLLER_H)
#ifndef COLLISION_WARNING_CONTROLLER_H
#define COLLISION_WARNING_CONTROLLER_H

#include <mutex>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/camera.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined(CAMERA_H)
#ifndef CAMERA_H
#define CAMERA_H

#include <string>
Expand Down
4 changes: 2 additions & 2 deletions src/utils/common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(UTILITY_H)
#define UTILITY_H
#ifndef COMMON_H
#define COMMON_H

#include <opencv2/opencv.hpp>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/file_storage.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined(FILE_STORAGE_H)
#ifndef FILE_STORAGE_H
#define FILE_STORAGE_H

#include <iostream>
Expand Down

0 comments on commit 6939b78

Please sign in to comment.