Skip to content

Commit

Permalink
Merge pull request #134 from nelhage/fix-windows-ci
Browse files Browse the repository at this point in the history
Add Windows CI build
  • Loading branch information
nelhage authored Sep 25, 2019
2 parents a1dd05e + 4daad87 commit 2e93574
Show file tree
Hide file tree
Showing 10 changed files with 1,618 additions and 44 deletions.
17 changes: 8 additions & 9 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ tasks:
- "..."
test_targets:
- "..."

# Disable the Windows build for now; I don't have the time or
# expertise to fix this.
# windows:
# working_directory: test
# build_targets:
# - "..."
# test_targets:
# - "..."
windows:
working_directory: test
environment:
BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC"
build_targets:
- "..."
test_targets:
- "..."
5 changes: 5 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
exports_files([
"config.lzma-linux.h",
"config.lzma-osx.h",
"config.lzma-windows.h",
])
81 changes: 62 additions & 19 deletions BUILD.boost
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ config_setting(
visibility = ["//visibility:public"],
)

# TODO(https://github.com/bazelbuild/bazel-skylib/issues/191): use
# expand_template instead of `sed`.
[genrule(
name = "clean_%s_asm" % name,
outs = [
"libs/context/src/asm/%s_x86_64_ms_pe_masm_clean.asm" % name,
],
cmd = "sed 's/BOOST_CONTEXT_EXPORT//' $< > $@",
srcs = [
"libs/context/src/asm/%s_x86_64_ms_pe_masm.asm" % name,
],
) for name in ["make", "jump", "ontop"]]

BOOST_CTX_ASM_SOURCES = select({
":linux_arm": [
"libs/context/src/asm/jump_arm_aapcs_elf_gas.S",
Expand All @@ -99,9 +112,9 @@ BOOST_CTX_ASM_SOURCES = select({
"libs/context/src/asm/ontop_x86_64_sysv_macho_gas.S",
],
":windows_x86_64": [
"libs/context/src/asm/make_x86_64_ms_pe_masm.asm",
"libs/context/src/asm/jump_x86_64_ms_pe_masm.asm",
"libs/context/src/asm/ontop_x86_64_ms_pe_masm.asm",
"libs/context/src/asm/make_x86_64_ms_pe_masm_clean.asm",
"libs/context/src/asm/jump_x86_64_ms_pe_masm_clean.asm",
"libs/context/src/asm/ontop_x86_64_ms_pe_masm_clean.asm",
],
})

Expand Down Expand Up @@ -914,24 +927,53 @@ boost_library(
name = "limits",
)

boost_library(
name = "locale",
srcs =
glob(
[
"libs/locale/src/**/*.cpp",
"libs/locale/src/**/*.hpp",
"libs/locale/src/**/*.ipp",
],
exclude = [
"libs/locale/src/win32/*.cpp",
"libs/locale/src/icu/*.cpp",
],
),
copts = [
BOOST_LOCALE_COMMON_SOURCES = glob([
"libs/locale/src/encoding/*.cpp",
"libs/locale/src/encoding/*.hpp",
"libs/locale/src/encoding/*.ipp",
"libs/locale/src/shared/*.cpp",
"libs/locale/src/shared/*.hpp",
"libs/locale/src/std/*.cpp",
"libs/locale/src/std/*.hpp",
"libs/locale/src/util/*.cpp",
"libs/locale/src/util/*.hpp",
], exclude=[
"libs/locale/src/util/iconv.hpp",
])

BOOST_LOCALE_POSIX_SOURCES = BOOST_LOCALE_COMMON_SOURCES + [
"libs/locale/src/util/iconv.hpp",
] + glob([
"libs/locale/src/posix/*.cpp",
"libs/locale/src/posix/*.hpp",
])

BOOST_LOCALE_WIN32_SOURCES = BOOST_LOCALE_COMMON_SOURCES + glob([
"libs/locale/src/win32/*.cpp",
"libs/locale/src/win32/*.hpp",
])

BOOST_LOCALE_POSIX_COPTS = [
"-DBOOST_LOCALE_WITH_ICONV",
"-DBOOST_LOCALE_NO_WINAPI_BACKEND",
] + _w_no_deprecated,
]

BOOST_LOCALE_WIN32_COPTS = []

boost_library(
name = "locale",
srcs = select({
":linux_arm": BOOST_LOCALE_POSIX_SOURCES,
":linux_x86_64": BOOST_LOCALE_POSIX_SOURCES,
":osx_x86_64": BOOST_LOCALE_POSIX_SOURCES,
":windows_x86_64": BOOST_LOCALE_WIN32_SOURCES,
}),
copts = select({
":linux_arm": BOOST_LOCALE_POSIX_COPTS,
":linux_x86_64": BOOST_LOCALE_POSIX_COPTS,
":osx_x86_64": BOOST_LOCALE_POSIX_COPTS,
":windows_x86_64": BOOST_LOCALE_WIN32_COPTS,
}) + _w_no_deprecated,
deps = [
":assert",
":config",
Expand Down Expand Up @@ -1564,6 +1606,7 @@ boost_library(
":osx_x86_64": [],
":windows_x86_64": [
"BOOST_ALL_NO_LIB",
"BOOST_THREAD_BUILD_LIB",
"BOOST_THREAD_USE_LIB",
"BOOST_WIN32_THREAD",
],
Expand Down
39 changes: 25 additions & 14 deletions BUILD.lzma
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,31 @@
# lzma is a general purpose data compression library https://tukaani.org/xz/
# Public Domain

# Generate config.h
genrule(
name = "configure_lzma",
outs = [
"config.h",
],
cmd = "cd external/org_lzma_lzma && ./configure > /dev/null && cp config.h ../../$(location config.h)",
tools = [
"configure",
"src/liblzma/common/common.h",
] + glob([
"build-aux/*",
"**/*.in",
]),
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")

config_setting(
name = "linux",
constraint_values = ["@bazel_tools//platforms:linux"],
)

config_setting(
name = "osx",
constraint_values = ["@bazel_tools//platforms:osx"],
)

config_setting(
name = "windows",
constraint_values = ["@bazel_tools//platforms:windows"],
)

copy_file(
name = "copy_config",
src = select({
":linux": "@com_github_nelhage_rules_boost//:config.lzma-linux.h",
":osx": "@com_github_nelhage_rules_boost//:config.lzma-osx.h",
":windows": "@com_github_nelhage_rules_boost//:config.lzma-windows.h",
}),
out = "config.h",
)

cc_library(
Expand Down
10 changes: 10 additions & 0 deletions boost/boost.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ def boost_library(
)

def boost_deps():
if "bazel_skylib" not in native.existing_rules():
http_archive(
name = "bazel_skylib",
sha256 = "1dde365491125a3db70731e25658dfdd3bc5dbdfd11b840b3e987ecf043c7ca0",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/0.9.0/bazel_skylib-0.9.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/0.9.0/bazel_skylib-0.9.0.tar.gz",
],
)

if "net_zlib_zlib" not in native.existing_rules():
http_archive(
name = "net_zlib_zlib",
Expand Down
Loading

0 comments on commit 2e93574

Please sign in to comment.