Skip to content

How to build ArcV

Romain Milbert edited this page Aug 25, 2017 · 1 revision

ArcV is built with the help of CMake. To generate the project, you must download and install CMake (scroll down to get the latest stable release). If you are on Linux, you had better install it from your package manager.

To run the actual test program you will need an image to place either directly into the solution folder if you're building with Visual Studio (root folder if in-source, build/ if out-of-source), or next to the executable if you're directly executing it. Any PNG will do, but if you ever want a Lena sample, here it is.

Building on Windows

If you're not used to Windows' command line I recommend to use CMake GUI, which is way easier to manipulate.

Using command line

First of all, to perform a command line build you will need to add the location of CMake in your path.

Go into the ArcV root folder with the command cd path\to\ArcV. If it is located on a different drive than the prompt is telling you, you will have to enter the letter of the other drive.

For example, if your terminal's prompt says you're located at C:\Users\JohnDoe and ArcV is located on D:\Librairies\ArcV, you'll have to enter two commands: cd D:\Librairies\ArcV and D:. The order matters not, but both are mandatory for this to work.

C:\Users\JohnDoe>cd D:\Librairies\ArcV

C:\Users\JohnDoe>D:

D:\Librairies\ArcV>

Now you will have two choices:

  • In-source (also called in-tree) build, this means putting build files directly into the root folder.
  • Out-of-source (also called out-of-tree) build, this means creating a dedicated folder so that your root remains clean (to start over you'll simply have to delete the newly created folder).

Depending on your choice, here are the commands needed:

  • In-source: once you're located at ArcV's root, call CMake by entering the command cmake . [-G"<Generator> [arch]"]. If you don't understand this syntax, head to the explanation in the next paragraph below.
  • Out-of-source: create a folder (by convention named build but give it any name you want) at ArcV's root, then go inside using cd build. Once it is done, simply call CMake by entering the command cmake .. [-G"<Generator> [arch]"] (notice the double dot here).

If the CMake commands seem odd to you, here is a little explanation:

  • The parameters in < > are the variable ones. You have to replace whatever is written between the angle brackets by some specific text. The different possibilities are shown below.
  • The parameters in [ ] are the optional ones. This doesn't mean you should always leave them blank though, they're needed in case you want to perform a more precise operation.
  • Generator is the type of build files you want to generate. For instance, if you want to produce a Visual Studio 2015 solution, <Generator> should be equal to Visual Studio 14 (or 15 for VS 2017). You can also use MinGW Makefiles as the generator (you'll need to have MinGW in your path to build), then call make to build the project entirely in command line.
  • arch is the architecture you want to build to (exclusive to Visual Studio, don't try to specify it for MinGW Makefiles since it only allows 32 bits). Leave it alone to build ArcV in 32 bits, put Win64 if you want 64 bits.

Let's have an example: to build ArcV with Visual Studio 2015 in 64 bits, you'll have to enter -G"Visual Studio 14 Win64". To build it with VS 2017 in 32 bits, -G"Visual Studio 15".

If you chose to produce a Visual Studio solution, dive into your build folder and open ArcV.sln. You can now tell VS to build ArcV in either Debug or Release and launch it, given that you've put a PNG in the right place (next to ArcV.sln).

Using CMake GUI

  • Where is the source code: <ArcV root folder>
  • Where to build the binaries: <ArcV root folder>\build to perform an out-of-source build (or whatever name you want instead of build), or simply the root folder if you want an in-source.
  • Press Configure. If you've chosen to build into a folder, press Yes to create it when asked. Right after this you'll be asked to chose your generator, by default the right one according to your installed Visual Studio version. Press Finish to start the project configuration.
  • Once done, remove whatever is written into the CMAKE_INSTALL_PREFIX field, you won't need it anyway since you won't be installing anything. CMake GUI config
  • Click Configure again to check that what you chose is correct (it will be if you only removed the content of the field CMAKE_INSTALL_PREFIX, but it's still a good practice). If there's no error, press Generate.

Your Visual Studio solution is now available into the build/ folder! Just place your PNG beside your solution and build & launch it.

Building on Linux

Writing in progress.