diff options
author | Chuyan Zhang <me@zcy.moe> | 2024-09-05 01:11:42 -0700 |
---|---|---|
committer | Chuyan Zhang <me@zcy.moe> | 2024-09-05 01:11:42 -0700 |
commit | 8c7926588b616988e7b016eaf704acee0ee77cc9 (patch) | |
tree | a1bb11131aea964f9fa0bca76196c3351530c01d | |
download | iris-8c7926588b616988e7b016eaf704acee0ee77cc9.tar.gz iris-8c7926588b616988e7b016eaf704acee0ee77cc9.zip |
Initial setup
-rw-r--r-- | .gitignore | 41 | ||||
-rw-r--r-- | .gitmodules | 12 | ||||
-rw-r--r-- | CMakeLists.txt | 36 | ||||
m--------- | ext/argparse | 0 | ||||
m--------- | ext/imgui | 0 | ||||
-rw-r--r-- | ext/imgui.cmake | 13 | ||||
m--------- | ext/tinygltf.git | 0 | ||||
m--------- | ext/tinyobjloader | 0 | ||||
-rw-r--r-- | src/app.cpp | 63 |
9 files changed, 165 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6eb228f --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# clangd cache +.cache/ + +# VSCode settings +.vscode/ + +# CMake build directory +build/
\ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3c3f029 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "ext/tinyobjloader"] + path = ext/tinyobjloader + url = https://github.com/tinyobjloader/tinyobjloader.git +[submodule "ext/imgui"] + path = ext/imgui + url = https://github.com/ocornut/imgui.git +[submodule "ext/argparse"] + path = ext/argparse + url = https://github.com/p-ranav/argparse.git +[submodule "ext/tinygltf.git"] + path = ext/tinygltf.git + url = https://github.com/syoyo/tinygltf.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..05e821f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,36 @@ +# CMakeLists.txt + +cmake_minimum_required(VERSION 3.11) + +project(IrisRenderer VERSION 1.0) + +set(CMAKE_CXX_STANDARD 20) +set(PROJECT_ROOT ${CMAKE_SOURCE_DIR}) +set(SRC_DIR ${PROJECT_ROOT}/src) +set(EXT_DIR ${PROJECT_ROOT}/ext) + +# Add external libraries +include(${EXT_DIR}/imgui.cmake) + +add_library(argparse INTERFACE) +target_include_directories(argparse INTERFACE ${EXT_DIR}/argparse/include) + +add_library(tinygltf INTERFACE) +target_include_directories(tinygltf INTERFACE ${EXT_DIR}/tinygltf) + +add_library(tinyobjloader INTERFACE) +target_include_directories(tinyobjloader INTERFACE ${EXT_DIR}/tinyobjloader) + +# Add your project's source files +file(GLOB_RECURSE SOURCES "${SRC_DIR}/*.cpp") + +# Add executable from your source files +add_executable(IrisRenderer ${SOURCES}) + +find_package(glfw3 REQUIRED) + +# Link external libraries to your project +target_link_libraries(IrisRenderer PRIVATE argparse imgui tinygltf tinyobjloader glfw) + +# Optional: Include additional compiler options or flags +target_compile_options(IrisRenderer PRIVATE -Wall -Wextra) diff --git a/ext/argparse b/ext/argparse new file mode 160000 +Subproject fd13c2859131ab463e617a5a8abcc69eb7e1d89 diff --git a/ext/imgui b/ext/imgui new file mode 160000 +Subproject 1dfbb100d6ca6e7d813102e979c07f66a56546b diff --git a/ext/imgui.cmake b/ext/imgui.cmake new file mode 100644 index 0000000..42d7c5d --- /dev/null +++ b/ext/imgui.cmake @@ -0,0 +1,13 @@ +set(IMGUI_DIR ${EXT_DIR}/imgui) +add_library(imgui STATIC + ${IMGUI_DIR}/imgui.cpp + ${IMGUI_DIR}/imgui_demo.cpp + ${IMGUI_DIR}/imgui_draw.cpp + ${IMGUI_DIR}/imgui_widgets.cpp + ${IMGUI_DIR}/backends/imgui_impl_glfw.cpp +) + +target_include_directories(imgui PUBLIC + ${IMGUI_DIR} + ${IMGUI_DIR}/backends +)
\ No newline at end of file diff --git a/ext/tinygltf.git b/ext/tinygltf.git new file mode 160000 +Subproject fda7422022ff058b1b7b501d373a97b1cc377bf diff --git a/ext/tinyobjloader b/ext/tinyobjloader new file mode 160000 +Subproject 50461d0e0a77c178bb478e9319d7de82f469a84 diff --git a/src/app.cpp b/src/app.cpp new file mode 100644 index 0000000..7ef2310 --- /dev/null +++ b/src/app.cpp @@ -0,0 +1,63 @@ +#include "imgui.h" +#include "imgui_impl_glfw.h" +#include "imgui_impl_vulkan.h" +#include "argparse/argparse.hpp" +#include <GLFW/glfw3.h> + +#include <iostream> + +GLFWwindow *start_up(int width, int height) { + return nullptr; +} + +void main_loop(GLFWwindow *window) { + +} + +void shut_down(GLFWwindow *window) { + +} + +int main(int argc, char** argv) { + argparse::ArgumentParser program("IrisRenderer"); + program.add_argument("width") + .help("display width of the window") + .scan<'i', int>(); + program.add_argument("height") + .help("display height of the window") + .scan<'i', int>(); + + try { + program.parse_args(argc, argv); + } catch (const std::exception& err) { + std::cerr << err.what() << std::endl; + std::cerr << program; + return 1; + } + + int window_width = program.get<int>("width"); + int window_height = program.get<int>("height"); + + if (!glfwInit()) { + const char* description = nullptr; + glfwGetError(&description); + if (description != nullptr) { + std::cerr << "Error: " << description << std::endl; + } else { + std::cerr << "Failed to initialize GLFW" << std::endl; + } + + glfwTerminate(); + return -1; + } + + auto window = start_up(window_width, window_height); + if (window == nullptr) { + return -2; + } + while (!glfwWindowShouldClose(window)) { + main_loop(window); + } + shut_down(window); + return 0; +}
\ No newline at end of file |