Fix some stuff in Cmake
This commit is contained in:
@@ -6,18 +6,17 @@ file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
|
|||||||
"src/*.c" "src/*.h"
|
"src/*.c" "src/*.h"
|
||||||
)
|
)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
file(GLOB_RECURSE METAL_FILES CONFIGURE_DEPENDS "src/*.m")
|
||||||
file(GLOB_RECURSE METAL_FILES CONFIGURE_DEPENDS
|
|
||||||
"src/*.m")
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
add_library(Gryphn ${SOURCE_FILES} ${METAL_FILES})
|
add_library(Gryphn ${SOURCE_FILES} ${METAL_FILES})
|
||||||
target_include_directories(Gryphn PUBLIC ${CMAKE_SOURCE_DIR}/gryphn/src/)
|
target_include_directories(Gryphn PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/)
|
||||||
target_include_directories(Gryphn PUBLIC ${CMAKE_SOURCE_DIR}/gryphn/include/)
|
target_include_directories(Gryphn PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/)
|
||||||
target_include_directories(Gryphn PUBLIC ${CMAKE_SOURCE_DIR}/gryphn/src/utils)
|
target_include_directories(Gryphn PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/utils)
|
||||||
target_include_directories(Gryphn PUBLIC ${CMAKE_SOURCE_DIR}/gryphn/src/utils/utils)
|
target_include_directories(Gryphn PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/utils)
|
||||||
add_compile_definitions(GN_REVEAL_IMPL)
|
add_compile_definitions(GN_REVEAL_IMPL)
|
||||||
|
|
||||||
|
make_directory(${CMAKE_BINARY_DIR}/gryphn/rendering_apis/)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_compile_definitions(GN_PLATFORM_WIN32)
|
add_compile_definitions(GN_PLATFORM_WIN32)
|
||||||
# add_subdirectory(rendering_api/dirctx/)
|
# add_subdirectory(rendering_api/dirctx/)
|
||||||
@@ -41,7 +40,6 @@ endif()
|
|||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
add_compile_definitions(GN_PLATFORM_LINUX)
|
add_compile_definitions(GN_PLATFORM_LINUX)
|
||||||
add_subdirectory(rendering_api/vulkan/)
|
add_subdirectory(rendering_api/vulkan/)
|
||||||
target_include_directories(Gryphn PUBLIC ${CMAKE_SOURCE_DIR/Gryphn/rendering_api/metal/depends/metal-cpp/)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(Gryphn)
|
target_link_libraries(Gryphn)
|
||||||
|
@@ -13,20 +13,17 @@ if (APPLE)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(Vulkan REQUIRED)
|
||||||
add_library(GryphnVulkanImpl SHARED ${SOURCE_FILES} ${METAL_FILES})
|
add_library(GryphnVulkanImpl SHARED ${SOURCE_FILES} ${METAL_FILES})
|
||||||
target_include_directories(GryphnVulkanImpl PUBLIC
|
target_include_directories(GryphnVulkanImpl PUBLIC
|
||||||
${CMAKE_SOURCE_DIR}/gryphn/include/
|
${Vulkan_INCLUDE_DIRS}
|
||||||
${CMAKE_SOURCE_DIR}/gryphn/src/
|
${CMAKE_CURRENT_SOURCE_DIR}/../../include/
|
||||||
${CMAKE_SOURCE_DIR}/gryphn/src/utils/
|
${CMAKE_CURRENT_SOURCE_DIR}/../../src/
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/
|
||||||
src/
|
src/
|
||||||
/Applications/vulkansdk/macOS/include/
|
|
||||||
)
|
)
|
||||||
add_compile_definitions(GN_REVEAL_IMPL)
|
add_compile_definitions(GN_REVEAL_IMPL)
|
||||||
|
target_link_libraries(GryphnVulkanImpl ${Vulkan_LIBRARY})
|
||||||
add_library(libvulkan SHARED IMPORTED)
|
|
||||||
set_target_properties(libvulkan PROPERTIES IMPORTED_LOCATION /Applications/vulkansdk/macOS/lib/libvulkan.dylib)
|
|
||||||
|
|
||||||
target_link_libraries(GryphnVulkanImpl libvulkan)
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_compile_definitions(GN_PLATFORM_WIN32)
|
add_compile_definitions(GN_PLATFORM_WIN32)
|
||||||
@@ -48,7 +45,15 @@ if(UNIX AND NOT APPLE)
|
|||||||
add_compile_definitions(GN_PLATFORM_LINUX)
|
add_compile_definitions(GN_PLATFORM_LINUX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/gryphn/rendering_apis)
|
if (APPLE)
|
||||||
add_custom_command(TARGET GryphnVulkanImpl POST_BUILD
|
add_custom_command(TARGET GryphnVulkanImpl POST_BUILD
|
||||||
COMMAND mv libGryphnVulkanImpl.dylib ../../rendering_apis/GryphnVulkanImpl.dylib
|
COMMAND mv libGryphnVulkanImpl.dylib
|
||||||
)
|
${CMAKE_BINARY_DIR}/gryphn/rendering_apis/GryphnVulkanImpl.dylib
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if (UNIX AND NOT APPLE)
|
||||||
|
add_custom_command(TARGET GryphnVulkanImpl POST_BUILD
|
||||||
|
COMMAND mv libGryphnVulkanImpl.so
|
||||||
|
${CMAKE_BINARY_DIR}/gryphn/rendering_apis/GryphnVulkanImpl.so
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
@@ -56,23 +56,20 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debuggerDebugCallback(
|
|||||||
gnReturnCode gnCreateInstanceFn(gnInstanceHandle instance, gnInstanceInfo instanceInfo) {
|
gnReturnCode gnCreateInstanceFn(gnInstanceHandle instance, gnInstanceInfo instanceInfo) {
|
||||||
instance->instance = malloc(sizeof(gnPlatformInstance));
|
instance->instance = malloc(sizeof(gnPlatformInstance));
|
||||||
|
|
||||||
|
|
||||||
#ifdef GN_PLATFORM_LINUX
|
#ifdef GN_PLATFORM_LINUX
|
||||||
#ifdef GN_WINDOW_X11
|
gnBool isX11 = gnFalse;
|
||||||
uint32_t extensionCount = 3;
|
uint32_t extensionCount = 3;
|
||||||
const char* extensions[] = {
|
const char* extensions[3];
|
||||||
"VK_KHR_xlib_surface",
|
if (isX11) {
|
||||||
"VK_KHR_surface",
|
extensions[0] = "VK_KHR_xlib_surface";
|
||||||
VK_EXT_DEBUG_UTILS_EXTENSION_NAME
|
extensions[1] = "VK_KHR_surface";
|
||||||
};
|
extensions[2] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
|
||||||
#endif
|
} else {
|
||||||
#ifdef GN_WINFDOW_WAYLAND
|
extensions[0] = "VK_KHR_wayland_surface";
|
||||||
uint32_t extensionCount = 3;
|
extensions[1] = "VK_KHR_surface";
|
||||||
const char* extensions[] = {
|
extensions[2] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
|
||||||
"VK_KHR_wayland_surface",
|
}
|
||||||
"VK_KHR_surface",
|
|
||||||
VK_EXT_DEBUG_UTILS_EXTENSION_NAME
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef GN_PLATFORM_WINDOWS
|
#ifdef GN_PLATFORM_WINDOWS
|
||||||
uint32_t extensionCount = 3;
|
uint32_t extensionCount = 3;
|
||||||
|
@@ -50,7 +50,7 @@ gnPhysicalDevice* gnGetPhysicalDevicesFn(gnInstanceHandle instance, uint32_t* de
|
|||||||
}
|
}
|
||||||
|
|
||||||
gnBool gnQueueCanPresentToSurfaceFn(const struct gnPhysicalDevice_t device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface) {
|
gnBool gnQueueCanPresentToSurfaceFn(const struct gnPhysicalDevice_t device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface) {
|
||||||
VkBool32 supportsPresent = false;
|
VkBool32 supportsPresent = VK_FALSE;
|
||||||
vkGetPhysicalDeviceSurfaceSupportKHR(device.physicalDevice->device, queueIndex, windowSurface->windowSurface->surface, &supportsPresent);
|
vkGetPhysicalDeviceSurfaceSupportKHR(device.physicalDevice->device, queueIndex, windowSurface->windowSurface->surface, &supportsPresent);
|
||||||
if (supportsPresent)
|
if (supportsPresent)
|
||||||
return gnTrue;
|
return gnTrue;
|
||||||
|
@@ -12,7 +12,7 @@ void gnBufferData(gnBufferHandle buffer, size_t dataSize, void* data) {
|
|||||||
buffer->device->deviceFunctions->_gnBufferData(buffer, dataSize, data);
|
buffer->device->deviceFunctions->_gnBufferData(buffer, dataSize, data);
|
||||||
}
|
}
|
||||||
void* gnMapBuffer(gnBufferHandle buffer) {
|
void* gnMapBuffer(gnBufferHandle buffer) {
|
||||||
if (buffer->info.type == GN_STATIC_DRAW) {
|
if (buffer->info.usage == GN_STATIC_DRAW) {
|
||||||
gnDebuggerSetErrorMessage(buffer->device->instance->debugger, (gnMessageData){
|
gnDebuggerSetErrorMessage(buffer->device->instance->debugger, (gnMessageData){
|
||||||
.message = gnCreateString("Cannot map static draw buffers")
|
.message = gnCreateString("Cannot map static draw buffers")
|
||||||
});
|
});
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
#include <platform/gryphn_platform_include.h>
|
#include <platform/gryphn_platform_include.h>
|
||||||
#include "gryphn_dynamic_library.h"
|
#include "gryphn_dynamic_library.h"
|
||||||
// #include <dlfcn.h>
|
// #include <dlfcn.h>
|
||||||
|
#include "stdbool.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
|
||||||
gnBool gnIsAPISupported(gnRenderingAPI api) {
|
gnBool gnIsAPISupported(gnRenderingAPI api) {
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "stdint.h"
|
||||||
#include "utils/gryphn_string.h"
|
#include "utils/gryphn_string.h"
|
||||||
#include "core/gryphn_handles.h"
|
#include "core/gryphn_handles.h"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user