-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.cpp
More file actions
64 lines (55 loc) · 2.62 KB
/
Copy pathbuild.cpp
File metadata and controls
64 lines (55 loc) · 2.62 KB
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
#include <builder.h>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <string>
// Absolute path to the directory containing build.cpp (i.e. the project root).
static const std::string k_ProjectRoot = []() {
std::string p = __FILE__;
auto slash = p.find_last_of("/\\");
return slash != std::string::npos ? p.substr(0, slash) : ".";
}();
static const std::string k_ResourceRes = k_ProjectRoot + "\\resource.res";
BUILDER_CALLBACK void SetBuilderOptions( BuilderOptions* options, CommandLineArgs* args ) {
bool release = HasCommandLineArg( args, "--release" );
bool incremental = HasCommandLineArg( args, "--incremental" );
options->forceRebuild = !incremental;
const char* binFolder = release ? "bin/release" : "bin/debug";
OptimizationLevel optimizationLevel = release ? OPTIMIZATION_LEVEL_O3 : OPTIMIZATION_LEVEL_O0;
std::vector<std::string> defines;
defines.push_back( release ? "NDEBUG" : "_DEBUG" );
defines.push_back( "VK_USE_PLATFORM_WIN32_KHR" );
std::string vulkanSDKPath = getenv("VULKAN_SDK");
std::string vulkanSDKInclude = vulkanSDKPath + "/Include";
std::string vulkanSDKLib = vulkanSDKPath + "/Lib";
BuildConfig imguiConfig = {
.name = "ImGui",
.binaryName = "imgui",
.binaryFolder = binFolder,
.sourceFiles = { "3rdparty/imgui/*.cpp" },
.defines = { defines },
.additionalIncludes = { "3rdparty/imgui", "3rdparty/imgui/backends", vulkanSDKInclude },
.optimizationLevel = optimizationLevel,
.binaryType = BINARY_TYPE_STATIC_LIBRARY,
.languageVersion = LANGUAGE_VERSION_CPP20,
.removeSymbols = release,
};
BuildConfig appConfig = {
.name = "ImOpen",
.binaryName = "ImOpen",
.binaryFolder = binFolder,
.sourceFiles = { "src/*.cpp" },
.defines = { defines },
.additionalIncludes = { "include", "3rdparty", "3rdparty/imgui", "3rdparty/imgui/backends", vulkanSDKInclude },
.additionalLibPaths = { vulkanSDKLib, binFolder },
.additionalLibs = { "vulkan-1", "user32", "gdi32", "dwmapi", "shell32", "imm32", "ole32", "uuid", "advapi32", "imgui"},
.additionalLinkerArguments = release
? std::vector<std::string>{ k_ResourceRes, "/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup" }
: std::vector<std::string>{ k_ResourceRes },
.optimizationLevel = optimizationLevel,
.languageVersion = LANGUAGE_VERSION_CPP20,
.removeSymbols = release,
.dependsOn = { imguiConfig }
};
AddBuildConfig( options, &appConfig );
}