Day036 — My first Clion project
https://github.com/jacky-ttt/CodingEveryday
I have a c++ project that originally runs on Windows using Visual Studio and it is needed to convert to be able to run on Mac. I am a newbie when it comes to c++ and its project setup on Mac. I found that library dependency issue is the first thing I need to manage before I blindly include all the source code from the original project which will overwhelm me with error. The first library I want to include is GLM which plays a main role in my project.
GLM stands for OpenGL Mathematics, which simply a mathematics library.
OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics software based on the OpenGL Shading Language (GLSL) specifications.
GLM provides classes and functions designed and implemented with the same naming conventions and functionalities than GLSL so that anyone who knows GLSL, can use GLM as well in C++
On its homepage, it does not provide any instruction or example on how to include it to project. It expects people who use its library would know everything beforehand. I absolutely hate that!!! A kindly reference url to other website that has get-started guide would be much appreciated.
So I search online.
Then I know that I need to search for “FindGLM.cmake”.
Above FindGLM.cmake should work because they include “/usr/local/include” to be the place to search for the library, where it is the default place of libraries installed by Homebrew.
find_path(
GLM_INCLUDE_DIR
NAMES glm/glm.hpp
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
${GLM_ROOT_DIR}/include
DOC "The directory where glm/glm.hpp resides")
After including the “FindGLM.cmake” in the project, glm is downloaded through Homebrew.
Using the below command to download glm:
brew install glm
GLM will be installed at “/usr/local/Cellar/glm/{version}” and a “glm” folder will be created at “/usr/local/include”. You can go to “/usr/local/include” directly to check by pressing “shift + command + g” in Finder.
vtk is another library I need to include in my project and similar procedure is taken to perform that.
brew tap homebrew/science
brew install vtk
How to check what version of program will be installed with that formula:
brew info formula_name
Random stuff I found along the journey:
include_directories(.)
difference between “” and <>