-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpremake5.lua
141 lines (127 loc) · 3.26 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
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
workspace "ckvs"
configurations {"Debug", "Release"}
platforms {"x86", "x64"}
language "C++"
system "windows"
cppdialect "C++17"
startproject "property_tests"
preferredtoolarchitecture "x86_64"
paths = {
ckvs = "src/ckvs/",
property_tests = "src/property_tests/",
perf_tests = "src/perf_tests/",
build = "build/",
deps = {
llfio = "deps/llfio/include/"
},
modules = 'src/',
}
settings = {
source_extensions = {".cpp", ".hpp"}
}
location(paths.build)
newaction {
trigger = "clean",
description = "Clean all generated build artifacts",
onStart = function()
os.rmdir(paths.build)
end
}
newoption {
trigger = "clang-format-path",
description = "Absolute path to the clang-format.exe. Used by the format action.",
default = "S:\\VS2019\\VC\\Tools\\Llvm\\8.0.0\\bin\\clang-format.exe",
}
newaction {
trigger = "format",
description = "Apply .clang-format style to all source files",
onStart = function()
for _, src_ext in ipairs(settings.source_extensions) do
for _, file in ipairs(os.matchfiles(paths.modules .. '**' .. src_ext)) do
print('Formatting ' .. file)
os.executef('%s -i -style=file -fallback-style=none %s', _OPTIONS['clang-format-path'], file)
end
end
end
}
local function make_common_project_conf(src_path, use_pch)
if use_pch then
pchheader "pch.h"
pchsource (src_path .. "pch.cpp")
end
flags { "FatalWarnings", "MultiProcessorCompile" }
includedirs{src_path, paths.build}
for _, path in pairs(paths.deps) do
includedirs(path)
end
basedir (src_path)
targetdir (paths.build .. "bin_%{cfg.architecture}")
objdir (paths.build .. "obj")
for _, src_ext in ipairs(settings.source_extensions) do
files { src_path .. "**" .. src_ext}
end
files { src_path .. "**.natvis" }
linkoptions { "-IGNORE:4221" }
filter "platforms:x86"
architecture "x86"
filter "platforms:x64"
architecture "x86_64"
filter "configurations:Debug"
symbols "On"
runtime "Debug"
defines
{
"DEBUG",
-- "VERBOSE_TEST"
}
targetsuffix "_d"
filter "configurations:Release"
warnings "Extra"
symbols "Off"
symbols "FastLink"
defines
{
"NDEBUG",
"BOOST_DISABLE_ASSERTS",
}
flags {"NoBufferSecurityCheck", "LinkTimeOptimization"}
buildoptions {"/GR-"
}
runtime "Release"
optimize "Full"
filter {}
defines
{
-- "ASSERTS",
-- todo: move to msvc only
"CHECK_LEAKS",
"_ENABLE_EXTENDED_ALIGNED_STORAGE", -- fix msvc bug
"_CRT_SECURE_NO_WARNINGS",
"_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS", -- llfio
}
disablewarnings
{
"4324", -- msvc likes to warn about the padding being present...
}
end
project "ckvs"
kind "StaticLib"
defines
{
"_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING",
}
make_common_project_conf(paths.ckvs)
project "property_tests"
kind "ConsoleApp"
links { "ckvs" }
defines
{
-- 'ENABLE_SSD_TEST',
'SSD_PAGED_FILE_PATH=R"(C:\\test.ckvs)"',
-- 'ENABLE_HDD_TEST',
'HDD_PAGED_FILE_PATH=R"(D:\\test.ckvs)"',
'ENABLE_RAM_TEST', -- ram drive
'RAM_PAGED_FILE_PATH=R"(R:\\test.ckvs)"',
}
includedirs {paths.ckvs}
make_common_project_conf(paths.property_tests)