mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
move to subproject & initial hook commit
This commit is contained in:
parent
2083b6c85e
commit
d7b597ed0f
56 changed files with 103 additions and 17 deletions
|
|
@ -1,10 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.29)
|
||||
|
||||
project(lsfg-vk-base-base
|
||||
VERSION 0.0.1
|
||||
DESCRIPTION "lsfg-vk-base: LSFG on Linux through Vulkan"
|
||||
LANGUAGES CXX)
|
||||
|
||||
# cmake options
|
||||
|
||||
set(CMAKE_CXX_COMPILER clang++)
|
||||
|
|
@ -16,20 +11,24 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|||
|
||||
# main project
|
||||
|
||||
project(lsfg-vk
|
||||
VERSION 0.0.1
|
||||
DESCRIPTION "lsfg-vk: LSFG on Linux through Vulkan"
|
||||
LANGUAGES CXX)
|
||||
|
||||
add_subdirectory(lsfg-vk-gen)
|
||||
|
||||
file(GLOB SOURCES
|
||||
"src/core/*.cpp"
|
||||
"src/shaderchains/*.cpp"
|
||||
"src/*.cpp"
|
||||
)
|
||||
|
||||
add_library(lsfg-vk-base SHARED ${SOURCES})
|
||||
add_library(lsfg-vk SHARED ${SOURCES})
|
||||
|
||||
target_include_directories(lsfg-vk-base
|
||||
PRIVATE include
|
||||
PUBLIC public)
|
||||
target_link_libraries(lsfg-vk-base
|
||||
PUBLIC vulkan)
|
||||
target_compile_options(lsfg-vk-base PRIVATE
|
||||
target_include_directories(lsfg-vk
|
||||
PRIVATE include)
|
||||
target_link_libraries(lsfg-vk
|
||||
PRIVATE lsfg-vk-gen)
|
||||
target_compile_options(lsfg-vk PRIVATE
|
||||
-Weverything
|
||||
# disable compat c++ flags
|
||||
-Wno-pre-c++20-compat-pedantic
|
||||
|
|
@ -43,7 +42,6 @@ target_compile_options(lsfg-vk-base PRIVATE
|
|||
-Wno-switch-default # ignore missing default
|
||||
-Wno-padded # ignore automatic padding
|
||||
-Wno-exit-time-destructors # allow globals
|
||||
-Wno-global-constructors
|
||||
# required for vulkan
|
||||
-Wno-cast-function-type-strict
|
||||
)
|
||||
|
|
|
|||
37
include/log.hpp
Normal file
37
include/log.hpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef LOG_HPP
|
||||
#define LOG_HPP
|
||||
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
|
||||
namespace Log {
|
||||
|
||||
const std::string_view WHITE = "\033[1;37m";
|
||||
const std::string_view YELLOW = "\033[1;33m";
|
||||
const std::string_view RED = "\033[1;31m";
|
||||
const std::string_view GRAY = "\033[1;30m";
|
||||
const std::string_view RESET = "\033[0m";
|
||||
|
||||
template<typename... Args>
|
||||
void info(std::format_string<Args...> fmt, Args&&... args) {
|
||||
std::cerr << WHITE << std::format(fmt, std::forward<Args>(args)...) << RESET << '\n';
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
void warn(std::format_string<Args...> fmt, Args&&... args) {
|
||||
std::cerr << YELLOW << std::format(fmt, std::forward<Args>(args)...) << RESET << '\n';
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
void error(std::format_string<Args...> fmt, Args&&... args) {
|
||||
std::cerr << RED << std::format(fmt, std::forward<Args>(args)...) << RESET << '\n';
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
void debug(std::format_string<Args...> fmt, Args&&... args) {
|
||||
std::cerr << GRAY << std::format(fmt, std::forward<Args>(args)...) << RESET << '\n';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // LOG_HPP
|
||||
36
lsfg-vk-gen/CMakeLists.txt
Normal file
36
lsfg-vk-gen/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
project(lsfg-vk-gen
|
||||
VERSION 0.0.1
|
||||
DESCRIPTION "lsfg-vk-gen: LSFG on Linux through Vulkan (backend)"
|
||||
LANGUAGES CXX)
|
||||
|
||||
file(GLOB BACKEND_SOURCES
|
||||
"src/core/*.cpp"
|
||||
"src/shaderchains/*.cpp"
|
||||
"src/*.cpp"
|
||||
)
|
||||
|
||||
add_library(lsfg-vk-gen SHARED ${BACKEND_SOURCES})
|
||||
|
||||
target_include_directories(lsfg-vk-gen
|
||||
PRIVATE include
|
||||
PUBLIC public)
|
||||
target_link_libraries(lsfg-vk-gen
|
||||
PUBLIC vulkan)
|
||||
target_compile_options(lsfg-vk-gen PRIVATE
|
||||
-Weverything
|
||||
# disable compat c++ flags
|
||||
-Wno-pre-c++20-compat-pedantic
|
||||
-Wno-pre-c++17-compat
|
||||
-Wno-c++98-compat-pedantic
|
||||
-Wno-c++98-compat
|
||||
# disable other flags
|
||||
-Wno-missing-designated-field-initializers
|
||||
-Wno-shadow # allow shadowing
|
||||
-Wno-switch-enum # ignore missing cases
|
||||
-Wno-switch-default # ignore missing default
|
||||
-Wno-padded # ignore automatic padding
|
||||
-Wno-exit-time-destructors # allow globals
|
||||
-Wno-global-constructors
|
||||
# required for vulkan
|
||||
-Wno-cast-function-type-strict
|
||||
)
|
||||
|
|
@ -94,8 +94,8 @@ Context::Context(const Core::Device& device, uint32_t width, uint32_t height, in
|
|||
}
|
||||
|
||||
void Context::present(const Core::Device& device, int inSem, int outSem) {
|
||||
Core::Semaphore inSemaphore(device, inSem);
|
||||
Core::Semaphore outSemaphore(device, outSem);
|
||||
const Core::Semaphore inSemaphore(device, inSem);
|
||||
const Core::Semaphore outSemaphore(device, outSem);
|
||||
|
||||
Core::CommandBuffer cmdBuffer(device, this->cmdPool);
|
||||
cmdBuffer.begin();
|
||||
15
src/init.cpp
Normal file
15
src/init.cpp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include "log.hpp"
|
||||
|
||||
extern "C" void __attribute__((constructor)) init();
|
||||
extern "C" [[noreturn]] void __attribute__((destructor)) deinit();
|
||||
|
||||
void init() {
|
||||
Log::info("lsfg-vk: init() called");
|
||||
}
|
||||
|
||||
void deinit() {
|
||||
Log::debug("lsfg-vk: deinit() called, exiting");
|
||||
// for some reason some applications unload the library despite it containing
|
||||
// the dl functions. this will lead to a segmentation fault, so we exit early.
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue