Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,7 @@ bin/*
*.translation
!game/common/map/*.obj

/compile_commands.json
/compile_commands.json

# Out-of-source build directory
build/
47 changes: 32 additions & 15 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ opts.Add(BoolVariable("build_lvdf_headless", "Build the lexy vdf headless execut

env.FinalizeOptions()

suffix = ".{}.{}".format(env["platform"], env["target"])
if env.dev_build:
suffix += ".dev"
if env["precision"] == "double":
suffix += ".double"
suffix += "." + env["arch"]
if env["platform"] == "windows":
if env.get("debug_crt", False):
suffix += ".mdd"
elif env.get("use_static_cpp", False):
suffix += ".mt"
else:
suffix += ".md"
if env.get("use_asan", False):
suffix += ".san"
env["suffix"] = suffix

build_dir = env.Dir("build/" + suffix.lstrip(".")).abspath.replace("\\", "/")
env["build_dir"] = build_dir

SConscript("deps/SCsub", "env")

env.lexy_vdf = {}
Expand All @@ -34,20 +54,15 @@ env.lexy_vdf = {}
# tweak this if you want to use different folders, or more folders, to store your source code in.
source_path = "src/lexy-vdf"
include_path = "include"
env.Append(CPPPATH=[[env.Dir(p) for p in [source_path, include_path]]])
sources = env.GlobRecursive("*.cpp", [source_path])
# Mirror the lexy-vdf source tree into the per-config build dir.
lexyvdf_variant = build_dir + "/" + source_path
env.VariantDir(lexyvdf_variant, source_path, duplicate=True)
# Variant-only CPPPATH for source_path; include_path stays source-side as the
# public API root.
env.Append(CPPPATH=[[env.Dir(p) for p in [include_path, lexyvdf_variant]]])
sources = env.GlobRecursive("*.cpp", [lexyvdf_variant])
env.lexy_vdf_sources = sources

suffix = ".{}.{}".format(env["platform"], env["target"])
if env.dev_build:
suffix += ".dev"
if env["precision"] == "double":
suffix += ".double"
suffix += "." + env["arch"]

# Expose it when included from another project
env["suffix"] = suffix

library = None
env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
library_name = "liblexy-vdf{}{}".format(suffix, env["LIBSUFFIX"])
Expand All @@ -71,10 +86,12 @@ env["PROGSUFFIX"] = suffix + env["PROGSUFFIX"]
if env["build_lvdf_headless"]:
headless_name = "lexy-vdf"
headless_env = env.Clone()
headless_path = ["src/headless"]
headless_src = "src/headless"
headless_variant = build_dir + "/" + headless_src
headless_env.VariantDir(headless_variant, headless_src, duplicate=True)
headless_env.Append(CPPDEFINES=["LEXY_VDF_HEADLESS"])
headless_env.Append(CPPPATH=[headless_env.Dir(headless_path)])
headless_env.headless_sources = env.GlobRecursive("*.cpp", headless_path)
headless_env.Append(CPPPATH=[headless_env.Dir(headless_variant)])
headless_env.headless_sources = env.GlobRecursive("*.cpp", [headless_variant])
if not env["build_lvdf_library"]:
headless_env.headless_sources += sources
headless_program = headless_env.Program(
Expand Down
14 changes: 10 additions & 4 deletions deps/SCsub
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python

import os

Import("env")

def build_lexy(env):
Expand All @@ -26,10 +28,14 @@ def build_lexy(env):

paths = ["lexy/include", "lexy/src"]
lexy_env.Append(CPPPATH=[[lexy_env.Dir(p) for p in paths]])
sources = env.GlobRecursive("*.cpp", paths)
# Mirror lexy's source tree into the per-config build dir.
build_root = (env.get("build_dir") or env.Dir("#").abspath).replace("\\", "/")
lexy_out = build_root + "/lexy/lexy/src"
lexy_env.VariantDir(lexy_out, "lexy/src", duplicate=True)
sources = env.GlobRecursive("*.cpp", [lexy_out])
env.lexy_sources = sources
library_name = "liblexy_file" + env["LIBSUFFIX"]
library = lexy_env.StaticLibrary(target="lexy/src/" + library_name, source=sources)
library_name = "liblexy_file" + env.get("suffix", "") + env["LIBSUFFIX"]
library = lexy_env.StaticLibrary(target=lexy_out + "/" + library_name, source=sources)
Default(library)

env.Append(CPPPATH=[lexy_env.Dir("lexy/include")])
Expand All @@ -38,7 +44,7 @@ def build_lexy(env):
else:
env.Append(CXXFLAGS=["-isystem", lexy_env.Dir("lexy/include")])
env.Append(CXXFLAGS=[""])
env.Append(LIBPATH=[lexy_env.Dir("lexy/src")])
env.Append(LIBPATH=[lexy_env.Dir(lexy_out)])
env.Prepend(LIBS=[library_name])


Expand Down
2 changes: 1 addition & 1 deletion scripts
Loading