OSDN Git Service

[DOC] Update revision and README.
[csp-qt/common_source_project-fm7.git] / doc / how2build_qt.txt
1 *** This article still not correct from auto-translated by GOOGLE-TRANSLATE.
2 *** If you can tranlate Japanese to any languages, please
3 *** Translate this, publish and pull request to my GITHUB.
4
5 Common Source Code Project for Qt: How to Build
6                                         Feb 25, 2016 K.Ohta
7                            <Whatisthis.sowhat_at_gmail.com>
8
9 1.First of all
10 Common Source Code Project the (CSP) in terms of porting to Qt, the build.
11 There is a voice that does not know well when using the method - especially MinGW to or
12 so it was, we wrote a little.
13
14 2. What you need
15 • The Windows of the person, MinGW is required ... is, open-source version of Qt
16   The installer [1] (in the case of Qt5.5.1 GCC4.9.2, you can use later versions) 
17   MinGW comes with, but, half-hearted.
18 · GCC (may not be good Qt and compatibility that it LLVM CLANG)
19 · Qt5.1 or more, of course also the development files such as header.
20 · OpenGL 2.1 or more to build and to work. With the software renderer in
21   Windows for Qt You've had.
22 · CMake [2] 2.8 or more
23 · LibSDL2 [3]
24 ・if possible, it can be slightly faster and use the CCACHE [4]
25  · Git [5] is, child download the source code from the repository [6] you bet you can.
26 · emufm7 part of the code of the source code in the gawk to generate some C++ source code from text file. 
27   However, the .cpp file after generation to the source tree from that text, it contains.
28
29 [1] Windows for in http://www.qt.io/download-open-source/ of (32 / 64bit)
30     Please try using the installer
31 [2] http://cmake.org/
32 [3] http://libsdl.org/
33 [4] https://ccache.samba.org/
34 [5] https://git-scm.com/
35 [6] https://github.com/Artanejp/common_source_project-fm7
36     https://www.pikacode.com/Artanejp/common_source_project-fm7/
37     
38 These things, GNU / Linux if such and MinGW, package management software
39 In will be put in the majority.
40
41 3. How to Build
42   3-1. Basic method
43     The source tree allowed to expand to ${SRCDIR},
44       $ cd ${SRCDIR}/source/build-cmake/{VM name}/
45       $ mkdir -p build
46       $ cd build
47       $ cmake .. ※ [7]
48       $ make
49     If it went well,
50       $ sudo make install
51 [7] In fact, it is convenient setting is better to use the ccmake of CursesGUI version of CMake.
52
53   3-2.MinGW
54      It is basically the same, and use the windeployqt.exe of Qt, the necessary Qt La
55      For us to copy the library.
56      However, DLL of libstdc associated with libSDL2 and OpenGL relationship is to manually copy
57      That you will need.
58      Since there is no CMake is the official MinGW, please download from [8].
59      
60      Install the a.MinGW.
61      mingw32-gcc and mingw32-g ++ and mingw32-binutils,
62      mingw-developer-toolkit and mingw32-pthreds-w32
63      Please install the sure.
64      
65      To register the shortcut of b.MSYS Bash, for example, on your desktop and menu
66      Let's place. If the default installation location,
67      Is C:\MinGW\msys\1.0\msys.bat.
68      
69      c. Install the Qt to C:\Qt.
70      Start the installer you downloaded from [1], the mingw toolchain
71      Install in, including form.
72      
73      d. Install the CMake.
74      Whether to include the CMake the path? Come ask the installer and
75      So please check.
76      
77      e. If Necessary, install the Git.
78      
79      f. To edit the C:.\MinGW\msys\1.0\home\{username}\.profile.
80        At this time, since performed in Notepad problem comes out, use the vim.
81        From the MSYS BASH;
82        $ vim ~/.profile
83        Please to add the following line.
84            export PATH =/c/MinGw/bin:$PATH:/c/Qt/Qt5.5.1/5.5/mingw492_32/bin
85        When you are finished, in the [ESC] → ZZ command, it writes.
86        
87      g.Install SDL2. (Reference: [9])
88      Download SDL2 have been "Windows Development MinGW" tarball of
89        The expand and install.
90        $ tar xf SDL2-devel-2.0.4-mingw.tar.gz
91        $ cd SDL2-2.0.4
92        $ mingw32-make install-package arch=i686-w64-mingw32 prefix=/c/mingw
93        
94      h. When you come up to this point, to start the MSYS BASH again.
95        And, of release page in the source and github that have been taken in the git clone
96        Expand the source code. Here, describing the full path to the ${SRCDIR} to do.
97        
98      i. Build.
99        $ cd ${SRCDIR}
100        $ cd source/build-cmake/${VM name}
101        $ mkdir build-win32
102        $ cd build-win32
103        $ cmake .. -G "MinGW Makefiles" ※[10]
104        $ mingw32-make
105
106      ※ Notes: Windwos on (the native) in MinGW, rather than make, mingw32-make
107      Use and the like. I have a Windows side is make, yet this is the unix format
108      Since it is a villainy specification that not me seriously interpret the Makefile ...
109      
110      j. cormorant or Ku be or prayer a call that came in buildings de
111      
112      k. When you build, the directory to the emu${VM name}.exe for moving
113      Copy.
114      
115      l. on which has moved to copy the previous directory I,
116        $ windeployqt.exe --release emu${VM name}.exe
117        If you, copy the necessary Qt libraries in release mode Shiteku
118        Are you, but the copy manually, such as libSDL2 and libpthread and libgcc_s
119        If that does not, can not be started from the Windows Explorer (;´Д`)
120        In addition, it specifies the Debug and Relwithdebinfo to build the type of CMake
121        Time,
122        $ windeployqt.exe --debug emu${VM name}.exe
123        Let's say.
124        Then, the following file C:\Qt\Qt5.5.1\mingw492_32\bin (such as)
125        Or, or from C:\MinGW\bin, and copy it to the directory where you placed the exe.
126        icudt54.dll
127        icuin54.dll
128        icuuc54.dll
129        libgcc_s_dw2-1.dll
130        libstdc ++ - 6.dll
131        libwinpthread-1.dll
132        On top of that, SDL2.dll (C: should located in the \MinGW\bin) is also, in this directory
133        Copy.
134      
135 [8] http://cmake.org/download/
136 [9] https://gist.github.com/Hamayama/155b5557db31334ce492
137 [10] In fact, once after you move the CMake, a fine setting to start the cmake-gui better to is better.
138
139    3-3. Cross build (do the build for Windows in such as GNU / Linux)
140    Here, in the GNU / Linux host, how to cross build the CSP for Windows
141    You have a brief description.
142    Become an aid for the ARM build and other OS Builds for Android, etc. for
143    Award.
144
145       a. installation of cross compiler
146         In most cases, because there is a cross-GCC Toolchain for MinGW, it install.
147
148     b. Installation of Wine
149         Because such as moc there is a need to use for Windows, install the Wine want it.
150         On top of that, so that you can start a file of exe extension via Wine
151         there to support scripts such as binfmt-support, set in the update-binfmts. [11]
152            $ sudo update-binfmts --install Win32Exec /usr/bin/wine --magic "MZ"
153         I think that it was good at (I'm sorry in faint memory)
154
155 [11] http://d.hatena.ne.jp/kakurasan/20110909/p1 such as the reference.
156
157      c.Qt for Windows
158        Installation of From the URL of the [1], download the installer for Windows.
159        And,
160          $ sudo wine ./qt-opensource-foo.exe will do.
161        Then because Qt installer screen comes out, please specify to the installation.
162          Z:\usr\local\i586-mingw-msvc
163        At this time,
164          $sudo chmod ugo+x /usr/local/i586-mingw-msvc/5.5/mingw492_32/bin/*.exe
165        As such, let's be able to start the tool for Windows Qt directly attached.
166
167       d.libSDL2
168         libSDL2 also, and you should install the ones for Windows.
169         From [3], download for Windows SDL2 (for Development),
170         /usr/local/i586-mingw-msvc/
171         Let's expand to around.
172
173       e. Cross build
174         Although we use the ToolChain function of CMake, so many things setting is confusing,
175         Already Yes available are those described.
176            $ {SRCDIR}/source/build-cmake/cmake/toolchain_mingw_cross_linux.cmake
177         Messing with description of this file,
178            $ cd ${SRCDIR}/source/build-cmake/{VM name}/
179            $ mkdir -p build
180            $ cd build
181            $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchain_mingw_cross_linux.cmake
182            $ make
183         In it you should be okay.
184     
185      3-3. Trying to easier way
186         In the description up to this point, we have to build the manual in a virtual machine basis.
187         However, although the once could under preparation, is every time awkward every time.
188         Therefore, a batch file (Bash script) are available.
189          · ${SRCDIR}/source/build-cmake/config_build.sh
190                  : normal build
191          · ${SRCDIR}/source/build-cmake/config_build_cross_win32.sh
192                  : To build a file for MinGW32 (Windows) on GNU / Linux script
193          · ${SRCDIR}/source/build-cmake/config_build_mingw.sh
194                  : Script to build a file for MinGW with MinGW on Windows
195                  
196           config_build.sh will continue to write the settings to a file called buildvars.dat.
197           config_build_mingw.sh is, the settings to a file called buildvars_mingw.dat
198           I will continue to write.
199
200         How to use it;
201           $ ./${Script name} ${VM name 1} ${VM name 2} ... ${VM name n}
202
203          This script works in full automatic :
204                Generate the Makefiles from CMake → make → install → make clean
205          For make results, ${VM name}/build/make.log (MinGW for cross build
206          has been recorded in the {VM name}/build-win32/build.log).
207
208        For Windows-friendly build, ${SRCDIR}/source/build-cmake/bin-win32/
209        copy the resulting binary in, and clean the build working directory.
210
211        For batch build, and use the Midnight Commander (mc) to easier to works.
212        For more information, the https://www.midnight-commander.org/.
213        Windows of unofficial build, https: to //sourceforge.net/projects/mcwin32/
214        Equipped therefore, let's install using the installer.