Port to Bazel

This commit is contained in:
Pyrex 2024-02-24 21:04:20 -08:00
parent 94d71bb593
commit b0aca69287
1640 changed files with 1374 additions and 623466 deletions

17
.clwb/.bazelproject Normal file
View 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

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.system.id="Blaze" type="BLAZE_CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../..">
<excludeFolder url="file://$MODULE_DIR$/.." />
<excludeFolder url="file://$MODULE_DIR$/../../.idea" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.system.id="Blaze" type="BLAZE_CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../../..">
<sourceFolder url="file://$MODULE_DIR$/../../.." isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/../.." />
<excludeFolder url="file://$MODULE_DIR$/../../../bazel-CrocParty" />
<excludeFolder url="file://$MODULE_DIR$/../../../bazel-bin" />
<excludeFolder url="file://$MODULE_DIR$/../../../bazel-genfiles" />
<excludeFolder url="file://$MODULE_DIR$/../../../bazel-out" />
<excludeFolder url="file://$MODULE_DIR$/../../../bazel-testlogs" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.clwb/.idea/.gitignore vendored Normal file
View 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

1
.clwb/.idea/.name Normal file
View File

@ -0,0 +1 @@
CrocParty

9
.clwb/.idea/modules.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.blaze/modules/.project-data-dir.iml" filepath="$PROJECT_DIR$/.blaze/modules/.project-data-dir.iml" />
<module fileurl="file://$PROJECT_DIR$/.blaze/modules/.workspace.iml" filepath="$PROJECT_DIR$/.blaze/modules/.workspace.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.jetbrains.cidr.cpp.execution.CMakeTargetRunConfigurationProducer" />
<option value="com.jetbrains.cidr.cpp.execution.debugger.CMakeRunConfigurationProducer" />
<option value="com.jetbrains.cidr.cpp.execution.testing.boost.CMakeBoostTestRunConfigurationProducer" />
<option value="com.jetbrains.cidr.cpp.execution.testing.google.CMakeGoogleTestRunConfigurationProducer" />
<option value="com.jetbrains.cidr.cpp.execution.testing.tcatch.CMakeCatchTestRunConfigurationProducer" />
<option value="com.jetbrains.cidr.cpp.runfile.CppFileTargetRunConfigurationProducer" />
<option value="com.jetbrains.python.run.PythonRunConfigurationProducer" />
<option value="com.jetbrains.python.testing.PyTestsConfigurationProducer" />
<option value="com.jetbrains.python.testing.PythonTestLegacyConfigurationProducer" />
<option value="com.jetbrains.python.testing.doctest.PythonDocTestConfigurationProducer" />
<option value="com.jetbrains.python.testing.tox.PyToxConfigurationProducer" />
</set>
</option>
</component>
</project>

6
.clwb/.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

4
.gitignore vendored
View File

@ -1,2 +1,6 @@
cmake-build-debug
cmake-build-release
bazel-bin
bazel-crocparty
bazel-out
bazel-testlogs

View File

@ -3,8 +3,8 @@
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="CidrRootsConfiguration">
<libraryRoots>
<file path="$PROJECT_DIR$/sdl/vendored" />
<file path="$PROJECT_DIR$/vendored" />
<file path="$PROJECT_DIR$/vendored/sdl" />
</libraryRoots>
</component>
</project>

View File

@ -1,15 +0,0 @@
cmake_minimum_required(VERSION 3.27)
project(CrocParty C)
set(CMAKE_C_STANDARD 11)
add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL)
add_executable(CrocParty main.c
sdl_host.c
sdl_host.h
game.c
game.h
device.c
device.h
)
target_link_libraries(CrocParty PRIVATE SDL2::SDL2-static)

6
MODULE.bazel Normal file
View File

@ -0,0 +1,6 @@
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################

1254
MODULE.bazel.lock Normal file

File diff suppressed because it is too large Load Diff

0
WORKSPACE Normal file
View File

8
main/BUILD Normal file
View File

@ -0,0 +1,8 @@
cc_binary(
name = "game",
srcs = glob([
"*.c",
"*.h",
]),
deps = ["//sdl"],
)

View File

@ -16,7 +16,7 @@ void game_draw() {
for (int y = 0; y < DEVICE_H; y++) {
uint32_t r = (x * 255)/DEVICE_W;
uint32_t g = (y * 255)/DEVICE_H;
uint32_t b = game_frame & 0xff;
uint32_t b = game_frame & 0x100 ? 0xff - game_frame & 0xff : game_frame & 0xff;
if (x % 4 == 2 && y % 4 == 2) {
r = 255 - r;
g = 255 - g;

View File

View File

View File

@ -2,7 +2,7 @@
#include <stdbool.h>
#include "sdl_host.h"
#include "vendored/sdl/include/SDL.h"
#include "sdl/include/SDL.h"
#include "game.h"
#include "device.h"

10
sdl/BUILD Normal file
View File

@ -0,0 +1,10 @@
cc_library(
name = "sdl",
srcs = [
"x64_windows/SDL2.dll",
"x64_windows/SDL2.lib",
"x64_windows/SDL2main.lib",
],
hdrs = glob(["include/*.h"]),
visibility = ["//main:__pkg__"],
)

Some files were not shown because too many files have changed in this diff Show More