[BUILD] Initial BAZEL setup
This commit is contained in:
parent
87e7c7d202
commit
1d6ddc803e
17
.clwb/.bazelproject
Normal file
17
.clwb/.bazelproject
Normal file
|
@ -0,0 +1,17 @@
|
|||
directories:
|
||||
# Add the directories you want added as source here
|
||||
# By default, we've added your entire workspace ('.')
|
||||
.
|
||||
|
||||
# Automatically includes all relevant targets under the 'directories' above
|
||||
derive_targets_from_directories: true
|
||||
|
||||
targets:
|
||||
# If source code isn't resolving, add additional targets that compile it here
|
||||
|
||||
additional_languages:
|
||||
# Uncomment any additional languages you want supported
|
||||
# dart
|
||||
# javascript
|
||||
# python
|
||||
# typescript
|
8
.clwb/.idea/.gitignore
vendored
Normal file
8
.clwb/.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
25
.github/workflows/build.yml
vendored
25
.github/workflows/build.yml
vendored
|
@ -16,29 +16,29 @@ jobs:
|
|||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
||||
- name: Install bazelisk
|
||||
run: |
|
||||
choco install bazelisk
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
|
||||
- name: setup nuget
|
||||
uses: NuGet/setup-nuget@v1.0.6
|
||||
|
||||
- name: restore project packages
|
||||
run: nuget restore umbra.sln
|
||||
|
||||
- name: build
|
||||
run: msbuild /m /p:Configuration=Debug umbra.sln
|
||||
- name: Build
|
||||
run: |
|
||||
bazel build //...
|
||||
|
||||
- name: use cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: "./bin/Debug"
|
||||
path: "./bazel-bin/projs"
|
||||
key: ${{ runner.os }}-${{ github.run_id }}
|
||||
|
||||
- name: Upload shadow-engine artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ needs.update.outputs.old_version_name }}-${{ needs.update.outputs.new_version_name }}-patch
|
||||
path: './bin/Debug/shadow-engine/**/*'
|
||||
path: './bazel-bin/projs/shadow-engine/**/*'
|
||||
|
||||
test-sff:
|
||||
runs-on: windows-latest
|
||||
|
@ -52,11 +52,11 @@ jobs:
|
|||
- name: use cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: "./bin/Debug"
|
||||
path: "./bazel-bin/projs"
|
||||
key: ${{ runner.os }}-${{ github.run_id }}
|
||||
|
||||
- name: Test shadow-file-format
|
||||
run: ./bin/Debug/shadow-file-format-test/shadow-file-format-test.exe --gtest_output="xml:./test-results/shadow-file-format-test.xml"
|
||||
run: ./bazel-bin/projs/shadow-file-format/test.exe --gtest_output="xml:./test-results/shadow-file-format-test.xml"
|
||||
|
||||
- name: Publish Test Results
|
||||
uses: EnricoMi/publish-unit-test-result-action/composite@v1
|
||||
|
@ -64,4 +64,3 @@ jobs:
|
|||
with:
|
||||
files: "test-results/**/*.xml"
|
||||
|
||||
|
7
WORKSPACE
Normal file
7
WORKSPACE
Normal file
|
@ -0,0 +1,7 @@
|
|||
workspace(
|
||||
name = "umbra",
|
||||
)
|
||||
|
||||
load("//vendor:deps.bzl", "deps")
|
||||
|
||||
deps()
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn" version="1.8.1.5" targetFramework="native" />
|
||||
</packages>
|
|
@ -1,119 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="../../Umbra.CPP.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{3b7d6797-cc0c-43fa-8866-f438032e1c67}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<ProjectName>shadow-file-format-test</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<ImportGroup Label="Shared" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\projs\shadow-file-format\src\; %(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="test.cpp" />
|
||||
<ClCompile Include="sff_writer_tests.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\shadow-file-format\shadow-file-format.vcxproj">
|
||||
<Project>{b2e3515c-3fe0-44b9-9abe-8584a836230f}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.5\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets" Condition="Exists('..\..\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.5\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets')" />
|
||||
</ImportGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>X64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PreprocessorDefinitions>X64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.5\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.5\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
31
projs/shadow-file-format/BUILD
Normal file
31
projs/shadow-file-format/BUILD
Normal file
|
@ -0,0 +1,31 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
|
||||
cc_library(
|
||||
name = "shadow-file-format",
|
||||
srcs = glob(["src/**/*.cpp", "src/**/*.h"]),
|
||||
hdrs = glob(["src/**/*.h"]),
|
||||
strip_include_prefix = "src/",
|
||||
includes = [],
|
||||
copts = [
|
||||
"/std:c++17"
|
||||
],
|
||||
deps = [
|
||||
"//projs/shadow-utility"
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "test",
|
||||
srcs = glob(["test/**/*.cpp", "test/**/*.h"]),
|
||||
includes = [],
|
||||
copts = [
|
||||
"/std:c++17"
|
||||
],
|
||||
deps = [
|
||||
"//projs/shadow-file-format",
|
||||
"@gtest//:gtest",
|
||||
"@gtest//:gtest_main"
|
||||
],
|
||||
)
|
|
@ -1,5 +1,5 @@
|
|||
#include "pch.h"
|
||||
#include "../shadow-file-format/src/SFFParser.h"
|
||||
#include "SFFParser.h"
|
||||
|
||||
//import Shadow.FileFormat;
|
||||
|
||||
|
@ -32,16 +32,7 @@ Assets:{ \
|
|||
}, \
|
||||
";
|
||||
|
||||
std::string example_multi_level_content = "ShadowFileFormat_1_0_0 \n\
|
||||
Assets:{ \
|
||||
a: { \
|
||||
0: ContentContent0, \
|
||||
1: ContentContent1, \
|
||||
2: ContentContent2, \
|
||||
}, \
|
||||
b: ContentB, \
|
||||
}, \
|
||||
";
|
||||
|
||||
|
||||
std::stringstream streamFrom(std::string str) {
|
||||
std::stringstream ss;
|
||||
|
@ -209,6 +200,16 @@ TEST(MultiRoot, RootsHaveCorrectName) {
|
|||
EXPECT_EQ(texture->name, "Texture");
|
||||
}
|
||||
|
||||
std::string example_multi_level_content = "ShadowFileFormat_1_0_0 \n\
|
||||
Assets:{ \
|
||||
a: { \
|
||||
0: ContentContent0, \
|
||||
1: ContentContent1, \
|
||||
2: ContentContent2, \
|
||||
}, \
|
||||
b: ContentB, \
|
||||
}, \
|
||||
";
|
||||
|
||||
TEST(MultiLevelContent, RootsHaveCorrectName) {
|
||||
|
||||
|
@ -220,6 +221,7 @@ TEST(MultiLevelContent, RootsHaveCorrectName) {
|
|||
|
||||
EXPECT_NE(assets, nullptr);
|
||||
EXPECT_EQ(assets->name, "Assets");
|
||||
EXPECT_EQ(assets->isBlock, true);
|
||||
|
||||
auto first = assets->GetChildByName("a");
|
||||
|
15
projs/shadow-utility/BUILD
Normal file
15
projs/shadow-utility/BUILD
Normal file
|
@ -0,0 +1,15 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
cc_library(
|
||||
name = "shadow-utility",
|
||||
srcs = glob(["**/*.cpp", "**/*.h"]),
|
||||
hdrs = glob(["**/*.h"]),
|
||||
strip_include_prefix = "src/",
|
||||
includes = [],
|
||||
copts = [
|
||||
"/std:c++20"
|
||||
],
|
||||
deps = [
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
0
vendor/BUILD
vendored
Normal file
0
vendor/BUILD
vendored
Normal file
10
vendor/deps.bzl
vendored
Normal file
10
vendor/deps.bzl
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
load("//vendor/sdl2:sdl2-dep.bzl", "sdl2_dep")
|
||||
load("//vendor/gtest:gtest-dep.bzl", "gtest_dep")
|
||||
#load("//vendor/imgui:imgui_lib.bzl", "imgui_lib")
|
||||
load("//vendor/glm:glm-dep.bzl", "glm_dep")
|
||||
|
||||
def deps():
|
||||
sdl2_dep()
|
||||
gtest_dep()
|
||||
# imgui_lib()
|
||||
glm_dep()
|
0
vendor/glm/BUILD
vendored
Normal file
0
vendor/glm/BUILD
vendored
Normal file
10
vendor/glm/glm-dep.bzl
vendored
Normal file
10
vendor/glm/glm-dep.bzl
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
|
||||
|
||||
def glm_dep():
|
||||
if "glm_lib" not in native.existing_rules():
|
||||
new_git_repository(
|
||||
name = "glm_lib",
|
||||
remote = "https://github.com/g-truc/glm.git",
|
||||
commit = "658d8960d081e0c9c312d49758c7ef919371b428",
|
||||
build_file = Label("//vendor/glm:glm.BUILD"),
|
||||
)
|
12
vendor/glm/glm.BUILD
vendored
Normal file
12
vendor/glm/glm.BUILD
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
cc_library(
|
||||
name = "glm",
|
||||
hdrs = glob([
|
||||
"glm/*.hpp",
|
||||
"glm/**/*.hpp",
|
||||
]),
|
||||
includes = ["glm"],
|
||||
textual_hdrs = glob(["glm/**/*.inl"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
0
vendor/gtest/BUILD
vendored
Normal file
0
vendor/gtest/BUILD
vendored
Normal file
10
vendor/gtest/gtest-dep.bzl
vendored
Normal file
10
vendor/gtest/gtest-dep.bzl
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||
|
||||
|
||||
def gtest_dep():
|
||||
if "gtest" not in native.existing_rules():
|
||||
git_repository(
|
||||
name = "gtest",
|
||||
remote = "https://github.com/google/googletest",
|
||||
branch = "v1.10.x",
|
||||
)
|
14
vendor/gtest/gtest.BUILD
vendored
Normal file
14
vendor/gtest/gtest.BUILD
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
cc_library(
|
||||
name = "gtest_main",
|
||||
srcs = glob(
|
||||
["src/*.cc"],
|
||||
exclude = ["src/gtest-all.cc"]
|
||||
),
|
||||
hdrs = glob([
|
||||
"include/**/*.h",
|
||||
"src/*.h"
|
||||
]),
|
||||
copts = ["-Iexternal/gtest/include"],
|
||||
linkopts = ["-pthread"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
0
vendor/sdl2/BUILD
vendored
Normal file
0
vendor/sdl2/BUILD
vendored
Normal file
14
vendor/sdl2/sdl2-dep.bzl
vendored
Normal file
14
vendor/sdl2/sdl2-dep.bzl
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
VERSION = "2.0.22"
|
||||
URL_TOOLCHAIN = "https://www.libsdl.org/release/SDL2-devel-2.0.22-mingw.zip"
|
||||
|
||||
def sdl2_dep():
|
||||
if "sdl2" not in native.existing_rules():
|
||||
http_archive(
|
||||
name = "sdl2",
|
||||
build_file = Label("//vendor/sdl2:sdl2.BUILD"),
|
||||
url = URL_TOOLCHAIN,
|
||||
strip_prefix = "SDL2-2.0.22",
|
||||
sha256 = "18b3da2b3b5f1e802e0abbe99004d7404848755bbfe5153cd9dfcfc0a9522632",
|
||||
)
|
56
vendor/sdl2/sdl2.BUILD
vendored
Normal file
56
vendor/sdl2/sdl2.BUILD
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
alias(
|
||||
name = "windows",
|
||||
actual = "@bazel_tools//src/conditions:windows"
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "macos",
|
||||
actual = "@bazel_tools//src/conditions:darwin_x86_64"
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "linux",
|
||||
actual = "@bazel_tools//src/conditions:linux_x86_64"
|
||||
)
|
||||
|
||||
|
||||
|
||||
cc_library(
|
||||
name = "sdl2_win",
|
||||
srcs= [
|
||||
"x86_64-w64-mingw32/lib/libSDL2.a",
|
||||
"x86_64-w64-mingw32/lib/libSDL2main.a"
|
||||
],
|
||||
hdrs = glob(["x86_64-w64-mingw32/include/**/*.h"]),
|
||||
includes = ["x86_64-w64-mingw32/include"], # Optional.
|
||||
linkopts = [
|
||||
"-DEFAULTLIB:user32",
|
||||
"-DEFAULTLIB:gdi32",
|
||||
"-DEFAULTLIB:winmm",
|
||||
"-DEFAULTLIB:imm32",
|
||||
"-DEFAULTLIB:ole32",
|
||||
"-DEFAULTLIB:oleaut32",
|
||||
"-DEFAULTLIB:version",
|
||||
"-DEFAULTLIB:uuid",
|
||||
"-DEFAULTLIB:shell32",
|
||||
"-DEFAULTLIB:advapi32",
|
||||
"-DEFAULTLIB:hid",
|
||||
"-DEFAULTLIB:setupapi",
|
||||
"-DEFAULTLIB:opengl32",
|
||||
"-DEFAULTLIB:kernel32",
|
||||
"/ENTRY:WinMainCRTStartup"
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
alias(
|
||||
name = "sdl2",
|
||||
actual = select({
|
||||
"//:windows": "//:sdl2_win",
|
||||
"//conditions:default": "//sdl2_win",
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
Loading…
Reference in New Issue
Block a user