-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathpremake4.lua
115 lines (99 loc) · 3.99 KB
/
premake4.lua
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
if not dofile 'premake_config.lua' then
return
end
if _ACTION == "clean" then
os.rmdir("build")
return
elseif not _ACTION then
return
end
solution "XWord"
configurations(get_configurations())
-- Output for premake4 (vs projects / makefiles, etc)
location ("build/" .. _ACTION)
-- Output for compiled files
configuration "Debug"
targetdir "bin/Debug"
configuration "Release"
targetdir "bin/Release"
-- --------------------------------------------------------------------
-- Debug / Release
-- --------------------------------------------------------------------
configuration "Release"
defines { "NDEBUG" }
optimize "On"
libdirs { "bin/Release" }
if not _OPTIONS["disable-lua"] then
libdirs { "lib/Release" }
end
configuration "Debug"
defines { "DEBUG", "_DEBUG" }
symbols "On"
libdirs { "bin/Debug" }
if not _OPTIONS["disable-lua"] then
libdirs { "lib/Debug" }
end
-- --------------------------------------------------------------------
-- Platform-specific
-- --------------------------------------------------------------------
configuration "windows"
architecture "x32"
defines { "WIN32", "_WINDOWS" }
prebuildcommands {
[[if not exist "..\..\bin\$(ConfigurationName)" mkdir "..\..\bin\$(ConfigurationName)"]],
[[if not exist "..\..\bin\$(ConfigurationName)\scripts" mklink /j "..\..\bin\$(ConfigurationName)\scripts" "..\..\scripts"]],
[[if not exist "..\..\bin\$(ConfigurationName)\images" mklink /j "..\..\bin\$(ConfigurationName)\images" "..\..\images"]],
[[if not exist "..\..\bin\$(ConfigurationName)\default_config.ini" copy "..\..\default_config.ini" "..\..\bin\$(ConfigurationName)\" ]],
}
configuration "macosx"
architecture "x64"
systemversion "10.10"
buildoptions { "-stdlib=libc++" }
linkoptions { "-stdlib=libc++", "-L/usr/local/lib" }
configuration "linux"
architecture "x64"
-- ------------------------------------------------------------------------
-- General
-- ------------------------------------------------------------------------
configuration {}
include "src" -- the XWord premake file
include "puz" -- the puzzle library
include "yajl"
include "yaml"
if not _OPTIONS["disable-lua"] then
include "lua" -- lua libraries
end
-- Mac stuff
if os.istarget("macosx") then
-- Find a value in project.blocks
local function get_key(p, k)
if p[k] then return p[k] end
for _, block in ipairs(p.blocks) do
if block[k] then
return block[k]
end
end
end
for _, p in pairs(solution().projects) do
-- Put shared libs in XWord.app/Contents/Frameworks
if get_key(p, "kind") == "SharedLib" then
project(p.name)
-- Set the output to the app bundle
configuration { "macosx", "Debug" }
targetdir "bin/Debug/XWord.app/Contents/Frameworks"
configuration { "macosx", "Release" }
targetdir "bin/Release/XWord.app/Contents/Frameworks"
configuration { "macosx" }
-- Set the install name
linkoptions{ "-install_name @executable_path/../Frameworks/lib"..(get_key(p, "targetname") or p.name)..".dylib" }
elseif get_key(p, "kind") == "WindowedApp" then
project(p.name)
if not _OPTIONS["disable-lua"] then
-- Requirement for 64-bit OS X applications linking against LuaJIT.
-- See http://luajit.org/install.html
configuration { "macosx" }
linkoptions { "-pagezero_size 10000 -image_base 100000000" }
end
end
end
end