-
Notifications
You must be signed in to change notification settings - Fork 1
/
TODO-CMAKE
170 lines (137 loc) · 7.42 KB
/
TODO-CMAKE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
@@@@@@@@@@@@@b ;mm /##Gilles###\
j@@@#Robin", Brad /@@@Thomas@@@@Q
@@@# \ ## @@@b |@@@b
@@@# .;;;;, ,;;;, ,;;;; ,;;;p .;;; 7@@ ]Alan
@@@# j@@@@, ]@@#/ '@@@# j@@@# ]@@^ ;@@@"
@@@Andreas@C "@@@p @@@" @@@b j@@@p @@b @@@#/
@@@#^7"7%#\ ^@@@@@#~ Benb 1@@@ {@# s@@@#
@@@# Niels @@@b @@@Q ]@# ;@@@#/
@@@# ,@@##@@m @@@b @@@p @@C #@@#C
@@@# ,/ s@@# @@@@ @@@b Volker @Tuan@
]@@@Abhinav@@\ /@@@\ \@@@Q @@@Q %@@@# /@@@@Mahesh@@#
/@@@@@@@@@@@@@@\ /@@@@@\ C++ Metadata Library /@Sridhar@@@v0.26\
Current Status
ToDo: * CMake/MinGW builds executables that do not work properly for v0.26
Known issues:
sample apps crash in XML_ParserCreate()
in c:\MinGW\msys\1.0\bin\msys-expat-1.dll
This is because MinGW links the wrong DLLs.
Team Exiv2 will not provide support for CMake/MinGW
The known issues with CMake/MinGW will be reported to Kitware.
We hope CMake/MinGW will be in a working state for Exiv2 v0.27
Here are notes concerning CMake/MinGW
1 Running a MinGW bash shell
I installed MinGW using the installer on the web site.
I installed two copies c:\MinGW and c:\MinGW64
- both copies run a 32 bit bash shell
I installed the TDM-GCC-64 compiler for use from MinGW64
I installed the Qt 5.6.0 Environement for use from MinGW
I start mingw from DOS with this batch-file (mingw32.bat)
@echo off
rem ------------------
: mingw32.bat
: invoke MinGW bash
:
setlocal
set "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig"
set "INCLUDE_PATH=/usr/local/inc"
set "LIBRARY_PATH=/usr/local/lib"
set "BINARY_PATH=/usr/local/bin"
set "PATH=c:\Qt\Qt5.6.0\5.6\mingw49_32\bin;c:\Qt\Qt5.6.0\Tools\mingw492_32\bin;\usr\local\bin;\usr\bin:c:\MinGW\bin:c:\cygwin64\bin;c:\Users\rmills\com;."
set "PS1=\! -32- ${PWD}> "
c:\MinGW\msys\1.0\bin\bash.exe %*%
: That's all Folks
rem ------------------
In ~/.bashrc
502 -32- /home/rmills> cat .bashrc
#!/bin/bash
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig"
export "INCLUDE_PATH=/usr/local/inc"
export "LIBRARY_PATH=/usr/local/lib"
export "BINARY_PATH=/usr/local/bin"
PATH=/c/Qt/Qt5.6.0/5.6/mingw49_32/bin:/c/Qt/Qt5.6.0/Tools/mingw492_32/bin:/usr/local/bin:/usr/bin:/bin:/c/cygwin64/bin:/c/Users/rmills/com:.
PS1='\! -32- ${PWD}> '
# echo hello world from .bashrc
alias dir='ls -alt'
alias del='rm -rf'
alias finder='find . -depth -iname'
alias path='(IFS=:;for i in $PATH; do echo $i; done)'
##
# finder helpers
export L="-exec ls -dalt {} ;"
export X="-exec rm -rf {} ;"
export C="-exec ce {} ;"
export I="-exec lipo -info {} ;"
export O="-exec otool -L {} ;"
export Z="-exec open {} ;"
export P="-exec p4 edit {} ;"
export R="-exec p4 revert {} ;"
export G="-exec grep"
export __=";"
export ___="{} ;"
# That's all Folks!
##
503 -32- /home/rmills>
MinGW64 has very similar code. Putting the TDM compiler on the path is the major difference.
The file ~/.bashrc for MinGW64 is in c:\MinGW64\msys\1.0\home\<username>\.bashrc
2 Building and installing CMake
$ ./bookstrap --prefix=/usr/local
$ make
$ make install
Gotchas:
1) Do not use a Windows binary install version of CMake
This generates commands which assume you are in the DOS shell.
Build and Use CMake in a "Unix" Way from a MinGW/bash shell.
2) Even although gcc is on the path, we must tell cmake not to use /c/MinGW/bin/gcc)
3) It's using the wrong headers. Needs /c/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$dist -DEXIV2_ENABLE_NLS=OFF \
-DCMAKE_C_COMPILER=$(which gcc) -DCMAKE_CXX_COMPILER=$(which g++) \
"-DCMAKE_CXX_FLAGS=-I/c/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include"
..
4) even so, it errors instantly on:
In file included from c:/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include/stddef.h:7:0,
from c:/Qt/Qt5.6.0/Tools/mingw492_32/lib/gcc/i686-w64-mingw32/4.9.2/include/stddef.h:1,
from C:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/xmpsdk/include/XMP_Const.h:14,
from C:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/xmpsdk/src/XMPCore_Impl.hpp:13,
from C:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/xmpsdk/src/ExpatAdapter.cpp:10:
c:/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include/crtdefs.h:26:9: error: 'size_t' does not name a type
typedef size_t rsize_t;
5) Building cmake itself required setting CC CXX CXXFLAGS and LDFLAGS
AND editing a system file in Qt with an erroneous #pragma error NTDDI_VERSION and _WIN32_WINNT
In file included from c:/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include/windows.h:10:0,
from c:/Users/rmills/gnu/cmake/cmake-3.6.2/Utilities/cmlibarchive/libarchive/archive_windows.h:74,
from c:/Users/rmills/gnu/cmake/cmake-3.6.2/Utilities/cmlibarchive/libarchive/archive_platform.h:60,
from c:/Users/rmills/gnu/cmake/cmake-3.6.2/Utilities/cmlibarchive/libarchive/xxhash.c:35:
c:/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include/sdkddkver.h:186:2: error: #error NTDDI_VERSION and _WIN32_WINNT mismatch!
My work-around was to comment off the #error statement!
3 Building Exiv2 with CMake
$ cd ~/gnu/exiv2/trunk
$ rm -rf build ; mkdir build ; cd build
$ cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=$(which gcc) -DCMAKE_CXX_COMPILER=$(which g++) -DEXIV2_ENABLE_NLS=OFF
.... cmake will rattle and roll ....
CMake generates the wrong include response files.
I put the correct include code in contrib/cmake/mingw/includes.rsp
Propagate the correct includes to the generated files.
$ find . -name "includes_*.rsp" -exec cp ../contrib/cmake/mingw/includes.rsp {} \;
$ make
On my system, these the include response file have the code:
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/src
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/include
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/include/exiv2
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/build
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/xmpsdk/include
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/xmpsdk/src
-IC:/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include
-IC:/Qt/Qt5.6.0/Tools/mingw492_32/lib/gcc/i686-w64-mingw32/4.9.2/include
-IC:/MinGW/msys/1.0/local/include
Gotcha
------
Even have done all of this, some of the sample applications are not correctly linked.
Samples affected are path-test, geotag, metacopy, exiv2json (possibly others).
The exiv2dll (libexiv2-14.dll) is linked to /bin/msys-expat.dll
and foo.exe is linked to /usr/local/bin/libexpat-1.dll
I have been able to get this fixed. I'll deal with it in v0.27.
two copies of the expat dlls. /usr/local/bin/libexpat-1.dll and /bin/msys-expat.dll
Robin Mills
2016-10-03