Skip to content
Snippets Groups Projects
Commit afb66bc5 authored by Baton Théau's avatar Baton Théau
Browse files

Resole bug with linux

parent ab9d98e2
No related branches found
No related tags found
No related merge requests found
cmake_minimum_required(VERSION 3.1)
#==============================================================
# Configuration
#==============================================================
set(PROJECT_NAME "Main")
set(EXECUTABLE_NAME "Main")
set(CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD ${CXX_STANDARD})
if (MSVC)
add_compile_options(/EHsc)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
#=====================================
# Options
#=====================================
if(WIN32)
option(CMAKE_TOOLCHAIN_FILE "C:/vcpkg/vcpkg/scripts/buildsystems/vcpkg.cmake")
elseif(UNIX)
#option(CMAKE_TOOLCHAIN_FILE "/amuhome/b20017738/Bureau/vcpkg/scripts/buildsystems/vcpkg.cmake")
endif()
#==============================================================
# Sources
#==============================================================
set(SOURCES ${CMAKE_SOURCE_DIR}/source/)
set(LIBRARY ${CMAKE_SOURCE_DIR}/library/)
set(INCLUDE ${CMAKE_SOURCE_DIR}/include/)
set(VCPKG_INCLUDE ${CMAKE_SOURCE_DIR}/vcpkg_installed/*/include)
set(VCPKG_LIB ${CMAKE_SOURCE_DIR}/vcpkg_installed/*/lib)
#==============================================================
# Build
#==============================================================
project(${PROJECT_NAME})
set(CURRENT_TARGET ${EXECUTABLE_NAME})
add_executable(${CURRENT_TARGET})
foreach(dir ${SOURCES})
add_subdirectory(${dir})
endforeach()
set_property(TARGET ${CURRENT_TARGET} PROPERTY RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_SOURCE_DIR}>)
#==============================================================
# Linking
#==============================================================
target_include_directories(${CURRENT_TARGET} PRIVATE ${INCLUDE})
#list(APPEND CMAKE_PREFIX_PATH "/amuhome/b20017738/Bureau/vcpkg/packages/glew_x64-linux")
#list(APPEND CMAKE_PREFIX_PATH "/amuhome/b20017738/Bureau/vcpkg/packages/glm_x64-linux")
#list(APPEND CMAKE_PREFIX_PATH "/amuhome/b20017738/Bureau/vcpkg/packages/imgui_x64-linux")
find_package(glfw3 REQUIRED)
find_package(GLEW REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(imgui REQUIRED)
target_link_libraries(${CURRENT_TARGET} PRIVATE glfw)
target_link_libraries(${CURRENT_TARGET} PRIVATE GLEW::GLEW)
target_link_libraries(${CURRENT_TARGET} PRIVATE glm::glm-header-only)
target_link_libraries(${CURRENT_TARGET} PRIVATE imgui::imgui)
Main 0 → 100755
File added
File moved
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <GL/glew.h> #include <GL/glew.h>
#include <exception> #include <exception>
#include <stdexcept> #include <stdexcept>
#include <cstring>
#include <iostream> #include <iostream>
......
...@@ -5,17 +5,6 @@ ...@@ -5,17 +5,6 @@
namespace megu { namespace megu {
namespace layout { namespace layout {
enum Value;
}
using Layout = std::list<layout::Value>;
using Layout_Initializer = std::initializer_list<layout::Value>;
namespace layout {
inline size_t weight(const Layout & layout) {
return std::accumulate(layout.begin(), layout.end(), 0);
}
enum Value : uint8_t { enum Value : uint8_t {
POSITION = 3, POSITION = 3,
FLAT = 2, FLAT = 2,
...@@ -26,4 +15,13 @@ namespace megu { ...@@ -26,4 +15,13 @@ namespace megu {
ID = 1, ID = 1,
}; };
} }
using Layout = std::list<layout::Value>;
using Layout_Initializer = std::initializer_list<layout::Value>;
namespace layout {
inline size_t weight(const Layout & layout) {
return std::accumulate(layout.begin(), layout.end(), 0);
}
}
} }
\ No newline at end of file
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#include "../buffers/Layout.hpp" #include "../buffers/Layout.hpp"
namespace megu { namespace megu {
using Vertices = std::vector<float>; using Vertices_t = std::vector<float>;
using Elements = std::vector<unsigned int>; using Elements_t = std::vector<unsigned int>;
enum Primitive { enum Primitive {
TRIANGLES = GL_TRIANGLES, TRIANGLES = GL_TRIANGLES,
...@@ -25,7 +25,7 @@ namespace megu { ...@@ -25,7 +25,7 @@ namespace megu {
Geometry(const Layout_Initializer &); Geometry(const Layout_Initializer &);
~Geometry() = default; ~Geometry() = default;
virtual const Vertices & vertices() const = 0; virtual const Vertices_t & vertices() const = 0;
private: private:
Layout _layout; Layout _layout;
...@@ -38,7 +38,7 @@ namespace megu { ...@@ -38,7 +38,7 @@ namespace megu {
Geometry_Indiced(const Layout_Initializer &); Geometry_Indiced(const Layout_Initializer &);
~Geometry_Indiced() = default; ~Geometry_Indiced() = default;
virtual const Elements & elements() const = 0; virtual const Elements_t & elements() const = 0;
}; };
template <class T, Primitive P> template <class T, Primitive P>
...@@ -48,8 +48,8 @@ namespace megu { ...@@ -48,8 +48,8 @@ namespace megu {
Static_Geometry(const Layout_Initializer &); Static_Geometry(const Layout_Initializer &);
~Static_Geometry() = default; ~Static_Geometry() = default;
const Vertices & vertices() const final override {return Static_Geometry<T, P>::Vertices();} const Vertices_t & vertices() const final override {return Static_Geometry<T, P>::Vertices();}
static const Vertices & Vertices() {return T::Vertices();} static const Vertices_t & Vertices() {return T::Vertices();}
}; };
template <class T, Primitive P> template <class T, Primitive P>
...@@ -59,8 +59,8 @@ namespace megu { ...@@ -59,8 +59,8 @@ namespace megu {
Static_Geometry_Indiced(const Layout_Initializer &); Static_Geometry_Indiced(const Layout_Initializer &);
~Static_Geometry_Indiced() = default; ~Static_Geometry_Indiced() = default;
const Vertices & elements() const final override {return Static_Geometry_Indiced<T, P>::Elements();} const Elements_t & elements() const final override {return Static_Geometry_Indiced<T, P>::Elements();}
static const Vertices & Elements() {return T::Elements();} static const Elements_t & Elements() {return T::Elements();}
}; };
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#define WINDOW_WIDTH 1200 #define WINDOW_WIDTH 1200
#define WINDOW_HEIGHT 720 #define WINDOW_HEIGHT 720
int main(int argc, const char * argv) { int main(int argc, const char * argv[]) {
try { try {
//? GLFW //? GLFW
if(glfwInit() == GLFW_FALSE) { if(glfwInit() == GLFW_FALSE) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment