fix some build errors or something

This commit is contained in:
2026-05-08 12:37:23 -04:00
parent dca85ff7e8
commit d5c6aa10ae
6 changed files with 28 additions and 5 deletions
+1
View File
@@ -1 +1,2 @@
build/
glfw
+6 -1
View File
@@ -2,9 +2,14 @@ cmake_minimum_required(VERSION 3.12)
project(ChemistryRenderingApp LANGUAGES C CXX OBJCXX) # OBJCXX is required for Metal .mm files
add_executable(ChemistryRenderingApp main.cpp)
target_include_directories(ChemistryRenderingApp PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(ChemistryRenderingApp PRIVATE GryphnLoader)
target_include_directories(ChemistryRenderingApp PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/glfw/include/")
target_link_libraries(ChemistryRenderingApp PRIVATE GryphnLoader glfw)
project(ChemistryRenderingApp LANGUAGES C CXX OBJC OBJCXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_subdirectory(Gryphn)
set(BUILD_SHARED_LIBS ON)
add_subdirectory(glfw)
set(BUILD_SHARED_LIBS OFF)
@@ -1,6 +1,6 @@
#include "gryphn_return_code.h"
#include "gryphn_instance.h"
#include "stdlib.h"
#include "stdio.h"
typedef gnReturnCode (*PFN_initBackend)(gnInstance, gnInstanceCreateInfo*);
+2 -2
View File
@@ -4,7 +4,7 @@
#include "gryphn_handle.h"
#include "metal_functions.h"
extern "C" uint32_t gnInternalIsApiSupported(gnVersion version) {
uint32_t gnInternalIsApiSupported(gnVersion version) {
if (version != gnCreateVersion(1, 0, 0)) return 0;
id<MTLDevice> testDevice = MTLCreateSystemDefaultDevice();
if (testDevice == nil)
@@ -17,7 +17,7 @@ gnReturnCode destroyBackend(gnInstance instance) {
return GN_SUCCESS;
}
extern "C" gnReturnCode initBackend(gnInstance instance, gnInstanceCreateInfo* info) {
gnReturnCode initBackend(gnInstance instance, gnInstanceCreateInfo* info) {
instance->dispatchTable.destroyInstance = destroyBackend;
instance->dispatchTable.enumeratePhysicalDevices = metalEnumeratePhysicalDevices;
instance->dispatchTable.getPhysicalDeviceProperties = metalGetPhysicalDeviceProperties;
+1 -1
View File
@@ -63,6 +63,6 @@ gnReturnCode metalCreateDevice(gnInstance instance, gnDeviceCreateInfo* createIn
}
gnReturnCode metalDestroyDevice(gnDevice device) {
// [device->internalData release];
device->internalData = NULL;
return GN_SUCCESS;
}
+17
View File
@@ -1,6 +1,7 @@
#include "Gryphn/gryphn.h"
#include <iostream>
#include "stdlib.h"
#include "glfw/include/GLFW/glfw3.h"
#define CONCAT_IMPL(a, b) a##b
#define CONCAT(a, b) CONCAT_IMPL(a, b)
@@ -11,6 +12,7 @@
<< ": " << CONCAT(res, __LINE__) << "\n"; \
}
GLFWwindow* window;
gnVersion version = gnCreateVersion(1, 0, 0);
gnInstance instance;
gnDevice device;
@@ -61,13 +63,28 @@ void createDevice() {
}
int main() {
if (!glfwInit()) {
std::cout << "Failed to init GLFW\n";
return -1;
}
window = glfwCreateWindow(640, 360, "Chemistry Rendering App", nullptr, nullptr);
if (!window) {
std::cerr << "Failed to create window\n";
return -1;
}
try {
createInstance();
createDevice();
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();
}
} catch (const std::exception& e) {
std::cerr << "Caught Exception: " << e.what() << "\n";
return 0;
}
glfwDestroyWindow(window);
gnDestroyDevice(&device);
gnDestroyInstance(&instance);
}