This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up project CMake structure (#16)
* set up module library structure * set up module library structure * removed test function and finalized CMake project structure * fix error with no class memeber
- Loading branch information
Showing
8 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_subdirectory(main) | ||
add_subdirectory(ui) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
add_executable(diagnostics diagnostics.cpp) | ||
|
||
target_link_libraries(diagnostics PRIVATE | ||
UI | ||
) | ||
|
||
target_include_directories(diagnostics PUBLIC | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
#include <cstdio> | ||
#include <iostream> | ||
|
||
#include "commonUI.h" | ||
|
||
int main(int argc, char ** argv) | ||
{ | ||
(void)argc; | ||
(void)argv; | ||
|
||
printf("Welcome to UBC Sailbot diagnostics!\n"); | ||
std::cout << "Welcome to UBC Sailbot Diagnostics! The C++ version" << std::endl; | ||
|
||
CommonUI myObj; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(common) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_library(UI STATIC commonUI.cpp commonUI.h) | ||
target_include_directories(UI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "commonUI.h" | ||
|
||
#include <sys/ioctl.h> | ||
#include <unistd.h> | ||
|
||
CommonUI::CommonUI() { terminal_width = getTerminalWidth(); } | ||
|
||
int CommonUI::getTerminalWidth() | ||
{ | ||
struct winsize size; | ||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &size); | ||
return size.ws_col; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef COMMON_UI_H_ | ||
#define COMMON_UI_H_ | ||
|
||
/* Objects */ | ||
|
||
class CommonUI | ||
{ | ||
private: | ||
int terminal_width; | ||
static int getTerminalWidth(); | ||
|
||
public: | ||
CommonUI(); | ||
}; | ||
|
||
#endif |