define opengl/vulkan symbols anyways

This commit is contained in:
Nishi 2026-04-16 23:53:29 +09:00
commit b82e13cb2e
Signed by: nishi
GPG key ID: 27EF69B208EB9343
4 changed files with 26 additions and 8 deletions

View file

@ -45,9 +45,6 @@ file(
external/libz/src/*.c src/*.c src/cursor/*.c src/icon/*.c src/widget/*.c src/text/*.c src/text/font/*.c src/dialog/*.c src/abstract/*.c external/*.c
)
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
if(NOT MW_USE_STB_IMAGE)
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_image.c")
endif()
@ -65,7 +62,11 @@ if(MW_TRY_OPENGL)
find_package(OpenGL)
if(OpenGL_FOUND)
set(MW_BUILD_OPENGL ON)
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
target_compile_definitions(
Mw
PRIVATE
MW_OPENGL
)
if(APPLE)
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl_cocoa.m")
endif()
@ -79,7 +80,6 @@ if(MW_TRY_VULKAN)
check_include_files(vulkan/vulkan.h HAVE_VULKAN_VULKAN_H)
if(HAVE_VULKAN_VULKAN_H)
set(MW_BUILD_VULKAN ON)
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
target_compile_definitions(
Mw
PRIVATE

View file

@ -139,12 +139,14 @@ new_object("src/widget/treeview.c");
new_object("src/widget/viewport.c");
new_object("src/widget/window.c");
new_object("src/widget/opengl.c");
new_object("src/widget/vulkan.c");
if (param_get("opengl")) {
new_object("src/widget/opengl.c");
add_cflags("-DMW_OPENGL");
}
if (param_get("vulkan")) {
add_cflags("-DMW_VULKAN");
new_object("src/widget/vulkan.c");
}
new_object("src/dialog/*.c");

View file

@ -1,6 +1,8 @@
#ifndef __APPLE__
#include <Mw/Milsko.h>
#ifdef MW_OPENGL
#include <Mw/Widget/OpenGL.h>
#ifdef USE_GDI
@ -516,5 +518,10 @@ MwClassRec MwOpenGLClassRec = {wcreate, /* create */
NULL, /* clipboard */
NULL, NULL, NULL, NULL};
MwClass MwOpenGLClass = &MwOpenGLClassRec;
#else
MWDECL MwClass MwOpenGLClass;
MwClass MwOpenGLClass = NULL;
#endif
#endif

View file

@ -1,10 +1,12 @@
#include <Mw/Milsko.h>
#include <Mw/Widget/Vulkan.h>
/**
* ioixd maintains this file. nishi doesn't know vulkan at all
*/
#ifdef MW_VULKAN
#include <Mw/Widget/Vulkan.h>
#ifdef USE_GDI
#define VK_USE_PLATFORM_WIN32_KHR 1
#endif
@ -165,6 +167,8 @@ static int _destroy(MwWidget handle) {
static void destroy(MwWidget handle) {
int err = _destroy(handle);
(void)err;
}
static void* vulkan_lib_load() {
@ -577,3 +581,8 @@ MwClassRec MwVulkanClassRec = {
NULL,
NULL};
MwClass MwVulkanClass = &MwVulkanClassRec;
#else
MWDECL MwClass MwVulkanClass;
MwClass MwVulkanClass = NULL;
#endif