summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Moody <dmoody256@gmail.com>2022-09-24 01:22:11 -0500
committerDaniel Moody <dmoody256@gmail.com>2022-09-24 01:22:11 -0500
commit91357ed83beb54f2ddd825f80c6b390a79ce448c (patch)
treed63377341a843e167871e4c3031450aec62ca7a3
parent9235f72aa0f68d3763202b8cb2fb3ebc63b14b72 (diff)
downloadmongo-91357ed83beb54f2ddd825f80c6b390a79ce448c.tar.gz
building on windows
-rwxr-xr-xSConstruct2
-rw-r--r--src/third_party/SConscript3
-rw-r--r--src/third_party/gperftools/SConscript3
-rw-r--r--src/third_party/grpc/SConscript17
-rw-r--r--src/third_party/protobuf/SConscript34
5 files changed, 46 insertions, 13 deletions
diff --git a/SConstruct b/SConstruct
index 67e0c2f4498..725297b2a48 100755
--- a/SConstruct
+++ b/SConstruct
@@ -1331,7 +1331,7 @@ env_vars.Add(
env_vars.Add(
'PROTOC',
- default="$DESTDIR/bin/protoc",
+ default="$DESTDIR/bin/protobuf_compiler$PROGSUFFIX",
help='Path to protobuf compiler.',
)
diff --git a/src/third_party/SConscript b/src/third_party/SConscript
index 6049af931a6..1602d45baf9 100644
--- a/src/third_party/SConscript
+++ b/src/third_party/SConscript
@@ -42,7 +42,8 @@ thirdPartyEnvironmentModifications = {
"/include",
],
'FORCEINCLUDES': ['js-config.h', ],
- }
+ },
+ 'zlib': {'CPPPATH': ['#/src/third_party/zlib'], },
}
diff --git a/src/third_party/gperftools/SConscript b/src/third_party/gperftools/SConscript
index 21ec1fb90f0..5e41c8c1be6 100644
--- a/src/third_party/gperftools/SConscript
+++ b/src/third_party/gperftools/SConscript
@@ -77,7 +77,8 @@ if env.TargetOSIs('windows'):
# warning C4141: 'inline': used more than once
# warning C4305: 'argument': truncation from 'ssize_t' to 'double'
- env.Append(CXXFLAGS=["/wd4141", "/wd4305"])
+ # warning C4003: not enough arguments for function-like macro invocation
+ env.Append(CXXFLAGS=["/wd4141", "/wd4305", '/wd4003'])
else:
files += [
diff --git a/src/third_party/grpc/SConscript b/src/third_party/grpc/SConscript
index d134bdbc408..eb2176aba56 100644
--- a/src/third_party/grpc/SConscript
+++ b/src/third_party/grpc/SConscript
@@ -4,6 +4,20 @@ import os
grpc_env = env.Clone()
+if grpc_env.ToolchainIs('gcc', 'clang'):
+ grpc_env.Append(
+ CCFLAGS=[
+ '-Wno-sign-compare',
+ ],
+ )
+
+if grpc_env.ToolchainIs('msvc'):
+ grpc_env.Append(
+ CPPDEFINES=[
+ '_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING',
+ ],
+ )
+
grpc_root = grpc_env.Dir(".").srcnode()
upb_env = grpc_env.Clone()
@@ -13,9 +27,6 @@ upb_env.Append(
grpc_root.Dir('dist/src/core/ext/upb-generated'),
grpc_root.Dir('dist/src/core/ext/upbdefs-generated'),
],
- CCFLAGS=[
- '-Wno-sign-compare',
- ],
)
upb_source = [
diff --git a/src/third_party/protobuf/SConscript b/src/third_party/protobuf/SConscript
index 6149d0e726c..2f356aef6e0 100644
--- a/src/third_party/protobuf/SConscript
+++ b/src/third_party/protobuf/SConscript
@@ -2,20 +2,40 @@ Import('env')
protobuf_env = env.Clone()
+protobuf_env.InjectThirdParty(libraries=['zlib'])
+
protobuf_env.Append(
CPPDEFINES=[
'HAVE_CONFIG_H',
- ('HAVE_PTHREAD', '1'),
('HAVE_ZLIB', '1'),
('PIC', '1'),
],
- CCFLAGS=[
- '-Wno-sign-compare',
- '-Wno-overloaded-virtual',
- '-Wno-stringop-overflow',
- ],
)
+if protobuf_env.ToolchainIs('gcc', 'clang'):
+ protobuf_env.Append(
+ CPPDEFINES=[
+ ('HAVE_PTHREAD', '1'),
+ ],
+ CCFLAGS=[
+ '-Wno-sign-compare',
+ '-Wno-overloaded-virtual',
+ '-Wno-stringop-overflow',
+ ],
+ )
+
+if protobuf_env.ToolchainIs('msvc'):
+ protobuf_env.Append(
+ CCFLAGS=[
+ '/wd4018', # signed/unsigned mismatch
+ '/wd4065', # switch statement contains 'default' but no 'case' labels
+ '/wd4146', # unary minus operator applied to unsigned type, result still unsigned
+ ],
+ CPPDEFINES=[
+ '_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING',
+ ],
+ )
+
protobuf_root = protobuf_env.Dir(".").srcnode()
protobuf_platform = protobuf_root.Dir("platform/${TARGET_OS}_${TARGET_ARCH}")
protobuf_env.Append(
@@ -206,7 +226,7 @@ protobuf_env.Library(
)
protobuf_env.Program(
- target='protoc',
+ target='protobuf_compiler',
source=['dist/src/google/protobuf/compiler/main.cc'],
LIBDEPS=[
'protobuf',