Skip to content

Commit 105e411

Browse files
committed
update premake5.lua, make it can build with debug mod
Signed-off-by: sndnvaps <sndnvaps@gmail.com>
1 parent f026622 commit 105e411

1 file changed

Lines changed: 88 additions & 76 deletions

File tree

premake5.lua

Lines changed: 88 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@
55
-- Win32 or Win64
66

77
-- Target directory for the build files generated by premake5
8+
9+
810
SOL_ROOT_DIR = "."
9-
LIBICU_PATH = SOL_ROOT_DIR.."/./3rd/"
11+
SRC_DIR = SOL_ROOT_DIR.."/src"
12+
BUILD_DIR = SOL_ROOT_DIR.."/build"
13+
PRJ_NAME_LIB = "sqlite3_lib"
14+
PRJ_NAME_DLL = "sqlite3_dll"
15+
PRJ_NAME_SHELL = "sqlite3_shell"
16+
PRJ_NAME_LIB_ICU = "sqlite3_lib_icu"
17+
PRJ_NAME_DLL_ICU = "sqlite3_dll_icu"
18+
PRJ_NAME_SHELL_ICU = "sqlite3_shell_icu"
1019

1120
newoption {
1221
trigger = "builddir",
@@ -17,9 +26,10 @@ newoption {
1726
BUILDDIR = _OPTIONS["builddir"] or "build"
1827

1928
workspace "SQLite3"
20-
configurations { "Debug AES128", "Release AES128", "Debug AES256", "Release AES256" }
21-
platforms { "Win32", "Win64" }
22-
location(BUILDDIR)
29+
configurations { "Debug_AES128", "Release_AES128", "Debug_AES256", "Release_AES256" }
30+
platforms { "Win32", "x64" }
31+
targetdir "bin/$(ProjectName)/$(Configuration)"
32+
-- location(BUILDDIR)
2333

2434
defines {
2535
"_WINDOWS",
@@ -33,7 +43,7 @@ workspace "SQLite3"
3343
system "Windows"
3444
architecture "x32"
3545

36-
filter { "platforms:Win64" }
46+
filter { "platforms:x64" }
3747
system "Windows"
3848
architecture "x64"
3949
targetsuffix "_x64"
@@ -55,7 +65,7 @@ workspace "SQLite3"
5565
filter {}
5666

5767
-- SQLite3 static library
58-
project "sqlite3lib"
68+
project (PRJ_NAME_LIB)
5969
language "C++"
6070
kind "StaticLib"
6171

@@ -67,7 +77,7 @@ project "sqlite3lib"
6777
characterset ("Unicode")
6878
flags { "StaticRuntime" }
6979

70-
location( BUILDDIR )
80+
location( BUILDDIR.."/"..PRJ_NAME_LIB )
7181
targetname "sqlite3"
7282

7383
defines {
@@ -107,17 +117,17 @@ project "sqlite3lib"
107117
}
108118

109119
-- Target directory
110-
filter { "configurations:Debug AES128" }
111-
targetdir "aes128/lib/debug"
112-
filter { "configurations:Debug AES256" }
113-
targetdir "aes256/lib/debug"
114-
filter { "configurations:Release AES128" }
115-
targetdir "aes128/lib/release"
116-
filter { "configurations:Release AES256" }
117-
targetdir "aes256/lib/release"
120+
filter { "configurations:Debug_AES128" }
121+
targetdir "bin/aes128/lib/debug"
122+
filter { "configurations:Debug_AES256" }
123+
targetdir "bin/aes256/lib/debug"
124+
filter { "configurations:Release_AES128" }
125+
targetdir "bin/aes128/lib/release"
126+
filter { "configurations:Release_AES256" }
127+
targetdir "bin/aes256/lib/release"
118128

119129
-- SQLite3 shared library
120-
project "sqlite3dll"
130+
project (PRJ_NAME_DLL)
121131
language "C++"
122132
kind "SharedLib"
123133

@@ -130,7 +140,7 @@ project "sqlite3dll"
130140
characterset ("Unicode")
131141
flags { "StaticRuntime" }
132142

133-
location( BUILDDIR )
143+
location( BUILDDIR.."/"..PRJ_NAME_DLL )
134144
targetname "sqlite3"
135145

136146
defines {
@@ -169,17 +179,17 @@ project "sqlite3dll"
169179
}
170180

171181
-- Target directory
172-
filter { "configurations:Debug AES128" }
173-
targetdir "aes128/dll/debug"
174-
filter { "configurations:Debug AES256" }
175-
targetdir "aes256/dll/debug"
176-
filter { "configurations:Release AES128" }
177-
targetdir "aes128/dll/release"
178-
filter { "configurations:Release AES256" }
179-
targetdir "aes256/dll/release"
182+
filter { "configurations:Debug_AES128" }
183+
targetdir "bin/aes128/dll/debug"
184+
filter { "configurations:Debug_AES256" }
185+
targetdir "bin/aes256/dll/debug"
186+
filter { "configurations:Release_AES128" }
187+
targetdir "bin/aes128/dll/release"
188+
filter { "configurations:Release_AES256" }
189+
targetdir "bin/aes256/dll/release"
180190

181191
-- SQLite3 Shell
182-
project "sqlite3shell"
192+
project (PRJ_NAME_SHELL)
183193
kind "ConsoleApp"
184194
language "C++"
185195
vpaths {
@@ -189,9 +199,10 @@ project "sqlite3shell"
189199
files { "src/sqlite3.h", "src/shell.c", "src/sqlite3shell.rc" }
190200
characterset ("Unicode")
191201
flags { "StaticRuntime" }
192-
links { "sqlite3lib" }
202+
links { PRJ_NAME_LIB }
193203

194-
location( BUILDDIR )
204+
location( BUILDDIR.."/"..PRJ_NAME_SHELL )
205+
targetname "sqlite3shell"
195206

196207
defines {
197208
"SQLITE_SHELL_IS_UTF8",
@@ -200,19 +211,19 @@ project "sqlite3shell"
200211
}
201212

202213
-- Target directory
203-
filter { "configurations:Debug AES128" }
204-
targetdir "aes128/lib/debug"
205-
filter { "configurations:Debug AES256" }
206-
targetdir "aes256/lib/debug"
207-
filter { "configurations:Release AES128" }
208-
targetdir "aes128/lib/release"
209-
filter { "configurations:Release AES256" }
210-
targetdir "aes256/lib/release"
214+
filter { "configurations:Debug_AES128" }
215+
targetdir "bin/aes128/lib/debug"
216+
filter { "configurations:Debug_AES256" }
217+
targetdir "bin/aes256/lib/debug"
218+
filter { "configurations:Release_AES128" }
219+
targetdir "bin/aes128/lib/release"
220+
filter { "configurations:Release_AES256" }
221+
targetdir "bin/aes256/lib/release"
211222

212223

213224
-- ICU support
214225
-- SQLite3 static library with ICU support
215-
project "sqlite3libicu"
226+
project (PRJ_NAME_LIB_ICU)
216227
language "C++"
217228
kind "StaticLib"
218229

@@ -225,7 +236,7 @@ project "sqlite3libicu"
225236
flags { "StaticRuntime" }
226237
includedirs { "3rd/include/icu" }
227238

228-
location( BUILDDIR )
239+
location( BUILDDIR.."/"..PRJ_NAME_LIB_ICU )
229240
targetname "sqlite3icu"
230241

231242
defines {
@@ -266,17 +277,17 @@ project "sqlite3libicu"
266277
}
267278

268279
-- Target directory
269-
filter { "configurations:Debug AES128" }
270-
targetdir "aes128/lib/debug"
271-
filter { "configurations:Debug AES256" }
272-
targetdir "aes256/lib/debug"
273-
filter { "configurations:Release AES128" }
274-
targetdir "aes128/lib/release"
275-
filter { "configurations:Release AES256" }
276-
targetdir "aes256/lib/release"
280+
filter { "configurations:Debug_AES128" }
281+
targetdir "bin/aes128/lib/debug"
282+
filter { "configurations:Debug_AES256" }
283+
targetdir "bin/aes256/lib/debug"
284+
filter { "configurations:Release_AES128" }
285+
targetdir "bin/aes128/lib/release"
286+
filter { "configurations:Release_AES256" }
287+
targetdir "bin/aes256/lib/release"
277288

278289
-- SQLite3 shared library with ICU support
279-
project "sqlite3dllicu"
290+
project (PRJ_NAME_DLL_ICU)
280291
language "C++"
281292
kind "SharedLib"
282293

@@ -292,21 +303,21 @@ project "sqlite3dllicu"
292303

293304
filter { "platforms:Win32" }
294305
libdirs { "./3rd/lib/icu" }
295-
filter { "platforms:Win64" }
306+
filter { "platforms:x64" }
296307
libdirs { "./3rd/lib64/icu" }
297308
filter {}
298309

299-
filter { "configurations:Debug AES128" }
300-
links { "icuind", "icuucd" }
301-
filter { "configurations:Debug AES256" }
302-
links { "icuind", "icuucd" }
303-
filter { "configurations:Release AES128" }
310+
filter { "configurations:Debug_AES128" }
311+
links { "icuin", "icuuc" }
312+
filter { "configurations:Debug_AES256" }
304313
links { "icuin", "icuuc" }
305-
filter { "configurations:Release AES256" }
314+
filter { "configurations:Release_AES128" }
315+
links { "icuin", "icuuc" }
316+
filter { "configurations:Release_AES256" }
306317
links { "icuin", "icuuc" }
307318
filter {}
308319

309-
location( BUILDDIR )
320+
location( BUILDDIR.."/"..PRJ_NAME_DLL_ICU )
310321
targetname "sqlite3icu"
311322

312323
defines {
@@ -346,17 +357,17 @@ project "sqlite3dllicu"
346357
}
347358

348359
-- Target directory
349-
filter { "configurations:Debug AES128" }
350-
targetdir "aes128/dll/debug"
351-
filter { "configurations:Debug AES256" }
352-
targetdir "aes256/dll/debug"
353-
filter { "configurations:Release AES128" }
354-
targetdir "aes128/dll/release"
355-
filter { "configurations:Release AES256" }
356-
targetdir "aes256/dll/release"
360+
filter { "configurations:Debug_AES128" }
361+
targetdir "bin/aes128/dll/debug"
362+
filter { "configurations:Debug_AES256" }
363+
targetdir "bin/aes256/dll/debug"
364+
filter { "configurations:Release_AES128" }
365+
targetdir "bin/aes128/dll/release"
366+
filter { "configurations:Release_AES256" }
367+
targetdir "bin/aes256/dll/release"
357368

358369
-- SQLite3 Shell with ICU support
359-
project "sqlite3shellicu"
370+
project (PRJ_NAME_SHELL_ICU)
360371
kind "ConsoleApp"
361372
language "C++"
362373
vpaths {
@@ -366,21 +377,22 @@ project "sqlite3shellicu"
366377
files { "src/sqlite3.h", "src/shell.c", "src/sqlite3shell.rc" }
367378
characterset ("Unicode")
368379
flags { "StaticRuntime" }
369-
links { "sqlite3libicu" }
380+
links { PRJ_NAME_LIB_ICU }
370381

371382
filter { "platforms:Win32" }
372383
libdirs { "./3rd/lib/icu" }
373-
filter { "platforms:Win64" }
384+
filter { "platforms:x64" }
374385
libdirs { "./3rd/lib64/icu" }
375386
filter {}
376387

377388
filter { "configurations:Debug*" }
378-
links { "icuind", "icuucd" }
389+
links { "icuin", "icuuc" }
379390
filter { "configurations:Release*" }
380391
links { "icuin", "icuuc" }
381392
filter {}
382393

383-
location( BUILDDIR )
394+
location( BUILDDIR.."/"..PRJ_NAME_SHELL_ICU )
395+
targetname "sqlite3shellicu"
384396

385397
defines {
386398
"SQLITE_SHELL_IS_UTF8",
@@ -389,11 +401,11 @@ project "sqlite3shellicu"
389401
}
390402

391403
-- Target directory
392-
filter { "configurations:Debug AES128" }
393-
targetdir "aes128/lib/debug"
394-
filter { "configurations:Debug AES256" }
395-
targetdir "aes256/lib/debug"
396-
filter { "configurations:Release AES128" }
397-
targetdir "aes128/lib/release"
398-
filter { "configurations:Release AES256" }
399-
targetdir "aes256/lib/release"
404+
filter { "configurations:Debug_AES128" }
405+
targetdir "bin/aes128/lib/debug"
406+
filter { "configurations:Debug_AES256" }
407+
targetdir "bin/aes256/lib/debug"
408+
filter { "configurations:Release_AES128" }
409+
targetdir "bin/aes128/lib/release"
410+
filter { "configurations:Release_AES256" }
411+
targetdir "bin/aes256/lib/release"

0 commit comments

Comments
 (0)