mirror of
https://github.com/pine64/blisp.git
synced 2024-12-22 06:20:12 +00:00
Add initial MacOS support
This commit is contained in:
parent
a68c54ed2b
commit
eb086f6fe3
2
.gitignore
vendored
2
.gitignore
vendored
@ -76,3 +76,5 @@ fabric.properties
|
|||||||
# Android studio 3.1+ serialized cache file
|
# Android studio 3.1+ serialized cache file
|
||||||
.idea/caches/build_file_checksums.ser
|
.idea/caches/build_file_checksums.ser
|
||||||
build/
|
build/
|
||||||
|
|
||||||
|
.DS_Store
|
@ -58,8 +58,11 @@ elseif(UNIX AND NOT APPLE)
|
|||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
target_sources(libblisp_obj PRIVATE
|
target_sources(libblisp_obj PRIVATE
|
||||||
${CMAKE_SOURCE_DIR}/vendor/libserialport/macosx.c)
|
${CMAKE_SOURCE_DIR}/vendor/libserialport/macosx.c)
|
||||||
target_link_libraries(libblisp_obj PRIVATE "-framework IOKit" "-framework CoreFoundation")
|
target_link_libraries(libblisp PRIVATE "-framework IOKit" "-framework CoreFoundation")
|
||||||
target_compile_definitions(libblisp_obj PRIVATE LIBSERIALPORT_ATBUILD "SP_API=__attribute__((visibility(\"default\")))")
|
target_compile_definitions(libblisp_obj PRIVATE
|
||||||
|
LIBSERIALPORT_ATBUILD
|
||||||
|
"SP_PRIV=__attribute__((visibility(\"hidden\")))"
|
||||||
|
"SP_API=__attribute__((visibility(\"default\")))")
|
||||||
target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
|
target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
|
||||||
write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.")
|
write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.")
|
||||||
endif()
|
endif()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <blisp.h>
|
#include <blisp.h>
|
||||||
#include <blisp_util.h>
|
#include <blisp_util.h>
|
||||||
#include <libserialport.h>
|
#include <libserialport.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -12,4 +12,6 @@ target_link_libraries(blisp PRIVATE
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(blisp PRIVATE Setupapi.lib)
|
target_link_libraries(blisp PRIVATE Setupapi.lib)
|
||||||
|
elseif(APPLE)
|
||||||
|
target_link_libraries(blisp PRIVATE "-framework IOKit" "-framework CoreFoundation")
|
||||||
endif()
|
endif()
|
@ -5,6 +5,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "blisp_struct.h"
|
#include "blisp_struct.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -14,6 +16,8 @@
|
|||||||
typedef SSIZE_T ssize_t;
|
typedef SSIZE_T ssize_t;
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define PATH_MAX MAX_PATH
|
#define PATH_MAX MAX_PATH
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#include <sys/syslimits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define REG_EXTENDED 1
|
#define REG_EXTENDED 1
|
||||||
@ -30,9 +34,6 @@ static void* cmd_write_argtable[6];
|
|||||||
// Ugh. This stuff is just so messy without C++17 or Qt...
|
// Ugh. This stuff is just so messy without C++17 or Qt...
|
||||||
// These are not thread safe, but it doesn't place the responsibility
|
// These are not thread safe, but it doesn't place the responsibility
|
||||||
// to free an allocated buffer on the caller.nn
|
// to free an allocated buffer on the caller.nn
|
||||||
#include <string.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
static void get_executable_path(char* buffer_out, uint32_t max_size) {
|
static void get_executable_path(char* buffer_out, uint32_t max_size) {
|
||||||
assert (max_size >= PATH_MAX); // n.b. 1024 on MacOS. 4K on most Linux.
|
assert (max_size >= PATH_MAX); // n.b. 1024 on MacOS. 4K on most Linux.
|
||||||
|
Loading…
Reference in New Issue
Block a user