DinkydauSet / ExploreFractals

A tool for testing the effect of Mandelbrot set Julia morphings
GNU General Public License v3.0
5 stars 1 forks source link

Use Nana GUI library #22

Closed DinkydauSet closed 2 years ago

DinkydauSet commented 3 years ago

I have downloaded the latest hotfix version 1.7.4: https://github.com/cnjinhao/nana/tree/0a9e599974ef8751de73691f49b9764536e0ff08

Compiling with visual studio

I use visual studio 2017. The visual studio project for version 2015 works with 2017.

At first the build fails. The solution is to uncomment line 58 in config.hpp in the nana source code:

//#define NANA_FILESYSTEM_FORCE      // "Force nana filesystem over ISO and boost?" OFF)

This setting should be /MDd only for the debug version:

image

Then building Release and Debug versions of the library works. The result are two files: nana_v141_Debug_x64.lib and nana_v141_Release_x64.lib

Using the library with visual studio

Add the path to it to the Linker Additional Dependencies:

image

Compiling with GCC and MinGW-w64

I use the CMake GUI. Later I want to use the commandline version to automate this process.

Choose the location of the source code. This is the directory of nana that contains CMakeLists.txt.

image

Also here the nana filesystem can be enabled by checking NANA_CMAKE_NANA_FILESYSTEM_FORCE.

Then CMake can be configured to generate a mingw makefile:

image

After generating, the generated makefile is in the "where to build the binaries" directory. The library can be built with the command:

mingw32-make

from that directory.

This yields a libnana.a file.

Using the library with GCC and MinGW-w64

Example:

g++ test.cpp -lnana -I. -L. -lgdi32 -lcomdlg32 -O2 -s -o nanatest.exe

To link to libnana.a, use the parameter -lnana. g++ searches for the library in the directory specified after -L which in this case is just a dot because I tested the library by copying the whole libnana.a file to the current directory.

-s saves a ton of space. Without it the exe was 38 MB. With -s it's only 1,2 MB.