Skip to content

Commit dcb6423

Browse files
authored
Integrate gs building code for MacOS systems (#552)
# Purpose Previously, no instructions were provided on how to build the ground station program for MacOS systems. This PR adds steps on how to fix the errors that are encountered while building it. # New Changes - Instructions on building gs for MacOS systems were added to the readme # Testing Explain tests that you ran to verify code functionality. - [x] I have unit-tested this PR. Otherwise, explain why it cannot be unit-tested. - [ ] I have tested this PR on a board if the code will run on a board (Only required for firmware developers). - [ ] I have tested this PR by running the ARO website (Only required if the code will impact the ARO website). - [ ] I have tested this PR by running the MCC website (Only required if the code will impact the MCC website). - [ ] I have included screenshots of the tests performed below. # Outstanding Changes If there are non-critical changes (i.e. additional features) that can be made to this feature in the future, indicate them here. - Currently, the instructions allow for successfully launching the cli. More thorough testing may be required for full functionality
1 parent 609842c commit dcb6423

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ if(${CMAKE_BUILD_TYPE} MATCHES OBC)
88
endif()
99
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_arm_none_eabi.cmake)
1010
elseif(${CMAKE_BUILD_TYPE} MATCHES GS)
11-
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_ground_station_gcc.cmake)
11+
if(NOT APPLE)
12+
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_ground_station_gcc.cmake)
13+
endif()
1214
elseif(${CMAKE_BUILD_TYPE} MATCHES HIL)
1315
include(${CMAKE_SOURCE_DIR}/cmake/fetch_googletest.cmake)
1416
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_hil_gcc.cmake)

gs/backend/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ target_include_directories(gs.out PUBLIC
1414

1515
target_compile_options(gs.out PUBLIC -Wall -g)
1616

17+
if(APPLE)
18+
target_link_libraries(gs.out PUBLIC
19+
"-framework CoreFoundation"
20+
"-framework IOKit"
21+
)
22+
endif()
23+
1724
if(UNIX)
1825
target_link_libraries(gs.out PUBLIC
1926
tiny-aes

gs/backend/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
#include <aes.h>
1313
#include <cserialport.h>
1414

15-
#include <malloc.h>
15+
#ifdef __APPLE__
16+
#ifdef TARGET_OS_MAC
17+
#include <CoreFoundation/CoreFoundation.h>
18+
#endif
19+
#endif
1620
#include <stdint.h>
1721
#include <stdio.h>
1822
#include <stdlib.h>
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
from ctypes import CDLL
22
from pathlib import Path
3+
from sys import platform
4+
5+
if platform == "darwin":
6+
extension = "dylib"
7+
else:
8+
extension = "so"
39

410
# The shared object file we are using the access the c functions via ctypes
5-
path = (Path(__file__).parent / "../../build_gs/interfaces/libobc-gs-interface.so").resolve()
11+
path = (Path(__file__).parent / f"../../build_gs/interfaces/libobc-gs-interface.{extension}").resolve()
612
interface = CDLL(str(path))

obc/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
cmake_minimum_required(VERSION 3.15)
22

3+
if(APPLE)
4+
find_library(COREFOUNDATION CoreFoundation)
5+
find_library(IOKIT IOKit)
6+
endif()
7+
38
# Set default values for firmware build options
49
include(${CMAKE_SOURCE_DIR}/cmake/obc_build_options.cmake)
510

0 commit comments

Comments
 (0)