manually merge PRs(#643,#644) into develop-1.8

This commit is contained in:
cnjinhao 2022-02-02 22:15:54 +08:00
parent 6de7e02d4c
commit 8327fdcd12
3 changed files with 252 additions and 14 deletions

231
Installation-guide.txt Normal file
View File

@ -0,0 +1,231 @@
Version 0.1, incomplete
Welcome, this is the up-to-date Installation Guide for nana.
You DO NOT need a code editor for installation
READ THE FOLLOWING PART BEFORE YOU DO ANYTHING
You have to be aware that there is no guarantee that your system will be able to install nana successfully and using nana successfully.
And, due to the variety of system and develop enviroment, you might not be able to using nana successfully even the installation is successful.
-----------------------------------
/Space/
-----------------------------------
This is the Installation Guide for:
Windows 7, 8, 10 and 11 64-bit (Recommand)
MSYS2 using GCC 11.2
MingW64 traditional MSVCRT toolchain
MingW64 using GCC 11.2
traditional toolchain
Linux (note: the installation process has been tested using Debian 11 with KDE on VirtualBox)
GCC using GCC 11.2
Tools: you need those for all platform
cmake (with gui)
ninja
-----------------------------------
/Space/
------------------------------------------------
Menu:
1, Building and Installing on Windows using MSYS2
a, using MingW64 MSVCRT toolchain
b, build install the library
2, Building and Installing on Windows using MingW64
a, choose your MingW64 distro
b, build and install the library
3, Building and Installing on Linux using GCC
4, FAQ
-------------------------------------------------
/Space/
-------------------------------------------------
1, Building and Installing on Windows using MSYS2
!! DO NOT INCLUDE SPACE FOR YOUR PATH OF EVERYTHING
You will use
MSYS2 / MingW64 toolchain
for building and installation.
First, you need to install MSYS2 on your Windows system.
(note: you will need Windows 7 or later for MSYS2, and you always want to use the 64-bit version)
Check out https://www.msys2.org/ to install MSYS2, follow the instruction on MSYS2 website for how to install the toolchains.
a, using MingW64 traditional MSVCRT toolchain:
After install MSYS2 and mingw-w64-x86_64-toolchain, oepn the "MSYS2 MinGW x64" console from Start Menu.
!! You want to keep the default path of installation, because VS code and some text editors may not recongnize the compiler automatically
You will finish rest of the progress in this console
In the console, type:
"g++ --version"
to ensure GCC is install properly. If you see the version info, you can proceed. Otherwise, you need to install them properly.
In the console, type:
"pacman -S mingw-w64-x86_64-cmake"
Follow the instruction, after the installation is complete.Then, to use gui, type:
"pacman -S mingw-w64-x86_64-qt6-base"
Follow the instruction, after the installation is complete. Install ninja, type:
"pacman -S mingw-w64-x86_64-ninja"
Follow the instruction, after the installtion is complete. You are ready for build.
/Space/
Navigate to your nana source folder, which is this folder, type:
"cd /path/to/the/folder"
!! You MUST type the path in Unix style, using '/' instead of '\'
Then type:
"cmake-gui"
In cmake-gui, you need to select the source folde of nana and the build folder.
Now, click "configure" and select "Ninja" for the generator, then click "finish".
Change CMAKE_INSTALL_PREFIX change to "C:/msys64/mingw64", you may have different folder for MSYS2, just make sure that you select the mingw64 subfolder in it.
Make sure the box of NANA_CMAKE_INSTALL is checked.
Click "generate".
Close cmake-gui
c, build and install the library
Go back to the console, navigate to the build folder, type:
"cd build"
Build the project by typing:
"ninja"
Wait the build process to finish
(on my 6 core 12 thread, Windows 10 64-bit, it takes about 26s)
Then install by typing:
"ninja install"
The installation is finished now.
include header
"#include <nana/gui.hpp>"
...
and libraries
"libnana.a"
"libgdi32.a"
"libcomdlg32.a"
"libz.a"
-------------------------------------------------
/Space/
-------------------------------------------------
2, Building and Installing on Windows using MingW64
!!This is not recommand, because using MingW enviroment on Windows system can cause lots of confusion
a, You need to choose a MingW64 distro in order to proceed, the example shows using WinLib
Download from here and follow the instruction on website to install:
https://winlibs.com/#download-release
b, To configure the program, you need to install cmake from https://cmake.org/. Remember to add cmake to path during installation.
(note: because the WinLib include ninja already, thus, you do not need to install ninja again)
After installation, open cmd or powershell console, type:
"g++ --version"
to check if MingW64 is install properly, if version info do not pop out, install them properly.
Ten configure cmake type:
"cmake-gui"
In cmake-gui, select the source folder, which is nana folder.
Then select the build folder.
Click configure, in configure menu, select Ninja.
Then select the CMAKE_INSTALL_PREFIX for nana, you must select the mingw64 installation folder, it usually be "mingw64"
Make sure the box of NANA_CMAKE_INSTALL is checked.
Click "generate".
Close cmake-gui
Go back to the console, navigate to the build folder, type:
"cd \path\to\nana folder\build"
Build the project by typing:
"ninja"
Wait the build process to finish
Then install by typing:
"ninja install"
The installation is finished now.
include header
"#include <nana/gui.hpp>"
...
and libraries
"libnana.a"
"libgdi32.a"
"libcomdlg32.a"
"libz.a"
-------------------------------------------------
/Space/
-------------------------------------------------
3, Building and Installing on Linux using GCC
Building and Installing on Linux is so easy compare to Windows system, but most people are using Windows system today.
To being, you also need cmake and ninja. Update all package on your system before install.
!! Some distro do not include build-essential group package, you need to make sure they are install.
Check if compiler is installed:
"g++ --version"
if you see version info pop out, you are ready to go. Otherwise, you need to install build-essential group package. Check out docs for your distro for how to install.
On Debian base system, install cmake-gui by typing:
"sudo apt install cmake-gui"
then install ninja, type:
"sudo apt install ninja-build"
You are ready to go
navigate to nana source folder, type:
"cd /path/to/nana/folder"
then open cmake-gui, type:
"cmake-gui"
select the source folder for nana, and select the build folder.
Click configure, select Ninja.
If you get error about x11 libraries, install x11lib-dev package.
Then, select installation in CMAKE_INSTALL_PREFIX and make sure the NANA_CMAKE_INSTALL box is checked.
Click generate, sometimes you will still get error, but this time i can't help. Because there are so many distro and TBH, it is annoying
If the error message never stop, then, please just try to download any possible develop package for gui and good luck
Then, navigate to build folder, type:
"cd build"
Start building, type:
"ninja"
Install by typing;
"ninja install"
!! Sometimes you need permission, grant it by adding "sudo"
The installation is finished now.
include header
"#include <nana/gui.hpp>"
...
and libraries
"libnana.a"
"libgdi32.a"
"libcomdlg32.a"
"libz.a"
-------------------------------------------------
/Space/
-------------------------------------------------
4, FAQ
Old instruction:
Please refer to the Library Installation Documentation for the detailed installation instructions.
https://github.com/qPCR4vir/nana-docs/wiki/Installation
NOTE: The method of library installation for VC2003/2005/2008/2010/2012 is only for the version older than 0.8. Since version 0.8, the library only works in VC2013 and later. If you have not VC2013 installed, please choose the latest Codeblocks instead.
Using Clang
https://github.com/cnjinhao/nana/wiki/Compiling-Nana-with-Clang-8.0
请参考库安装文档获取详细的安装步骤。
https://github.com/qPCR4vir/nana-docs/wiki/Installation
注意: 针对VC2003/2005/2008/2010/2012的安装方法只适用于低于0.8的版本。从0.8版起该库对Visual C++的最低版本要求是2013。如果您没有安装VC2013可以使用最新版的CodeBlocks代替。
使用 Clang
https://github.com/cnjinhao/nana/wiki/Compiling-Nana-with-Clang-8.0
a, what's the different beetween MSYS2 and MingW64
TBH, no different in terms of performance and comand usage, but MSYS2 is more convenient than MingW64
b, why should I always use 64-bit MSYS2 or MingW64 not MingW32
64-bit software brings you better performance and the latest Windows11 only suppot 64-bit now
c, what should I do if the program I compile report "missing ****.dll" when I try to run it?
You need some .dll file in your folder, but the best way is to add "-static" in your compule command

View File

@ -1,14 +0,0 @@
Please refer to the Library Installation Documentation for the detailed installation instructions.
https://github.com/qPCR4vir/nana-docs/wiki/Installation
NOTE: The method of library installation for VC2003/2005/2008/2010/2012 is only for the version older than 0.8. Since version 0.8, the library only works in VC2013 and later. If you have not VC2013 installed, please choose the latest Codeblocks instead.
Using Clang
https://github.com/cnjinhao/nana/wiki/Compiling-Nana-with-Clang-8.0
请参考库安装文档获取详细的安装步骤。
https://github.com/qPCR4vir/nana-docs/wiki/Installation
注意: 针对VC2003/2005/2008/2010/2012的安装方法只适用于低于0.8的版本。从0.8版起该库对Visual C++的最低版本要求是2013。如果您没有安装VC2013可以使用最新版的CodeBlocks代替。
使用 Clang
https://github.com/cnjinhao/nana/wiki/Compiling-Nana-with-Clang-8.0

View File

@ -411,6 +411,27 @@ namespace nana
pixels -= 2;
}
}
break;
case direction::east:
{
for (int i = 0; i < 4; ++i)
{
graph.set_pixel(x, y);
graph.set_pixel(x + 1, y);
++x;
++y;
}
--x;
for (int i = 0; i < 3; ++i)
{
graph.set_pixel(x, y);
graph.set_pixel(x - 1, y);
--x;
++y;
}
}
break;
default:break;
}
return true;