-
Notifications
You must be signed in to change notification settings - Fork 0
/
premake5.lua
113 lines (84 loc) · 3.76 KB
/
premake5.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
--[[
MIT License
Copyright (c) 2016-2022 Raúl Ramos
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--]]
workspace "tutorial-dll-tracker"
language "C++"
cppdialect "C++17"
configurations { "Debug", "Release" }
platforms { "x64", }
location ".build"
flags { "FatalCompileWarnings", "FatalLinkWarnings" }
filter { "configurations:Debug" } defines { "DEBUG" } symbols "On"
filter { "configurations:Release" } defines { "NDEBUG" } optimize "Speed"
filter { "platforms:*64" } architecture "x86_64"
filter { "system:macosx", "action:gmake" } toolset "clang"
filter { "system:windows", "action:vs*" } buildoptions { "/W3", "/EHsc" }
filter { "system:linux" } links "pthread"
filter { "toolset:clang or toolset:gcc" } buildoptions { "-Wall", "-Wextra", "-fno-exceptions", "-msse4.2" }
startproject "launcher"
project "foo"
kind "SharedLib"
includedirs { "src/common" }
targetdir ".out/%{cfg.platform}/%{cfg.buildcfg}"
objdir ".tmp/%{prj.name}"
files { "src/foo/*.cpp", "src/foo/*.h" }
project "bar"
kind "SharedLib"
includedirs { "src/common" }
targetdir ".out/%{cfg.platform}/%{cfg.buildcfg}"
objdir ".tmp/%{prj.name}"
files { "src/bar/*.cpp", "src/bar/*.h" }
project "launcher"
dependson { "foo", "bar", ... }
kind "ConsoleApp"
includedirs { "src/foo", "src/bar", "src/" }
targetdir ".out/%{cfg.platform}/%{cfg.buildcfg}"
objdir ".tmp/%{prj.name}"
files { "src/qcstudio/*", "src/launcher/*" }
-- Handle Dropbox annoying sync of temporary folders
print("[] Excluding .build, .tmp and .out from Dropbox sync...");
if os.target() == "windows" then
-- Do not allow Dropbox to sync these temporary folders
local script = [[
New-Item .build -type directory -force | Out-Null
New-Item .tmp -type directory -force | Out-Null
New-Item .out -type directory -force | Out-Null
Set-Content -Path '.build' -Stream com.dropbox.ignored -Value 1
Set-Content -Path '.tmp' -Stream com.dropbox.ignored -Value 1
Set-Content -Path '.out' -Stream com.dropbox.ignored -Value 1
]]
-- Feed the script to powershell process stdin
local pipe = io.popen("powershell -command -", "w")
pipe:write(script)
pipe:close()
elseif os.target() == "macosx" then
-- Do not allow Dropbox to sync these temporary folders
local script = [[
mkdir -p .build
mkdir -p .tmp
mkdir -p .out
xattr -w com.dropbox.ignored 1 .build
xattr -w com.dropbox.ignored 1 .tmp
xattr -w com.dropbox.ignored 1 .out
]]
-- Run the script
local pipe = io.popen("bash", "w")
pipe:write(script)
pipe:close()
end