From e0847960807e031361aef520eafa6b5dcba4cd3e Mon Sep 17 00:00:00 2001
From: William Casarin <bill@casarin.me>
Date: Sat, 9 Jan 2016 15:34:41 -0800
Subject: [PATCH] configurable genie, bx location

---
 makefile          | 2 +-
 scripts/genie.lua | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/makefile b/makefile
index f583e789..738d0139 100644
--- a/makefile
+++ b/makefile
@@ -20,7 +20,7 @@ endif
 
 # $(info $(OS))
 
-GENIE=../bx/tools/bin/$(OS)/genie $(GENIE_FLAGS)
+GENIE ?= ../bx/tools/bin/$(OS)/genie $(GENIE_FLAGS)
 
 all:
 	$(GENIE) --with-tools --with-shared-lib vs2008
diff --git a/scripts/genie.lua b/scripts/genie.lua
index 0696469c..aaf2f4d2 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -66,9 +66,13 @@ solution "bgfx"
 	startproject "example-00-helloworld"
 
 BGFX_DIR = path.getabsolute("..")
+BX_DIR = os.getenv("BX_DIR")
+
 local BGFX_BUILD_DIR = path.join(BGFX_DIR, ".build")
 local BGFX_THIRD_PARTY_DIR = path.join(BGFX_DIR, "3rdparty")
-BX_DIR = path.getabsolute(path.join(BGFX_DIR, "../bx"))
+if not BX_DIR then
+  BX_DIR = path.getabsolute(path.join(BGFX_DIR, "../bx"))
+end
 
 if not os.isdir(BX_DIR) then
 	print("bx not found at " .. BX_DIR)