Skip to content

Commit

Permalink
Fixed compilation on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
haddock7 committed Aug 5, 2020
1 parent 6600ed0 commit 90b8743
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions extension/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ project(${TARGET_NAME})
file(GLOB SOURCES "*.cpp")
file(GLOB IMGUI_SOURCES "imgui/*.cpp")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_library(${TARGET_NAME}${TARGET_EXT} SHARED ${SOURCES} ${IMGUI_SOURCES})

set_target_properties(${TARGET_NAME}${TARGET_EXT}
Expand All @@ -20,6 +23,8 @@ set_target_properties(${TARGET_NAME}${TARGET_EXT}
IF (WIN32)
target_include_directories(${TARGET_NAME}${TARGET_EXT} PUBLIC $ENV{HASHLINKPATH}/include)
target_link_libraries(${TARGET_NAME}${TARGET_EXT} $ENV{HASHLINKPATH}/libhl.lib)
ELSE()
target_link_libraries(${TARGET_NAME}${TARGET_EXT} hl)
ENDIF()

add_custom_command(TARGET ${TARGET_NAME}${TARGET_EXT} POST_BUILD
Expand Down
10 changes: 8 additions & 2 deletions extension/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
#define convertStringNullAsEmpty(st) st != nullptr ? unicodeToUTF8(st).c_str() : ""
#define convertPtr(ptr,default_value) ptr != nullptr ? *ptr : default_value

#ifdef __APPLE__
#define throw_error(err) hl_throw(hl_alloc_strbytes((const uchar*)(USTR(err))))
#else
#define throw_error(err) hl_error(err)
#endif

void convertColor(ImU32 color, float& r, float& g, float& b, float& a);
std::string unicodeToUTF8(vstring* hl_string);

Expand All @@ -22,5 +28,5 @@ vdynamic* getHLFromImVec4(ImVec4 value);

vbyte* getVByteFromCStr(const char* str);

inline void assertArraySize(varray* arr, int size) {if (arr->size != size) return hl_error("Invalid array size");}
inline void assertArraySizeRange(varray* arr, int size_min, int size_max) {if (arr->size < size_min && arr->size > size_max) return hl_error("Invalid array size");}
inline void assertArraySize(varray* arr, int size) {if (arr->size != size) throw_error("Invalid array size");}
inline void assertArraySizeRange(varray* arr, int size_min, int size_max) {if (arr->size < size_min && arr->size > size_max) throw_error("Invalid array size");}

0 comments on commit 90b8743

Please sign in to comment.