Skip to content

Instantly share code, notes, and snippets.

View BUILD
# third_party/glfw/glfw.BUILD
...
objc_library(
name = "glfw_src_darwin",
srcs = COMMON_SRCS + DARWIN_SRCS,
hdrs = COMMON_HDRS + DARWIN_HDRS,
copts = ["-fno-objc-arc"],
defines = DARWIN_DEFINES,
)
View BUILD
# third_party/glfw/glfw.BUILD
...
cc_library(
name = "glfw_src",
srcs = COMMON_SRCS + select({
"@bazel_tools//src/conditions:windows": WIN32_SRCS,
"@bazel_tools//src/conditions:linux_x86_64": LINUX_SRCS,
}),
hdrs = COMMON_HDRS + select({
"@bazel_tools//src/conditions:windows": WIN32_HDRS,
View BUILD
# third_party/glfw/glfw.BUILD
# ===== win32 =====
WIN32_DEFINES = [...]
WIN32_HDRS = [...]
WIN32_SRCS = [...]
WIN32_LINKOPTS = [...]
# ===== linux =====
LINUX_DEFINES = [...]
LINUX_HDRS = [...]
View BUILD
# env_setup/BUILD
load("@rules_cc//cc:defs.bzl", "cc_binary")
cc_binary(
name = "env_setup",
srcs = glob(["*.cpp"]),
deps = [
"//third_party/glfw",
"//third_party/glm",
"@rules_vulkan//vulkan:vulkan_cc_library"
View WORKSPACE
# WORKSPACE
...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
GLM_VERSION = "0.9.9.8"
http_archive(
name = "glm",
build_file = "@//third_party/glm:glm.BUILD",
sha256 = "4605259c22feadf35388c027f07b345ad3aa3b12631a5a316347f7566c6f1839",
View BUILD
# third_party/glm/BUILD
package(default_visibility = ["//visibility:public"])
alias(
name = "glm",
actual = "@glm",
)
View BUILD
# third_party/glm/glm.BUILD
load("@rules_cc//cc:defs.bzl", "cc_library")
cc_library(
name = "glm",
hdrs = glob([
"glm/**/*.hpp",
"glm/**/*.h",
]),
includes = ["."],
View uptime.kt
// Kotlin
import android.os.SystemClock
val uptimeSec = SystemClock.elapsedRealtime() / 1000.0
View numCores.kt
// Kotlin
import android.system.Os
import android.system.OsConstants
val numCores = Os.sysconf(OsConstants._SC_NPROCESSORS_CONF)
View clockSpeedHz.kt
// Kotlin
import android.system.Os
import android.system.OsConstants
val clockSpeedHz = Os.sysconf(OsConstants._SC_CLK_TCK)