diff --git a/.gitignore b/.gitignore index 86fcb79..27e78ae 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,5 @@ fabric.properties # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser build/ + +.DS_Store \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e16eca..2288949 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,8 +58,11 @@ elseif(UNIX AND NOT APPLE) elseif(APPLE) target_sources(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport/macosx.c) - target_link_libraries(libblisp_obj PRIVATE "-framework IOKit" "-framework CoreFoundation") - target_compile_definitions(libblisp_obj PRIVATE LIBSERIALPORT_ATBUILD "SP_API=__attribute__((visibility(\"default\")))") + target_link_libraries(libblisp PRIVATE "-framework IOKit" "-framework CoreFoundation") + 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) write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.") endif() diff --git a/lib/blisp.c b/lib/blisp.c index e44443f..5503841 100644 --- a/lib/blisp.c +++ b/lib/blisp.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include diff --git a/tools/blisp/CMakeLists.txt b/tools/blisp/CMakeLists.txt index 9b97ae4..6cb53f4 100644 --- a/tools/blisp/CMakeLists.txt +++ b/tools/blisp/CMakeLists.txt @@ -12,4 +12,6 @@ target_link_libraries(blisp PRIVATE if(WIN32) target_link_libraries(blisp PRIVATE Setupapi.lib) +elseif(APPLE) + target_link_libraries(blisp PRIVATE "-framework IOKit" "-framework CoreFoundation") endif() \ No newline at end of file diff --git a/tools/blisp/src/cmd/write.c b/tools/blisp/src/cmd/write.c index b90a58e..658330a 100644 --- a/tools/blisp/src/cmd/write.c +++ b/tools/blisp/src/cmd/write.c @@ -5,6 +5,8 @@ #include #include #include "blisp_struct.h" +#include +#include #ifdef __linux__ #include @@ -14,6 +16,8 @@ typedef SSIZE_T ssize_t; #include #define PATH_MAX MAX_PATH +#elif defined(__APPLE__) +#include #endif #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... // These are not thread safe, but it doesn't place the responsibility // to free an allocated buffer on the caller.nn -#include -#include -#include 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.