Trainings with new tools, techiques, features etc.
- Building and Running
- Vcpkg
- Visual Studio
- Linux
- Cmake
- The Euler project tasks.
- OpenCV
- OpenGL
- C++/STL/Boost
- CMake
- Unit Testing. TDD. Boost.Test. Google Test.
- Python.
and some future plans:
- CUDA/TBB(Intel Threading Building Blocks), OpenMPI, multithreading programming.
- GoLang.
- OpenAI.
futher possible reading and research:
- List Of OpenSource C++ Libraries - especially Physics and Simulations part.
- Python Useful Modules
- GoLang Projects
- OpenAI.
- TensorFlow.
And the last but not least:
- Supercomputers and highly parallel computations.
Project is mostly developed on Windows machine, but still it is quite interesting to try different build techinques on different machines. So called crossplatform application. At first project was developed in Visual Studio. To add support from Linux I have added CMake support. But CMake require packages and to get those packages on Windows or/and Linux is done in very different way. Linux gives very easy tool apt-get(or app - package manager) which resolves any dependencies very quickly. Windows is less straightforward to Linux. You can customly build libraries from source, or download chocolately, but recently there is great tool - vcpkg! Next section is about it.
Some key notes:
- Only cmake-gui works well with the package manager.
- You have manually add new entry value VCPKG_DEFAULT_TRIPLET(or VCPKG_TARGET_TRIPLET) to specify build target(x86-windows, x64-windows-static etc).
- You have to specify Toolchain File.
- There is some problems with specifing VCPKG_DEFAULT_TRIPLET
some usefull links: How to Use vcpkg With CMake On Windows, official repo
OpenCV (Open source computer vision) is a library of programming functions mainly aimed at real-time computer vision.
So at first You need OpenCV binaries. The easiest way to get them is to download last release source archive from official website and build it in Debug/Release versions(x64 dlls). There are probably not all binaries from prebuild on official webiste.
After build, you have to setup environmental variable OPENCV_DIR, to folder where you installed OpenCV.
PS: Visual Studio provide NuGet package manager, unfortunately last version of OpenCV there is 2.4 or wrappers for C#.
Configuring Visual Studio Project.
- Properties of project->VC++ Directories->Include Directories - Append path to include dirrectory of OpenCV. $(OPENCV_DIR)/include.
- Properties of project->VC++ Directories->Library Directories - Append path to binnaries dirrectory of OpenCV. $(OPENCV_DIR)/x64/vc15/lib
- Properties of project->Linker->Input - Append list of all libs of OpenCV(from lib folder).
To workaroud setting path to location of dlls to global path, we use next macros:
Properties of project->Debugging->Environment set to it next macros: Path=$(OPENCV_DIR)\x64\vc15\bin;%Path%;
Thats all, now You can run programs!
Just type:
sudo apt install libopencv-dev
And thats, all. Link to my OneNote notebook with more details.
vcpkg install opencv
Install nvidia CUDA toolkit
vcpkg install opencv[cuda]
Crossplatform graphic library. For each platform are used FreeGLUT, GLEW or GLFW and GLAD to use OpenGL. learnopengl.com suggests to use GLFW and GLAD pair, and I am suggesting it to, cos of Windows was hard to compile FreeGLUT.
Handles functionality of creating window containing OpenGL context on wide range of platforms.
It query and loads OpenGL extensions.
The same functionality provides
Handles side with windows, and
Loader of OpenGL.
Lets describe the easiest way using GLFW and GLAD.
Simply download Windows x64 binnaries from official website. Extract them and specify environmental variable GLFW_DIR.
Download source files(only one header and one source) from official site. gl -> Select latest version, Language -> C\C++, Specification -> OpenGL, Profile -> Core, Options -> Generate a Loader. And press Generate. Copy downloaded files to your project.
sudo apt install libglfw3-dev
That's all!
Almost same setup as for windows. Download source files(only one header and one source) from official site. gl -> Select latest version, Language -> C\C++, Specification -> OpenGL, Profile -> Core, Options -> Generate a Loader. And press Generate. Extract archive and setup envirnonmental variable GLAD_DIR to target folder(for example /usr/local/glad).
vcpkg install glfw3
vcpkg install glad
- Setup Box2D using instruction.
- Separate build files by include, lib and bin(optionaly) directories.
- Setup environmental variable BOX2D_DIR.
- Done.
vcpkg install box2d:x64-windows
also vcpkg manager can be used
sudo apt install libbox2d-dev