Skip to content
Snippets Groups Projects
Verified Commit 17b8ab61 authored by Josch Morgenstern's avatar Josch Morgenstern
Browse files

[#83] remove boost, using std::filesystem

parent 7b3fe284
No related branches found
No related tags found
1 merge request!72Draft: Resolve "Pfade zu Ressourcen abhängig von working dir"
Pipeline #25913 passed
...@@ -17,7 +17,6 @@ set(vkcv_config_msg " - Library: ") ...@@ -17,7 +17,6 @@ set(vkcv_config_msg " - Library: ")
include(${vkcv_config_lib}/GLFW.cmake) # glfw-x11 / glfw-wayland # libglfw3-dev include(${vkcv_config_lib}/GLFW.cmake) # glfw-x11 / glfw-wayland # libglfw3-dev
include(${vkcv_config_lib}/Vulkan.cmake) # vulkan-intel / vulkan-radeon / nvidia # libvulkan-dev include(${vkcv_config_lib}/Vulkan.cmake) # vulkan-intel / vulkan-radeon / nvidia # libvulkan-dev
include(${vkcv_config_lib}/SPIRV_Cross.cmake) # SPIRV-Cross # libspirv_cross_c_shared include(${vkcv_config_lib}/SPIRV_Cross.cmake) # SPIRV-Cross # libspirv_cross_c_shared
include(${vkcv_config_lib}/Boost.cmake) # Boost
# cleanup of compiler flags # cleanup of compiler flags
if (vkcv_flags) if (vkcv_flags)
......
set( BOOST_ROOT "C:/Tools/Boost/" CACHE PATH "Boost library path" )
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost REQUIRED COMPONENTS filesystem)
if (Boost_FOUND)
list(APPEND vkcv_includes ${Boost_INCLUDE_DIR})
list(APPEND vkcv_libraries ${Boost_LIBRARIES})
message(${vkcv_config_msg} " Boost - ")
endif ()
...@@ -2,12 +2,21 @@ ...@@ -2,12 +2,21 @@
#include <string> #include <string>
namespace utils { namespace utils {
extern std::string g_binaryDir;
/** /**
* @brief Given a relative path to the executable, the absolute path is returned * @brief
* *
* @param path The relative path * @param path The relative path
* @return std::string The absolute path * @return std::string The absolute path
*/ */
std::string absolutePath(std::string path); std::string absolutePath(std::string path);
/**
* @brief Set the Binary Dir object
*
* @param argv0
*/
void setBinaryDir(const char* argv0);
} }
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
int main(int argc, const char** argv) { int main(int argc, const char** argv) {
const char* applicationName = "First Mesh"; const char* applicationName = "First Mesh";
utils::setBinaryDir(argv[0]);
uint32_t windowWidth = 800; uint32_t windowWidth = 800;
uint32_t windowHeight = 600; uint32_t windowHeight = 600;
......
#include <vkcv/Utils.hpp> #include <vkcv/Utils.hpp>
#include <boost/dll.hpp> #include <filesystem>
namespace utils { namespace utils {
std::string g_binaryDir;
std::string absolutePath(std::string path) { std::string absolutePath(std::string path) {
boost::filesystem::path root = boost::dll::program_location().parent_path(); std::filesystem::path relative(path);
boost::filesystem::path relative(path); std::filesystem::path fullpath = g_binaryDir / relative;
boost::filesystem::path fullpath = root / relative;
return fullpath.string(); return fullpath.string();
} }
void setBinaryDir(const char* argv0) {
std::filesystem::path binaryPath(argv0);
std::filesystem::path binaryDir = binaryPath.parent_path();
utils::g_binaryDir = binaryDir.string();
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment