transactd 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/BUILD_UNIX-JA +174 -0
- data/BUILD_WIN-JA +256 -0
- data/CMakeLists.txt +96 -0
- data/COPYING +339 -0
- data/README +406 -0
- data/README-JA +424 -0
- data/bin/common/tdclc_32_1_0.dll +0 -0
- data/bin/common/tdclc_64_1_0.dll +0 -0
- data/build/common/check_for_link_iconv.cmake +73 -0
- data/build/common/copyifgreater.cmd +30 -0
- data/build/common/copyifgreater.js +290 -0
- data/build/common/get_boost_libs.cmake +106 -0
- data/build/common/get_ruby_path.cmake +115 -0
- data/build/common/options.cmake +127 -0
- data/build/common/smart_install.cmake +263 -0
- data/build/common/system.cmake +122 -0
- data/build/common/transactd.rc.in +52 -0
- data/build/common/transactd_cl_common.cmake +101 -0
- data/build/common/transactd_cl_output.cmake +93 -0
- data/build/common/transactd_common.cmake +237 -0
- data/build/common/transactd_required.cmake +28 -0
- data/build/swig/ruby/generate.cmake.in +35 -0
- data/build/swig/ruby/generate.cmd.in +19 -0
- data/build/swig/ruby/ruby.swg +101 -0
- data/build/swig/tdcl.i +188 -0
- data/build/tdclc/BUILDNUMBER.txt +1 -0
- data/build/tdclc/CMakeLists.txt +170 -0
- data/build/tdclc/tdclc_32.cbproj +181 -0
- data/build/tdclc/tdclc_64.cbproj +205 -0
- data/build/tdclcpp/BUILDNUMBER.txt +1 -0
- data/build/tdclcpp/CMakeLists.txt +142 -0
- data/build/tdclcpp/tdclcpp_bcb_32.cbproj +239 -0
- data/build/tdclcpp/tdclcpp_bcb_64.cbproj +304 -0
- data/build/tdclrb/BUILDNUMBER.txt +1 -0
- data/build/tdclrb/CMakeLists.txt +258 -0
- data/build/tdclrb/GEM_VERSION +3 -0
- data/build/tdclrb/bldgem/extconf.rb +123 -0
- data/build/tdclrb/gem/INSTALLLOG.win32 +9 -0
- data/build/tdclrb/gem/Makefile.win32-VS +65 -0
- data/build/tdclrb/gem/Makefile.win32-prebuilt +48 -0
- data/build/tdclrb/gem/detect.rb +31 -0
- data/build/tdclrb/gem/helper.rb +113 -0
- data/build/tdclrb/gem/transactd.rb +22 -0
- data/build/tdclrb/gem_output.cmake +44 -0
- data/source/bzs/db/IBlobBuffer.h +51 -0
- data/source/bzs/db/blobBuffer.h +177 -0
- data/source/bzs/db/blobStructs.h +85 -0
- data/source/bzs/db/engine/mysql/IReadRecords.h +52 -0
- data/source/bzs/db/engine/mysql/bookmark.h +195 -0
- data/source/bzs/db/engine/mysql/database.cpp +1882 -0
- data/source/bzs/db/engine/mysql/database.h +465 -0
- data/source/bzs/db/engine/mysql/dbManager.cpp +303 -0
- data/source/bzs/db/engine/mysql/dbManager.h +143 -0
- data/source/bzs/db/engine/mysql/errorMessage.cpp +75 -0
- data/source/bzs/db/engine/mysql/errorMessage.h +43 -0
- data/source/bzs/db/engine/mysql/fieldAccess.h +158 -0
- data/source/bzs/db/engine/mysql/mydebuglog.cpp +349 -0
- data/source/bzs/db/engine/mysql/mydebuglog.h +89 -0
- data/source/bzs/db/engine/mysql/mysqlInternal.h +171 -0
- data/source/bzs/db/engine/mysql/mysqlThd.cpp +169 -0
- data/source/bzs/db/engine/mysql/mysqlThd.h +35 -0
- data/source/bzs/db/engine/mysql/percentageKey.h +260 -0
- data/source/bzs/db/protocol/ICommandExecuter.h +49 -0
- data/source/bzs/db/protocol/hs/hsCommandExecuter.cpp +689 -0
- data/source/bzs/db/protocol/hs/hsCommandExecuter.h +228 -0
- data/source/bzs/db/protocol/tdap/btrDate.cpp +437 -0
- data/source/bzs/db/protocol/tdap/btrDate.h +227 -0
- data/source/bzs/db/protocol/tdap/client/bulkInsert.h +127 -0
- data/source/bzs/db/protocol/tdap/client/client.cpp +106 -0
- data/source/bzs/db/protocol/tdap/client/client.h +292 -0
- data/source/bzs/db/protocol/tdap/client/connMgr.cpp +144 -0
- data/source/bzs/db/protocol/tdap/client/connMgr.h +82 -0
- data/source/bzs/db/protocol/tdap/client/database.cpp +863 -0
- data/source/bzs/db/protocol/tdap/client/database.h +118 -0
- data/source/bzs/db/protocol/tdap/client/databaseFactory.cpp +100 -0
- data/source/bzs/db/protocol/tdap/client/dbDef.cpp +1640 -0
- data/source/bzs/db/protocol/tdap/client/dbDef.h +135 -0
- data/source/bzs/db/protocol/tdap/client/dllmain.cpp +434 -0
- data/source/bzs/db/protocol/tdap/client/errorMessage.cpp +92 -0
- data/source/bzs/db/protocol/tdap/client/errorMessage_ja.cpp +98 -0
- data/source/bzs/db/protocol/tdap/client/fieldDDF.cpp +174 -0
- data/source/bzs/db/protocol/tdap/client/fieldDDF.h +91 -0
- data/source/bzs/db/protocol/tdap/client/fileDDF.cpp +140 -0
- data/source/bzs/db/protocol/tdap/client/fileDDF.h +86 -0
- data/source/bzs/db/protocol/tdap/client/filter.cpp +527 -0
- data/source/bzs/db/protocol/tdap/client/filter.h +154 -0
- data/source/bzs/db/protocol/tdap/client/indexDDF.cpp +137 -0
- data/source/bzs/db/protocol/tdap/client/indexDDF.h +84 -0
- data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +724 -0
- data/source/bzs/db/protocol/tdap/client/nsDatabase.h +123 -0
- data/source/bzs/db/protocol/tdap/client/nsTable.cpp +899 -0
- data/source/bzs/db/protocol/tdap/client/nsTable.h +199 -0
- data/source/bzs/db/protocol/tdap/client/request.h +198 -0
- data/source/bzs/db/protocol/tdap/client/sharedData.cpp +58 -0
- data/source/bzs/db/protocol/tdap/client/sharedData.h +56 -0
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +574 -0
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.h +53 -0
- data/source/bzs/db/protocol/tdap/client/stringConverter.h +627 -0
- data/source/bzs/db/protocol/tdap/client/table.cpp +2613 -0
- data/source/bzs/db/protocol/tdap/client/table.h +221 -0
- data/source/bzs/db/protocol/tdap/client/trdboostapi.h +1096 -0
- data/source/bzs/db/protocol/tdap/client/trdboostapiInternal.h +179 -0
- data/source/bzs/db/protocol/tdap/client/trdclcppautolink.h +40 -0
- data/source/bzs/db/protocol/tdap/client/trnsctcl.def +11 -0
- data/source/bzs/db/protocol/tdap/myDateTime.cpp +500 -0
- data/source/bzs/db/protocol/tdap/mysql/characterset.cpp +184 -0
- data/source/bzs/db/protocol/tdap/mysql/characterset.h +60 -0
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +284 -0
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +53 -0
- data/source/bzs/db/protocol/tdap/mysql/debuglog.cpp +383 -0
- data/source/bzs/db/protocol/tdap/mysql/debuglog.h +106 -0
- data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +680 -0
- data/source/bzs/db/protocol/tdap/mysql/request.h +202 -0
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +1020 -0
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +141 -0
- data/source/bzs/db/protocol/tdap/tdapRequest.h +190 -0
- data/source/bzs/db/protocol/tdap/tdapSchema.cpp +295 -0
- data/source/bzs/db/protocol/tdap/tdapSchema.h +558 -0
- data/source/bzs/db/protocol/tdap/tdapcapi.h +423 -0
- data/source/bzs/db/transactd/appBuilderImple.h +55 -0
- data/source/bzs/db/transactd/appModule.cpp +183 -0
- data/source/bzs/db/transactd/appModule.h +80 -0
- data/source/bzs/db/transactd/connManager.cpp +201 -0
- data/source/bzs/db/transactd/connManager.h +60 -0
- data/source/bzs/db/transactd/connectionRecord.h +69 -0
- data/source/bzs/db/transactd/transactd.cpp +325 -0
- data/source/bzs/env/compiler.h +135 -0
- data/source/bzs/env/crosscompile.cpp +130 -0
- data/source/bzs/env/crosscompile.h +150 -0
- data/source/bzs/env/fileopen.h +36 -0
- data/source/bzs/env/mbcswchrLinux.cpp +40 -0
- data/source/bzs/env/mbcswchrLinux.h +88 -0
- data/source/bzs/env/tstring.h +183 -0
- data/source/bzs/example/changeSchema.cpp +117 -0
- data/source/bzs/example/changeSchema_c.cpp +78 -0
- data/source/bzs/example/connection_pool_c.cpp +171 -0
- data/source/bzs/example/createDatabase.cpp +305 -0
- data/source/bzs/example/createDatabase_c.cpp +202 -0
- data/source/bzs/example/deleteRecords.cpp +87 -0
- data/source/bzs/example/deleteRecords_c.cpp +57 -0
- data/source/bzs/example/dropDatabase.cpp +59 -0
- data/source/bzs/example/dropDatabase_c.cpp +34 -0
- data/source/bzs/example/insertRecords.cpp +212 -0
- data/source/bzs/example/insertRecords_c.cpp +153 -0
- data/source/bzs/example/readRecords.cpp +141 -0
- data/source/bzs/example/readRecords_c.cpp +107 -0
- data/source/bzs/example/updateRecords.cpp +99 -0
- data/source/bzs/example/updateRecords_c.cpp +71 -0
- data/source/bzs/example/update_with_transaction.cpp +104 -0
- data/source/bzs/example/update_with_transaction_c.cpp +80 -0
- data/source/bzs/netsvc/client/tcpClient.cpp +226 -0
- data/source/bzs/netsvc/client/tcpClient.h +489 -0
- data/source/bzs/netsvc/server/IAppModule.h +94 -0
- data/source/bzs/netsvc/server/iserver.h +65 -0
- data/source/bzs/netsvc/server/serverCpt.cpp +522 -0
- data/source/bzs/netsvc/server/serverCpt.h +88 -0
- data/source/bzs/netsvc/server/serverPipe.cpp +705 -0
- data/source/bzs/netsvc/server/serverPipe.h +96 -0
- data/source/bzs/netsvc/server/serverTpool.cpp +416 -0
- data/source/bzs/netsvc/server/serverTpool.h +84 -0
- data/source/bzs/rtl/benchmark.cpp +96 -0
- data/source/bzs/rtl/benchmark.h +65 -0
- data/source/bzs/rtl/datetime.cpp +375 -0
- data/source/bzs/rtl/datetime.h +53 -0
- data/source/bzs/rtl/debuglog.cpp +106 -0
- data/source/bzs/rtl/debuglog.h +97 -0
- data/source/bzs/rtl/exception.h +116 -0
- data/source/bzs/rtl/stl_uty.cpp +35 -0
- data/source/bzs/rtl/stl_uty.h +29 -0
- data/source/bzs/rtl/stringBuffers.cpp +101 -0
- data/source/bzs/rtl/stringBuffers.h +58 -0
- data/source/bzs/rtl/strtrim.cpp +135 -0
- data/source/bzs/rtl/strtrim.h +46 -0
- data/source/bzs/test/tdclatl/bench_tdclatl.js +445 -0
- data/source/bzs/test/tdclrb/bench_tdclcpp.rb +375 -0
- data/source/bzs/test/tdclrb/prepare.rb +226 -0
- data/source/bzs/test/tdclrb/transactd_datetime_spec.rb +172 -0
- data/source/bzs/test/tdclrb/transactd_kanjischema_spec.rb +208 -0
- data/source/bzs/test/tdclrb/transactd_spec.rb +1536 -0
- data/source/bzs/test/transactdBench/transactdBench.cpp +430 -0
- data/source/bzs/test/transactdBench/transactdBench2.cpp +342 -0
- data/source/bzs/test/trdclengn/test_trdclengn.cpp +2030 -0
- data/source/global/tdclatl/Database.cpp +503 -0
- data/source/global/tdclatl/Database.h +139 -0
- data/source/global/tdclatl/DbDef.cpp +242 -0
- data/source/global/tdclatl/DbDef.h +79 -0
- data/source/global/tdclatl/Field.cpp +92 -0
- data/source/global/tdclatl/Field.h +59 -0
- data/source/global/tdclatl/FieldDef.cpp +238 -0
- data/source/global/tdclatl/FieldDef.h +87 -0
- data/source/global/tdclatl/Flags.cpp +111 -0
- data/source/global/tdclatl/Flags.h +55 -0
- data/source/global/tdclatl/KeyDef.cpp +51 -0
- data/source/global/tdclatl/KeyDef.h +55 -0
- data/source/global/tdclatl/KeySegment.cpp +55 -0
- data/source/global/tdclatl/Table.cpp +600 -0
- data/source/global/tdclatl/Table.h +144 -0
- data/source/global/tdclatl/TableDef.cpp +291 -0
- data/source/global/tdclatl/TableDef.h +86 -0
- data/source/global/tdclatl/TdVersion.cpp +74 -0
- data/source/global/tdclatl/TdVersion.h +54 -0
- data/source/global/tdclatl/_IDatabaseEvents_CP.h +113 -0
- data/source/global/tdclatl/dllmain.cpp +30 -0
- data/source/global/tdclatl/dllmain.h +27 -0
- data/source/global/tdclatl/keySegment.h +57 -0
- data/source/global/tdclatl/resource.h +0 -0
- data/source/global/tdclatl/stdafx.cpp +2 -0
- data/source/global/tdclatl/stdafx.h +25 -0
- data/source/global/tdclatl/targetver.h +4 -0
- data/source/global/tdclatl/tdclatl.cpp +68 -0
- data/source/global/tdclatl/tdclatl.def +10 -0
- data/source/global/tdclatl/tdclatl.idl +1035 -0
- data/source/linux/charsetConvert.h +112 -0
- data/source/linux/linuxTypes.h +33 -0
- data/source/linux/tchar.h +428 -0
- data/transactd.gemspec +97 -0
- metadata +267 -0
@@ -0,0 +1,290 @@
|
|
1
|
+
/*=================================================================
|
2
|
+
Copyright (C) 2013 BizStation Corp All rights reserved.
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or
|
5
|
+
modify it under the terms of the GNU General Public License
|
6
|
+
as published by the Free Software Foundation; either version 2
|
7
|
+
of the License, or (at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License
|
15
|
+
along with this program; if not, write to the Free Software
|
16
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
17
|
+
02111-1307, USA.
|
18
|
+
=================================================================*/
|
19
|
+
var DRY_RUN = false;
|
20
|
+
var LOG_OFF = false;
|
21
|
+
var IGNORE_ERROR = false;
|
22
|
+
var VERSION_SEPARATOR = '.';
|
23
|
+
var TIMEOUT = 30 * 1000; // copy timeout = 30 sec
|
24
|
+
var fso = new ActiveXObject('Scripting.FileSystemObject');
|
25
|
+
|
26
|
+
// replace '/' to '\'
|
27
|
+
function toNativePath(path)
|
28
|
+
{
|
29
|
+
return path.replace(/\//g, '\\').replace(/^\s*(.*?)\s*$/, "$1");
|
30
|
+
}
|
31
|
+
|
32
|
+
// replace '/' to '\' and convert to absolute path
|
33
|
+
function toNativeAbsolutePath(path)
|
34
|
+
{
|
35
|
+
return fso.GetAbsolutePathName(toNativePath(path));
|
36
|
+
}
|
37
|
+
|
38
|
+
// get parent folder native absolute path
|
39
|
+
function getParentPath(path)
|
40
|
+
{
|
41
|
+
path = toNativeAbsolutePath(path);
|
42
|
+
var name = fso.GetFileName(path);
|
43
|
+
return stripPath(path.substring(0, path.length - name.length));
|
44
|
+
}
|
45
|
+
|
46
|
+
// delete end of '\'
|
47
|
+
function stripPath(path)
|
48
|
+
{
|
49
|
+
return path.replace(/\\$/, '');
|
50
|
+
}
|
51
|
+
|
52
|
+
// create folder recursive -- return true if succeed
|
53
|
+
function createFolder(path)
|
54
|
+
{
|
55
|
+
var fullpath = toNativeAbsolutePath(path);
|
56
|
+
if (fso.FolderExists(fullpath))
|
57
|
+
return true;
|
58
|
+
var myName = fso.GetFileName(fullpath);
|
59
|
+
var parentPath = fullpath.substring(0, fullpath.length - myName.length);
|
60
|
+
parentPath = toNativeAbsolutePath(parentPath);
|
61
|
+
if (fullpath == parentPath)
|
62
|
+
return false;
|
63
|
+
var parentOK = fso.FolderExists(parentPath) || createFolder(parentPath);
|
64
|
+
if (!parentOK)
|
65
|
+
return false;
|
66
|
+
try
|
67
|
+
{
|
68
|
+
fso.CreateFolder(fullpath);
|
69
|
+
return true;
|
70
|
+
} catch (e) {}
|
71
|
+
return false;
|
72
|
+
}
|
73
|
+
|
74
|
+
// get version array
|
75
|
+
function getVersion(path)
|
76
|
+
{
|
77
|
+
var str = fso.FileExists(path) ? fso.GetFileVersion(path) : '';
|
78
|
+
var ver = str.split(VERSION_SEPARATOR);
|
79
|
+
var maxstrlen = 0;
|
80
|
+
for(var i = 0; i < ver.length; i++)
|
81
|
+
{
|
82
|
+
ver[i] = ver[i].replace(/^\s*(.*?)\s*$/, "$1");
|
83
|
+
if (ver[i].length > maxstrlen)
|
84
|
+
maxstrlen = ver[i].length;
|
85
|
+
}
|
86
|
+
if (maxstrlen == 0)
|
87
|
+
ver = [];
|
88
|
+
return ver;
|
89
|
+
}
|
90
|
+
|
91
|
+
// hasVersion -- return true if both of srcpath-version and destpath-version has version info
|
92
|
+
function haveVersion(srcpath, destpath)
|
93
|
+
{
|
94
|
+
var srcver = getVersion(srcpath);
|
95
|
+
var destver = getVersion(destpath);
|
96
|
+
return ((srcver.length > 0) && (destver.length > 0));
|
97
|
+
}
|
98
|
+
|
99
|
+
// greater -- return true if srcpath-version is greater than destpath-version
|
100
|
+
function greater(srcpath, destpath)
|
101
|
+
{
|
102
|
+
var srcver = getVersion(srcpath);
|
103
|
+
var destver = getVersion(destpath);
|
104
|
+
if((srcver.length <= 0) || (destver.length <= 0))
|
105
|
+
return false;
|
106
|
+
var i = 0;
|
107
|
+
while(i < srcver.length && i < destver.length)
|
108
|
+
{
|
109
|
+
src = srcver[i];
|
110
|
+
dest = destver[i];
|
111
|
+
if (!isNaN(src) && !isNaN(dest))
|
112
|
+
{
|
113
|
+
src = parseInt(src, 10);
|
114
|
+
dest = parseInt(dest, 10);
|
115
|
+
}
|
116
|
+
if(src > dest)
|
117
|
+
return true;
|
118
|
+
i++;
|
119
|
+
}
|
120
|
+
return false;
|
121
|
+
}
|
122
|
+
|
123
|
+
// copy -- copy srcpath to destpath (overwrite)
|
124
|
+
// return true if succeed
|
125
|
+
function copy(srcpath, destpath)
|
126
|
+
{
|
127
|
+
if (!fso.FileExists(srcpath))
|
128
|
+
return false;
|
129
|
+
if (!createFolder(getParentPath(destpath)))
|
130
|
+
return false;
|
131
|
+
try
|
132
|
+
{
|
133
|
+
if (! DRY_RUN)
|
134
|
+
{
|
135
|
+
fso.CopyFile(srcpath, destpath, true);
|
136
|
+
var timer = 0;
|
137
|
+
while(!fso.fileExists(destpath) && (timer < TIMEOUT))
|
138
|
+
{
|
139
|
+
WScript.Sleep(100);
|
140
|
+
timer += 100;
|
141
|
+
}
|
142
|
+
return (timer < TIMEOUT);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
catch (e)
|
146
|
+
{
|
147
|
+
return false;
|
148
|
+
}
|
149
|
+
return true;
|
150
|
+
}
|
151
|
+
|
152
|
+
/*
|
153
|
+
copyIfGreater
|
154
|
+
copy srcpath to destpath if srcpath is greater than destpath
|
155
|
+
return code:
|
156
|
+
COPYRESULT_COPIED (0): file copied
|
157
|
+
COPYRESULT_NOTCOPIED (1): file not copied because it is not greater than dest
|
158
|
+
COPYRESULT_CANNOTREAD (2): file not copied because can not read version number
|
159
|
+
COPYRESULT_EXITERROR (3): file not copied because some error occured
|
160
|
+
*/
|
161
|
+
var COPYRESULT_COPIED = 0;
|
162
|
+
var COPYRESULT_NOTCOPIED = 1;
|
163
|
+
var COPYRESULT_CANNOTREAD = 2;
|
164
|
+
var COPYRESULT_EXITERROR = 3;
|
165
|
+
function copyIfGreater(srcpath, destpath)
|
166
|
+
{
|
167
|
+
// 1. check srcpath exists (not folder!)
|
168
|
+
if (!fso.FileExists(srcpath))
|
169
|
+
return COPYRESULT_EXITERROR;
|
170
|
+
// 2. check destpath (not folder!) and its parent
|
171
|
+
if (fso.FolderExists(destpath))
|
172
|
+
return COPYRESULT_EXITERROR;
|
173
|
+
if (!createFolder(getParentPath(destpath)))
|
174
|
+
return COPYRESULT_EXITERROR;
|
175
|
+
// 3. if destpath not exists then copy file
|
176
|
+
if (!fso.FileExists(destpath))
|
177
|
+
{
|
178
|
+
if (copy(srcpath, destpath))
|
179
|
+
return COPYRESULT_COPIED;
|
180
|
+
return COPYRESULT_EXITERROR;
|
181
|
+
}
|
182
|
+
// 4. check both of srcpath and destpath have version info
|
183
|
+
if (!haveVersion(srcpath, destpath))
|
184
|
+
return COPYRESULT_CANNOTREAD;
|
185
|
+
// 5. if this is greater than destFileInfo then copy file
|
186
|
+
if (greater(srcpath, destpath))
|
187
|
+
{
|
188
|
+
if (copy(srcpath, destpath))
|
189
|
+
return COPYRESULT_COPIED;
|
190
|
+
return COPYRESULT_EXITERROR;
|
191
|
+
}
|
192
|
+
// 6. other do nothing
|
193
|
+
return COPYRESULT_NOTCOPIED;
|
194
|
+
}
|
195
|
+
|
196
|
+
// parse arguments to file list
|
197
|
+
function printArg(args){
|
198
|
+
WScript.Echo('source:' + args['source'] + "\ndest:" +args['dest'] + "\n");
|
199
|
+
}
|
200
|
+
function parseArgs(args)
|
201
|
+
{
|
202
|
+
if (!(args instanceof Array) || (args.length < 2))
|
203
|
+
return false;
|
204
|
+
// 1. last arg is dest
|
205
|
+
var dest = toNativePath(args[args.length - 1])
|
206
|
+
// 2. is dest folder? -- end with '\\' or multi source then dest is folder
|
207
|
+
var destIsFolder = (/\\$/.test(dest) || args.length > 2 || fso.FolderExists(dest))
|
208
|
+
//WScript.Echo(destIsFolder ? 'destIsFolder' : 'destIs not Folder')
|
209
|
+
// 3. if dest is file then only 1 file to copy
|
210
|
+
if (!destIsFolder)
|
211
|
+
{
|
212
|
+
var src = stripPath(toNativePath(args[0]));
|
213
|
+
if (src.length <= 0)
|
214
|
+
return { 'source': new Array(), 'dest': new Array() };
|
215
|
+
var dst = stripPath(toNativePath(args[1]));
|
216
|
+
return { 'source': new Array(src), 'dest': new Array(dst) };
|
217
|
+
}
|
218
|
+
// 4. if dest is folder, make dest array
|
219
|
+
var ret = { source: new Array(), dest: new Array() };
|
220
|
+
var tmp_srcs = args.slice(0, args.length - 1);
|
221
|
+
for(var i = 0; i < tmp_srcs.length; i++)
|
222
|
+
{
|
223
|
+
var path = toNativePath(tmp_srcs[i]);
|
224
|
+
if (path.length > 0)
|
225
|
+
{
|
226
|
+
var name = fso.GetFileName(path);
|
227
|
+
ret['source'].push(path);
|
228
|
+
ret['dest'].push(fso.BuildPath(dest, name));
|
229
|
+
}
|
230
|
+
}
|
231
|
+
return ret;
|
232
|
+
}
|
233
|
+
|
234
|
+
|
235
|
+
function main()
|
236
|
+
{
|
237
|
+
var args = [];
|
238
|
+
for(var i = 0; i < WScript.Arguments.length; i++)
|
239
|
+
{
|
240
|
+
var argument = WScript.Arguments(i).replace(/^\s*"?\s*(.*?)\s*"?\s*$/, "$1");
|
241
|
+
var subargs = argument.split(';');
|
242
|
+
for(var j = 0; j < subargs.length; j++)
|
243
|
+
{
|
244
|
+
var arg = subargs[j].replace(/^\s*(.*?)\s*$/, "$1");
|
245
|
+
switch (arg) {
|
246
|
+
case '--dry-run': DRY_RUN = true; break;
|
247
|
+
case '--log-off': LOG_OFF = true; break;
|
248
|
+
case '--ignore-error': IGNORE_ERROR = true; break;
|
249
|
+
default:
|
250
|
+
if (arg.length > 0);
|
251
|
+
args.push(arg);
|
252
|
+
break;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}
|
256
|
+
var files = parseArgs(args);
|
257
|
+
if (!files)
|
258
|
+
WScript.Quit(1);
|
259
|
+
var sources = files['source'];
|
260
|
+
var dests = files['dest'];
|
261
|
+
var exitcode = 0;
|
262
|
+
for(var i = 0; i < sources.length; i++)
|
263
|
+
{
|
264
|
+
var ret = copyIfGreater(sources[i], dests[i]);
|
265
|
+
switch (ret) {
|
266
|
+
case COPYRESULT_COPIED:
|
267
|
+
if (!LOG_OFF)
|
268
|
+
WScript.Echo('Installing-if-grater: ' + dests[i]);
|
269
|
+
break;
|
270
|
+
case COPYRESULT_NOTCOPIED:
|
271
|
+
if (!LOG_OFF)
|
272
|
+
WScript.Echo('Up-to-date-if-grater: ' + dests[i]);
|
273
|
+
break;
|
274
|
+
case COPYRESULT_CANNOTREAD:
|
275
|
+
if (!LOG_OFF)
|
276
|
+
WScript.StdErr.WriteLine('Install-warning: ' + sources[i] + ' -> ' + dests[i]);
|
277
|
+
break;
|
278
|
+
case COPYRESULT_EXITERROR:
|
279
|
+
default:
|
280
|
+
if (!LOG_OFF)
|
281
|
+
WScript.StdErr.WriteLine('Install-error-' + ret + ': ' + sources[i] + ' -> ' + dests[i]);
|
282
|
+
if (!IGNORE_ERROR)
|
283
|
+
WScript.Quit(1);
|
284
|
+
exitcode = 1;
|
285
|
+
break;
|
286
|
+
}
|
287
|
+
}
|
288
|
+
WScript.Quit(exitcode);
|
289
|
+
}
|
290
|
+
main()
|
@@ -0,0 +1,106 @@
|
|
1
|
+
##=================================================================
|
2
|
+
# Copyright (C) 2012 2013 BizStation Corp All rights reserved.
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU General Public License
|
6
|
+
# as published by the Free Software Foundation; either version 2
|
7
|
+
# of the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
17
|
+
# 02111-1307, USA.
|
18
|
+
##=================================================================
|
19
|
+
# get_boost_libs function
|
20
|
+
# Find Boost pathes for /MD(d) or /MT(d) on Visual Studio
|
21
|
+
# example:
|
22
|
+
# set(Boost_USE_MULTITHREADED ON)
|
23
|
+
# set(Boost_USE_STATIC_LIBS ON)
|
24
|
+
# get_boost_libs("system;chrono")
|
25
|
+
# message(STATUS "for /MD ${Boost_LIBRARIES_FOR_MD}") # =Boost_LIBRARIES_STATIC_RUNTIME_OFF_NO_DEBUG
|
26
|
+
# message(STATUS "for /MDd ${Boost_LIBRARIES_FOR_MDd}") # =Boost_LIBRARIES_STATIC_RUNTIME_OFF_DEBUG
|
27
|
+
# message(STATUS "for /MT ${Boost_LIBRARIES_FOR_MT}") # =Boost_LIBRARIES_STATIC_RUNTIME_ON_NO_DEBUG
|
28
|
+
# message(STATUS "for /MTd ${Boost_LIBRARIES_FOR_MTd}") # =Boost_LIBRARIES_STATIC_RUNTIME_ON_DEBUG
|
29
|
+
# get_boost_libs_from_CXXFLAGS("${CMAKE_CXX_FLAGS_DEBUG}")
|
30
|
+
# message(STATUS "for DEBUG BUILD ${get_boost_libs_from_CXXFLAGS_return}")
|
31
|
+
function(get_boost_libs libs)
|
32
|
+
# Get pathes STATIC_RUNTIME_ON
|
33
|
+
set(Boost_USE_STATIC_RUNTIME ON)
|
34
|
+
find_package(Boost COMPONENTS ${libs})
|
35
|
+
if(NOT Boost_FOUND)
|
36
|
+
message(SEND_ERROR "Boost not found. ${libs}")
|
37
|
+
endif()
|
38
|
+
set(Boost_LIBRARIES_STATIC_RUNTIME_ON ${Boost_LIBRARIES})
|
39
|
+
set(Boost_LIBRARIES "")
|
40
|
+
# Get pathes STATIC_RUNTIME_OFF
|
41
|
+
set(Boost_USE_STATIC_RUNTIME OFF)
|
42
|
+
find_package(Boost COMPONENTS ${libs})
|
43
|
+
if(NOT Boost_FOUND)
|
44
|
+
message(SEND_ERROR "Boost not found. ${libs}")
|
45
|
+
endif()
|
46
|
+
set(Boost_LIBRARIES_STATIC_RUNTIME_OFF ${Boost_LIBRARIES})
|
47
|
+
set(Boost_LIBRARIES "")
|
48
|
+
# for /MD
|
49
|
+
parse_boost_libs(false "${Boost_LIBRARIES_STATIC_RUNTIME_OFF}")
|
50
|
+
set(Boost_LIBRARIES_FOR_MD "${parse_boost_libs_return}" PARENT_SCOPE)
|
51
|
+
set(Boost_LIBRARIES_STATIC_RUNTIME_OFF_NO_DEBUG "${parse_boost_libs_return}" PARENT_SCOPE)
|
52
|
+
# for /MDd
|
53
|
+
parse_boost_libs(true "${Boost_LIBRARIES_STATIC_RUNTIME_OFF}")
|
54
|
+
set(Boost_LIBRARIES_FOR_MDd "${parse_boost_libs_return}" PARENT_SCOPE)
|
55
|
+
set(Boost_LIBRARIES_STATIC_RUNTIME_OFF_DEBUG "${parse_boost_libs_return}" PARENT_SCOPE)
|
56
|
+
# for /MT
|
57
|
+
parse_boost_libs(false "${Boost_LIBRARIES_STATIC_RUNTIME_ON}")
|
58
|
+
set(Boost_LIBRARIES_FOR_MT "${parse_boost_libs_return}" PARENT_SCOPE)
|
59
|
+
set(Boost_LIBRARIES_STATIC_RUNTIME_ON_NO_DEBUG "${parse_boost_libs_return}" PARENT_SCOPE)
|
60
|
+
# for /MTd
|
61
|
+
parse_boost_libs(true "${Boost_LIBRARIES_STATIC_RUNTIME_ON}")
|
62
|
+
set(Boost_LIBRARIES_FOR_MTd "${parse_boost_libs_return}" PARENT_SCOPE)
|
63
|
+
set(Boost_LIBRARIES_STATIC_RUNTIME_ON_DEBUG "${parse_boost_libs_return}" PARENT_SCOPE)
|
64
|
+
# Boost_INCLUDE_DIRS
|
65
|
+
set(Boost_INCLUDE_DIRS "${Boost_INCLUDE_DIRS}" PARENT_SCOPE)
|
66
|
+
endfunction()
|
67
|
+
|
68
|
+
function(get_boost_libs_from_CXXFLAGS flags)
|
69
|
+
set(get_boost_libs_from_CXXFLAGS_return "" PARENT_SCOPE)
|
70
|
+
set(Boost_LIBRARIES_BUILD_TYPE "")
|
71
|
+
if("${flags}" MATCHES "(.* )?/MD( .*)?$")
|
72
|
+
set(Boost_LIBRARIES_BUILD_TYPE "${Boost_LIBRARIES_FOR_MD}")
|
73
|
+
elseif("${flags}" MATCHES "(.* )?/MDd( .*)?$")
|
74
|
+
set(Boost_LIBRARIES_BUILD_TYPE "${Boost_LIBRARIES_FOR_MDd}")
|
75
|
+
elseif("${flags}" MATCHES "(.* )?/MT( .*)?$")
|
76
|
+
set(Boost_LIBRARIES_BUILD_TYPE "${Boost_LIBRARIES_FOR_MT}")
|
77
|
+
elseif("${flags}" MATCHES "(.* )?/MTd( .*)?$")
|
78
|
+
set(Boost_LIBRARIES_BUILD_TYPE "${Boost_LIBRARIES_FOR_MTd}")
|
79
|
+
else()
|
80
|
+
set(Boost_LIBRARIES_BUILD_TYPE "${Boost_LIBRARIES_FOR_MD}")
|
81
|
+
endif()
|
82
|
+
set(get_boost_libs_from_CXXFLAGS_return "${Boost_LIBRARIES_BUILD_TYPE}" PARENT_SCOPE)
|
83
|
+
endfunction()
|
84
|
+
|
85
|
+
function(parse_boost_libs with_debug path)
|
86
|
+
set(parse_boost_libs_return "" PARENT_SCOPE)
|
87
|
+
set(add_pathes_list OFF)
|
88
|
+
set(pathes "")
|
89
|
+
foreach(item ${path})
|
90
|
+
if("${item}" MATCHES "debug")
|
91
|
+
if(with_debug)
|
92
|
+
set(add_pathes_list ON)
|
93
|
+
endif()
|
94
|
+
elseif("${item}" MATCHES "^optimized$")
|
95
|
+
if(NOT with_debug)
|
96
|
+
set(add_pathes_list ON)
|
97
|
+
endif()
|
98
|
+
else()
|
99
|
+
if(add_pathes_list)
|
100
|
+
set(pathes "${pathes}${item};")
|
101
|
+
endif()
|
102
|
+
set(add_pathes_list OFF)
|
103
|
+
endif()
|
104
|
+
endforeach()
|
105
|
+
set(parse_boost_libs_return "${pathes}" PARENT_SCOPE)
|
106
|
+
endfunction()
|
@@ -0,0 +1,115 @@
|
|
1
|
+
##=================================================================
|
2
|
+
# Copyright (C) 2012 2013 BizStation Corp All rights reserved.
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU General Public License
|
6
|
+
# as published by the Free Software Foundation; either version 2
|
7
|
+
# of the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
17
|
+
# 02111-1307, USA.
|
18
|
+
##=================================================================
|
19
|
+
# get ruby path
|
20
|
+
# message(STATUS "Found ${RUBY_EXECITABLE_PATH}")
|
21
|
+
# message(STATUS " RUBY_VERSION : ${RUBY_VERSION}")
|
22
|
+
# message(STATUS " RUBY_VERSION_STRING : ${RUBY_VERSION_STRING}")
|
23
|
+
# message(STATUS " RUBY_INCLUDE_DIRS : ${RUBY_INCLUDE_DIRS}")
|
24
|
+
# message(STATUS " RUBY_LIB_PATH : ${RUBY_LIB_PATH}")
|
25
|
+
# message(STATUS " RUBY_STATIC_LIB_PATH : ${RUBY_STATIC_LIB_PATH}")
|
26
|
+
# message(STATUS " RUBY_VERSION_FOR_GEM : ${RUBY_VERSION_FOR_GEM}")
|
27
|
+
if(NOT COMMAND get_ruby_path)
|
28
|
+
macro(get_ruby_path RUBY_EXE_PATH)
|
29
|
+
if("${RUBY_EXE_PATH}" STREQUAL "")
|
30
|
+
set(tmp_ruby "ruby")
|
31
|
+
else()
|
32
|
+
set(tmp_ruby "${RUBY_EXE_PATH}")
|
33
|
+
endif()
|
34
|
+
# find ruby executable
|
35
|
+
execute_process(COMMAND ${tmp_ruby} -v OUTPUT_VARIABLE RUBY_VERSION_STRING)
|
36
|
+
string(STRIP "${RUBY_VERSION_STRING}" RUBY_VERSION_STRING)
|
37
|
+
set(RUBY_EXECITABLE_PATH "${tmp_ruby}")
|
38
|
+
if("${RUBY_VERSION_STRING}" STREQUAL "")
|
39
|
+
set(RUBY_EXECITABLE_PATH "")
|
40
|
+
endif()
|
41
|
+
# RUBY_VERSION
|
42
|
+
execute_process(COMMAND ${tmp_ruby} -e "puts RUBY_VERSION"
|
43
|
+
OUTPUT_VARIABLE RUBY_VERSION)
|
44
|
+
string(STRIP "${RUBY_VERSION}" RUBY_VERSION)
|
45
|
+
# RUBY_VERSION_GEM
|
46
|
+
execute_process(COMMAND ${tmp_ruby} -e "puts RUBY_VERSION.match(/\\d+\\.\\d+/)[0]"
|
47
|
+
OUTPUT_VARIABLE RUBY_VERSION_FOR_GEM)
|
48
|
+
string(STRIP "${RUBY_VERSION_FOR_GEM}" RUBY_VERSION_FOR_GEM)
|
49
|
+
# excec ruby command (rbconfig)
|
50
|
+
execute_process(COMMAND ${tmp_ruby} -r rbconfig -e
|
51
|
+
"keys = ['LIBRUBY', 'LIBRUBY_A', 'rubyarchhdrdir', 'rubyhdrdir', 'libdir', 'archlibdir', 'arch', 'bindir', 'sbindir', 'ruby_install_name'];RbConfig::CONFIG.each{|key, value| puts ':' + key + '=' + value if keys.include?(key)}"
|
52
|
+
OUTPUT_VARIABLE RBCONFIG_RETURN_VALUES)
|
53
|
+
#message(STATUS "${RBCONFIG_RETURN_VALUES}")
|
54
|
+
# parse result
|
55
|
+
foreach(keyword LIBRUBY LIBRUBY_A rubyarchhdrdir rubyhdrdir libdir archlibdir arch bindir sbindir ruby_install_name)
|
56
|
+
set(RBCONFIG_${keyword} "")
|
57
|
+
string(REGEX MATCH ":${keyword}=[^\n]*" tmp_str "${RBCONFIG_RETURN_VALUES}")
|
58
|
+
string(STRIP "${tmp_str}" tmp_str)
|
59
|
+
string(REPLACE ":${keyword}=" "" tmp_str "${tmp_str}")
|
60
|
+
set(RBCONFIG_${keyword} "${tmp_str}")
|
61
|
+
endforeach()
|
62
|
+
# overwrite executable path to fullpath
|
63
|
+
if(NOT "${RBCONFIG_bindir}" STREQUAL "")
|
64
|
+
if("${RBCONFIG_ruby_install_name}" STREQUAL "")
|
65
|
+
set(RUBY_EXECITABLE_PATH "${RBCONFIG_bindir}/ruby")
|
66
|
+
else()
|
67
|
+
set(RUBY_EXECITABLE_PATH "${RBCONFIG_bindir}/${RBCONFIG_ruby_install_name}")
|
68
|
+
endif()
|
69
|
+
file(TO_CMAKE_PATH "${RUBY_EXECITABLE_PATH}" RUBY_EXECITABLE_PATH)
|
70
|
+
endif()
|
71
|
+
# find library path
|
72
|
+
find_path(RUBY_LIB_PATH NAMES ${RBCONFIG_LIBRUBY}
|
73
|
+
HINTS ${RBCONFIG_libdir} ${RBCONFIG_archlibdir}
|
74
|
+
${RBCONFIG_bindir} ${RBCONFIG_sbindir} NO_DEFAULT_PATH)
|
75
|
+
if("${RUBY_LIB_PATH}" STREQUAL "RUBY_LIB_PATH-NOTFOUND")
|
76
|
+
set(RUBY_LIB_PATH "")
|
77
|
+
else()
|
78
|
+
set(RUBY_LIB_PATH "${RUBY_LIB_PATH}/${RBCONFIG_LIBRUBY}")
|
79
|
+
file(TO_NATIVE_PATH "${RUBY_LIB_PATH}" RUBY_LIB_PATH)
|
80
|
+
endif()
|
81
|
+
# find static library path
|
82
|
+
find_path(RUBY_STATIC_LIB_PATH NAMES ${RBCONFIG_LIBRUBY_A}
|
83
|
+
HINTS ${RBCONFIG_libdir} ${RBCONFIG_archlibdir}
|
84
|
+
${RBCONFIG_bindir} ${RBCONFIG_sbindir} NO_DEFAULT_PATH)
|
85
|
+
if("${RUBY_STATIC_LIB_PATH}" STREQUAL "RUBY_STATIC_LIB_PATH-NOTFOUND")
|
86
|
+
set(RUBY_STATIC_LIB_PATH "")
|
87
|
+
else()
|
88
|
+
set(RUBY_STATIC_LIB_PATH "${RUBY_STATIC_LIB_PATH}/${RBCONFIG_LIBRUBY_A}")
|
89
|
+
file(TO_NATIVE_PATH "${RUBY_STATIC_LIB_PATH}" RUBY_STATIC_LIB_PATH)
|
90
|
+
endif()
|
91
|
+
# find include path (ruby.h)
|
92
|
+
find_path(RUBY_INCLUDE_DIR_1 NAMES ruby.h
|
93
|
+
HINTS ${RBCONFIG_rubyhdrdir} ${RBCONFIG_rubyarchhdrdir} NO_DEFAULT_PATH)
|
94
|
+
if("${RUBY_INCLUDE_DIR_1}" STREQUAL "RUBY_INCLUDE_DIR_1-NOTFOUND")
|
95
|
+
set(RUBY_INCLUDE_DIR_1 "")
|
96
|
+
endif()
|
97
|
+
# find include path (ruby/config.h)
|
98
|
+
set(tmp_str "${RBCONFIG_rubyhdrdir}/${RBCONFIG_arch}")
|
99
|
+
file(TO_NATIVE_PATH "${tmp_str}" tmp_str)
|
100
|
+
find_path(RUBY_INCLUDE_DIR_2 NAMES ruby/config.h
|
101
|
+
HINTS "${RBCONFIG_rubyhdrdir}" "${RBCONFIG_rubyarchhdrdir}" "${tmp_str}" NO_DEFAULT_PATH)
|
102
|
+
if("${RUBY_INCLUDE_DIR_2}" STREQUAL "RUBY_INCLUDE_DIR_2-NOTFOUND")
|
103
|
+
set(RUBY_INCLUDE_DIR_2 "")
|
104
|
+
endif()
|
105
|
+
set(RUBY_INCLUDE_DIRS "${RUBY_INCLUDE_DIR_1};${RUBY_INCLUDE_DIR_2}")
|
106
|
+
# print
|
107
|
+
message(STATUS "Found ${RUBY_EXECITABLE_PATH}")
|
108
|
+
message(STATUS " RUBY_VERSION : ${RUBY_VERSION}")
|
109
|
+
message(STATUS " RUBY_VERSION_STRING : ${RUBY_VERSION_STRING}")
|
110
|
+
message(STATUS " RUBY_INCLUDE_DIRS : ${RUBY_INCLUDE_DIRS}")
|
111
|
+
message(STATUS " RUBY_LIB_PATH : ${RUBY_LIB_PATH}")
|
112
|
+
message(STATUS " RUBY_STATIC_LIB_PATH : ${RUBY_STATIC_LIB_PATH}")
|
113
|
+
message(STATUS " RUBY_VERSION_FOR_GEM : ${RUBY_VERSION_FOR_GEM}")
|
114
|
+
endmacro()
|
115
|
+
endif()
|
@@ -0,0 +1,127 @@
|
|
1
|
+
##=================================================================
|
2
|
+
# Copyright (C) 2012 2013 BizStation Corp All rights reserved.
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU General Public License
|
6
|
+
# as published by the Free Software Foundation; either version 2
|
7
|
+
# of the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
17
|
+
# 02111-1307, USA.
|
18
|
+
##=================================================================
|
19
|
+
# ==========================================================
|
20
|
+
# replace CXX_FLAGS
|
21
|
+
# ==========================================================
|
22
|
+
if(NOT COMMAND bz_replace_cxx_flag)
|
23
|
+
macro(bz_replace_cxx_flag ptn val build_type)
|
24
|
+
if("${build_type}" STREQUAL "_")
|
25
|
+
set(build_type "")
|
26
|
+
elseif(NOT ("${build_type}" STREQUAL ""))
|
27
|
+
string(REGEX MATCH "^_" tmp_match "${build_type}")
|
28
|
+
if("${tmp_match}" STREQUAL "")
|
29
|
+
set(build_type "_${build_type}")
|
30
|
+
endif()
|
31
|
+
endif()
|
32
|
+
string(REGEX REPLACE "${ptn}" "${val}"
|
33
|
+
CMAKE_CXX_FLAGS${build_type} "${CMAKE_CXX_FLAGS${build_type}}")
|
34
|
+
endmacro()
|
35
|
+
endif()
|
36
|
+
|
37
|
+
# ==========================================================
|
38
|
+
# remove CXX_FLAGS
|
39
|
+
# ==========================================================
|
40
|
+
if(NOT COMMAND bz_remove_cxx_flag)
|
41
|
+
macro(bz_remove_cxx_flag opt build_type)
|
42
|
+
bz_replace_cxx_flag("${opt}" "" "${build_type}")
|
43
|
+
endmacro()
|
44
|
+
endif()
|
45
|
+
|
46
|
+
# ==========================================================
|
47
|
+
# add CXX_FLAGS
|
48
|
+
# ==========================================================
|
49
|
+
if(NOT COMMAND bz_add_cxx_flag)
|
50
|
+
macro(bz_add_cxx_flag opt build_type)
|
51
|
+
if("${build_type}" STREQUAL "_")
|
52
|
+
set(build_type "")
|
53
|
+
elseif(NOT ("${build_type}" STREQUAL ""))
|
54
|
+
string(REGEX MATCH "^_" tmp_match "${build_type}")
|
55
|
+
if("${tmp_match}" STREQUAL "")
|
56
|
+
set(build_type "_${build_type}")
|
57
|
+
endif()
|
58
|
+
endif()
|
59
|
+
set(CMAKE_CXX_FLAGS${build_type} "${CMAKE_CXX_FLAGS${build_type}} ${opt}")
|
60
|
+
endmacro()
|
61
|
+
endif()
|
62
|
+
|
63
|
+
# ==========================================================
|
64
|
+
# remove UNICODE or MBCS flag from CXX_FLAGS
|
65
|
+
# ==========================================================
|
66
|
+
if(NOT COMMAND bz_remove_charset_cxx_flag)
|
67
|
+
macro(bz_remove_charset_cxx_flag build_type)
|
68
|
+
bz_remove_cxx_flag("-DUNICODE" "${build_type}")
|
69
|
+
bz_remove_cxx_flag("/DUNICODE" "${build_type}")
|
70
|
+
bz_remove_cxx_flag("-D_UNICODE" "${build_type}")
|
71
|
+
bz_remove_cxx_flag("/D_UNICODE" "${build_type}")
|
72
|
+
bz_remove_cxx_flag("-DMBCS" "${build_type}")
|
73
|
+
bz_remove_cxx_flag("/DMBCS" "${build_type}")
|
74
|
+
bz_remove_cxx_flag("-D_MBCS" "${build_type}")
|
75
|
+
bz_remove_cxx_flag("/D_MBCS" "${build_type}")
|
76
|
+
endmacro()
|
77
|
+
endif()
|
78
|
+
|
79
|
+
# ==========================================================
|
80
|
+
# set UNICODE flag to CXX_FLAGS
|
81
|
+
# ==========================================================
|
82
|
+
if(NOT COMMAND bz_set_UNICODE_cxx_flag)
|
83
|
+
macro(bz_set_UNICODE_cxx_flag build_type)
|
84
|
+
bz_remove_charset_cxx_flag("${build_type}")
|
85
|
+
bz_add_cxx_flag("-DUNICODE -D_UNICODE" "${build_type}")
|
86
|
+
endmacro()
|
87
|
+
endif()
|
88
|
+
|
89
|
+
# ==========================================================
|
90
|
+
# set MBCS flag to CXX_FLAGS
|
91
|
+
# ==========================================================
|
92
|
+
if(NOT COMMAND bz_set_MBCS_cxx_flag)
|
93
|
+
macro(bz_set_MBCS_cxx_flag build_type)
|
94
|
+
bz_remove_charset_cxx_flag("${build_type}")
|
95
|
+
bz_add_cxx_flag("-D_MBCS" "${build_type}")
|
96
|
+
endmacro()
|
97
|
+
endif()
|
98
|
+
|
99
|
+
# ==========================================================
|
100
|
+
# set /MT(d) flag to CXX_FLAGS
|
101
|
+
# ==========================================================
|
102
|
+
if(NOT COMMAND bz_set_MTMTd_cxx_flag)
|
103
|
+
macro(bz_set_MTMTd_cxx_flag build_type)
|
104
|
+
bz_replace_cxx_flag("/MDd" "/MTd" "${build_type}")
|
105
|
+
bz_replace_cxx_flag("/MD" "/MT" "${build_type}")
|
106
|
+
if( "${CMAKE_CXX_FLAGS${build_type}}" MATCHES "(.* )?/MT( .*)?$")
|
107
|
+
elseif("${CMAKE_CXX_FLAGS${build_type}}" MATCHES "(.* )?/MTd( .*)?$")
|
108
|
+
else()
|
109
|
+
bz_add_cxx_flag("/MT" "${build_type}")
|
110
|
+
endif()
|
111
|
+
endmacro()
|
112
|
+
endif()
|
113
|
+
|
114
|
+
# ==========================================================
|
115
|
+
# set /MD(d) flag to CXX_FLAGS
|
116
|
+
# ==========================================================
|
117
|
+
if(NOT COMMAND bz_set_MDMDd_cxx_flag)
|
118
|
+
macro(bz_set_MDMDd_cxx_flag build_type)
|
119
|
+
bz_replace_cxx_flag("/MTd" "/MDd" "${build_type}")
|
120
|
+
bz_replace_cxx_flag("/MT" "/MD" "${build_type}")
|
121
|
+
if( "${CMAKE_CXX_FLAGS${build_type}}" MATCHES "(.* )?/MD( .*)?$")
|
122
|
+
elseif("${CMAKE_CXX_FLAGS${build_type}}" MATCHES "(.* )?/MDd( .*)?$")
|
123
|
+
else()
|
124
|
+
bz_add_cxx_flag("/MD" "${build_type}")
|
125
|
+
endif()
|
126
|
+
endmacro()
|
127
|
+
endif()
|