diff --git a/CMakeLists.txt b/CMakeLists.txt index d64c906..ef3594e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ project( DESCRIPTION "Milsko GUI Toolkit" ) +include(CheckIncludeFiles) + option(OPENGL "Compile OpenGL widget or not" ON) if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") option(VULKAN "Compile Vulkan widget or not" OFF) @@ -140,8 +142,11 @@ else() if(CMAKE_SYSTEM_NAME STREQUAL "Linux") list(APPEND LIBRARIES dl) endif() - if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD" AND VULKAN) - list(APPEND INCLUDE_DIRS /usr/pkg/include) + if(VULKAN) + pkg_check_modules(VULKAN REQUIRED vulkan) + list(APPEND INCLUDE_DIRS ${VULKAN_INCLUDE_DIRS}) + list(APPEND LIBRARY_DIRS ${VULKAN_LIBRARY_DIRS}) + list(APPEND LIBRARIES ${VULKAN_LIBRARIES}) endif() endif() @@ -161,6 +166,17 @@ target_link_libraries( ${LIBRARIES} ) +if(VULKAN) + check_include_files(vulkan/vk_enum_string_helper.h HAS_VK_ENUM_STRING_HELPER) + if(HAS_VK_ENUM_STRING_HELPER) + target_compile_definitions( + Mw + PRIVATE + HAS_VK_ENUM_STRING_HELPER + ) + endif() +endif() + target_compile_definitions( Mw PRIVATE diff --git a/src/core.c b/src/core.c index c1bca4c..892347b 100644 --- a/src/core.c +++ b/src/core.c @@ -55,7 +55,7 @@ static void llclosehandler(MwLL handle, void* data) { (void)data; - if((n = MwGetInteger(h, MwNmain)) != -1 && n) { + if((n = MwGetInteger(h, MwNmain)) != MwDEFAULT && n) { while(h != NULL) { h->close = 1; MwDispatchUserHandler(h, MwNcloseHandler, NULL); @@ -152,7 +152,7 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, sh_new_strdup(h->handler); sh_new_strdup(h->data); - shdefault(h->integer, -1); + shdefault(h->integer, MwDEFAULT); shdefault(h->text, NULL); shdefault(h->handler, NULL); shdefault(h->data, NULL); @@ -369,7 +369,7 @@ int MwGetInteger(MwWidget handle, const char* key) { if(strcmp(key, MwNy) == 0) return y; if(strcmp(key, MwNwidth) == 0) return w; if(strcmp(key, MwNheight) == 0) return h; - return -1; + return MwDEFAULT; } else { return shget(handle->integer, key); } @@ -438,7 +438,7 @@ static void inherit_integer(MwWidget handle, const char* key, int default_value) int n; MwWidget h = handle; while(h != NULL) { - if((n = MwGetInteger(h, key)) != -1) { + if((n = MwGetInteger(h, key)) != MwDEFAULT) { MwSetInteger(handle, key, n); return; }