Skip to content

Instantly share code, notes, and snippets.

@RedwanFox
Last active December 22, 2019 20:49
Show Gist options
  • Save RedwanFox/3db7f803c40594b1886f4425ac716ad0 to your computer and use it in GitHub Desktop.
Save RedwanFox/3db7f803c40594b1886f4425ac716ad0 to your computer and use it in GitHub Desktop.
Bazel build scripts for godot c++ application. Py- file extension here is used for code coloring
cc_library(
name = "godot_headers",
hdrs = glob([
"android/*.h",
"arvr/*.h",
"gdnative/*.h",
"nativescript/*.h",
"net/*.h",
"pluginscript/*.h",
"gdnative_api_struct.gen.h"
]),
includes = ["."],
visibility = [
"//visibility:public"
]
)
cc_library(
name = "godot_cpp",
hdrs = glob([
"include/*.hpp",
"include/core/*.hpp",
]),
srcs = glob([
"src/**/*.cpp", "src/__icalls.hpp"
]),
includes = ["include", "include/core"],
linkstatic = 1,
visibility = [
"//visibility:public"
],
deps = [
":godot_headers",
],
copts = select({
"//tools:windows": ['/EHsc', '/MD'],
"//tools:darwin": [ '-g','-O3', '-std=c++14', '-arch x86_64' ],
"//tools:linux": [ '-fPIC', '-g', '-Wwrite-strings'],
}),
linkopts = select({
"//tools:windows": ['/WX'],
"//tools:darwin": ['-arch x86_64', '-framework Cocoa', '-Wl,-undefined,dynamic_lookup'],
"//tools:linux": ["-Wl,-R\'$$ORIGIN\'"],
}
)
)
cc_library(
name = "godot_app",
features = ["use_linker", "windows_export_all_symbols"],
srcs = glob([
# sources
]),
includes=["./Script"],
copts = select({
"//tools:windows": ['/EHsc', '/MD'],
"//tools:darwin": [ '-g','-O3', '-arch x86_64' ],
"//tools:linux": [ '-fPIC', '-g', '-Wwrite-strings'],
}),
linkopts = select({
"//tools:windows": ['/WX'],
"//tools:darwin": ['-arch x86_64', '-framework Cocoa', '-Wl,-undefined,dynamic_lookup'],
"//tools:linux": ["-Wl,-R\'$$ORIGIN\'"],
}
),
deps = [
":godot_cpp",
]
)
cc_binary(
name = "godot_app.so",
linkstatic = 1,
linkshared = 1,
deps = [ ":godot_app" ]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment