diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c14d12..aba1b5d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ include_directories(${STB_HEADERS}) include_directories(external/glm) include_directories(external/glm/glm) -add_library(${PROJECT_NAME} STATIC ${LIB_SRC}) +add_library(${PROJECT_NAME} SHARED ${LIB_SRC}) set(GLFW_DIR external/glfw) set(FREETYPE_DIR external/freetype) @@ -59,7 +59,7 @@ add_subdirectory(${FREETYPE_DIR}) target_include_directories(${PROJECT_NAME} PUBLIC ${FREETYPE_DIR}/include) target_link_directories(${PROJECT_NAME} PUBLIC ${FREETYPE_LIB_DIR}) -set(DEPS glfw assimp freetype ${CMAKE_DL_LIBS}) +set(DEPS glfw3 assimp freetype ${CMAKE_DL_LIBS}) target_link_libraries(${PROJECT_NAME} ${DEPS}) diff --git a/material.cpp b/material.cpp index 738ed33..a914d80 100755 --- a/material.cpp +++ b/material.cpp @@ -22,7 +22,7 @@ namespace vb01{ } void Material::initShader(){ - string basePath = "../../vb01/", shaderName; + string basePath = Root::getSingleton()->getLibPath(), shaderName; switch(type){ case MATERIAL_2D: shaderName = "texture."; diff --git a/root.cpp b/root.cpp index 248c8ee..33c5f26 100755 --- a/root.cpp +++ b/root.cpp @@ -38,9 +38,10 @@ namespace vb01{ camera = new Camera(); } - void Root::start(int width, int height, string name){ + void Root::start(int width, int height, string libPath, string name){ this->width = width; this->height = height; + this->libPath = libPath; initWindow(name); @@ -93,7 +94,7 @@ namespace vb01{ cout << "Not complete\n"; glBindFramebuffer(GL_FRAMEBUFFER, 0); - string basePath = "../../vb01/blur."; + string basePath = libPath + "blur."; blurShader = new Shader(basePath + "vert", basePath + "frag"); glGenFramebuffers(2, pingpongBuffers); for(int i = 0; i < 2; i++){ diff --git a/root.h b/root.h index 6acd1c1..16c78f2 100755 --- a/root.h +++ b/root.h @@ -22,7 +22,7 @@ namespace vb01{ class Root{ public: void update(); - void start(int, int, std::string); + void start(int, int, std::string, std::string); inline Camera* getCamera(){return camera;} inline Node* getRootNode(){return rootNode;} inline Node* getGuiNode(){return guiNode;} @@ -41,6 +41,7 @@ namespace vb01{ static Root* getSingleton(); inline void shiftNumLights(bool increase){numLights += (increase ? 1 : -1);} inline int getNumLights(){return numLights;} + inline std::string getLibPath(){return libPath;} private: int numLights = 0; bool bloom = false, hdr = false; @@ -55,6 +56,7 @@ namespace vb01{ Shader *blurShader; Texture *pingPongTextures[2]; std::vector meshes; + std::string libPath; void framebuffer_size_callback(GLFWwindow*, int, int); Root();