-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathSConstruct
126 lines (95 loc) · 3.43 KB
/
SConstruct
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
# ----------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------
import os
import sys
import re
# ----------------------------------------------------------------------------
# C/C++ Defines
# ----------------------------------------------------------------------------
cppBaseDefines = {
"_CRT_SECURE_NO_WARNINGS" : "1",
}
cppDebugDefines = {
"DEBUG" : "1",
}
cppNoDebugDefines = {
}
# ----------------------------------------------------------------------------
# C/C++ Compiler Options
# ----------------------------------------------------------------------------
# Documentation on Visual C++ Compiler Options can be found here:
# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_compiler_reference.asp
ccBaseFlags = [
"/EHsc", # Synchronous exception handling, assume extern C functions
# never throw exceptions.
"/W4", # Treat all warnings as errors
"/nologo", # Suppress display of sign-on banner
"/analyze"
]
ccDebugFlags = [
"/MT", # Use dynamically-linked msvcrt for C runtime
"/Zi", # Produce a program database (PDB) that contains type
"/Od", # Disable optimization
]
ccNoDebugFlags = [
"/O2", # Enable optimizations
"/MT", # Use dynamically-linked msvcrt for C runtime
"/Ob1", # Inline expansion only for functions marked as inline
"/GF", # Pool strings as read-only
"/Gy", # Enable function-level linking
]
# ----------------------------------------------------------------------------
# C/C++ Linker Options
# ----------------------------------------------------------------------------
linkBaseFlags = [
"/nologo",
]
linkDebugFlags = [
"/DEBUG", # Create .pdb file containing debugging information
]
linkNoDebugFlags = [
]
# ----------------------------------------------------------------------------
# Base Environment Definition
# ----------------------------------------------------------------------------
baseEnv = Environment(
# Standard environment variables used by SCons.
CPPDEFINES = cppBaseDefines,
CCFLAGS = ccBaseFlags,
LINKFLAGS = linkBaseFlags,
TARGET_ARCH = "x86",
DEBUG = 0
)
# ----------------------------------------------------------------------------
# Debug/Non-Debug Environments
# ----------------------------------------------------------------------------
# Take the base environment and create specialized debug and non-debug
# environments out of them.
debugEnv = baseEnv.Clone()
noDebugEnv = baseEnv.Clone()
debugEnv.Append(
CPPDEFINES = cppDebugDefines,
CCFLAGS = ccDebugFlags,
LINKFLAGS = linkDebugFlags
)
noDebugEnv.Append(
CPPDEFINES = cppNoDebugDefines,
CCFLAGS = ccNoDebugFlags,
LINKFLAGS = linkNoDebugFlags
)
# Depending on whether we're building for debugging or release, set
# the active environment to the debug or non-debug environment.
if baseEnv["DEBUG"] == 1:
env = debugEnv
else:
env = noDebugEnv
# ----------------------------------------------------------------------------
# Build Actions
# ----------------------------------------------------------------------------
target = env.Program(
target = "AudioSwitch",
source = ["AudioSwitch.cpp", "AudioPlaybackControl.cpp", env.RES('AudioSwitch.rc')],
LIBS = ["gdi32.lib", "user32.lib", "ole32.lib"]
)
env.Default(target)