okmechak / SandBox

Trainings with new tools, techiques, features and programming Kata(s)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SandBox

Trainings with new tools, techiques, features etc.

Contetns

  • 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:

And the last but not least:

  • Supercomputers and highly parallel computations.

Building and Running

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.

VCPKG

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

OpenCV (Open source computer vision) is a library of programming functions mainly aimed at real-time computer vision.

Project set-up on Windows

1.First Step

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.

2.Second Step

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#.

3.Third Step

Configuring Visual Studio Project.

  1. Properties of project->VC++ Directories->Include Directories - Append path to include dirrectory of OpenCV. $(OPENCV_DIR)/include.
  2. Properties of project->VC++ Directories->Library Directories - Append path to binnaries dirrectory of OpenCV. $(OPENCV_DIR)/x64/vc15/lib
  3. 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!

Project set-up on Linux

Just type:

sudo apt install libopencv-dev

And thats, all. Link to my OneNote notebook with more details.

VCPKG and CMake

vcpkg install opencv

Cuda support

Install nvidia CUDA toolkit

vcpkg install opencv[cuda]


OpenGL

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.

Lets descibed shortly each of this libraries

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.

OpenGL set-up on Windows

Lets describe the easiest way using GLFW and GLAD.

GLFW

Simply download Windows x64 binnaries from official website. Extract them and specify environmental variable GLFW_DIR.

GLAD

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.

OpenGL set-up on Linux

GLFW Linux

sudo apt install libglfw3-dev

That's all!

GLAD Linux

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).

OpenGL: VCPKG and CMake

vcpkg install glfw3 vcpkg install glad


Box2D

Windowds(Visual Studio)

  • Setup Box2D using instruction.
  • Separate build files by include, lib and bin(optionaly) directories.
  • Setup environmental variable BOX2D_DIR.
  • Done.

vcpkg

vcpkg install box2d:x64-windows

Linux(Cmake)

also vcpkg manager can be used

sudo apt install libbox2d-dev

About

Trainings with new tools, techiques, features and programming Kata(s)


Languages

Language:Mathematica 93.5%Language:Jupyter Notebook 2.7%Language:C++ 2.0%Language:HTML 0.7%Language:C 0.5%Language:Python 0.2%Language:Modelica 0.1%Language:MATLAB 0.1%Language:CMake 0.1%Language:GLSL 0.0%Language:JavaScript 0.0%Language:CSS 0.0%Language:Java 0.0%Language:Assembly 0.0%Language:Go 0.0%