Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ if(${CMAKE_BUILD_TYPE} MATCHES OBC)
endif()
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_arm_none_eabi.cmake)
elseif(${CMAKE_BUILD_TYPE} MATCHES GS)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_ground_station_gcc.cmake)
if(NOT APPLE)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_ground_station_gcc.cmake)
endif()
elseif(${CMAKE_BUILD_TYPE} MATCHES HIL)
include(${CMAKE_SOURCE_DIR}/cmake/fetch_googletest.cmake)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_hil_gcc.cmake)
Expand Down
7 changes: 7 additions & 0 deletions gs/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ target_include_directories(gs.out PUBLIC

target_compile_options(gs.out PUBLIC -Wall -g)

if(APPLE)
target_link_libraries(gs.out PUBLIC
"-framework CoreFoundation"
"-framework IOKit"
)
endif()

if(UNIX)
target_link_libraries(gs.out PUBLIC
tiny-aes
Expand Down
6 changes: 5 additions & 1 deletion gs/backend/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
#include <aes.h>
#include <cserialport.h>

#include <malloc.h>
#ifdef __APPLE__
#ifdef TARGET_OS_MAC
#include <CoreFoundation/CoreFoundation.h>
#endif
#endif
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
8 changes: 7 additions & 1 deletion interfaces/obc_gs_interface/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from ctypes import CDLL
from pathlib import Path
from sys import platform

if platform == "darwin":
extension = "dylib"
else:
extension = "so"

# The shared object file we are using the access the c functions via ctypes
path = (Path(__file__).parent / "../../build_gs/interfaces/libobc-gs-interface.so").resolve()
path = (Path(__file__).parent / f"../../build_gs/interfaces/libobc-gs-interface.{extension}").resolve()
interface = CDLL(str(path))
5 changes: 5 additions & 0 deletions obc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
cmake_minimum_required(VERSION 3.15)

if(APPLE)
find_library(COREFOUNDATION CoreFoundation)
find_library(IOKIT IOKit)
endif()

# Set default values for firmware build options
include(${CMAKE_SOURCE_DIR}/cmake/obc_build_options.cmake)

Expand Down
Loading