Made build work partially outside windows.
This commit is contained in:
7
BUILD
7
BUILD
@ -18,10 +18,3 @@ Include('web')
|
|||||||
Include('pico-ice')
|
Include('pico-ice')
|
||||||
Include('esp32')
|
Include('esp32')
|
||||||
Include('site')
|
Include('site')
|
||||||
|
|
||||||
Default('windows')
|
|
||||||
Default('posix')
|
|
||||||
Default('web')
|
|
||||||
Default('esp32')
|
|
||||||
Default('pico')
|
|
||||||
Default('site')
|
|
||||||
|
|||||||
95
configure.py
95
configure.py
@ -26,6 +26,14 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|||||||
ROOT_DIR = SCRIPT_DIR
|
ROOT_DIR = SCRIPT_DIR
|
||||||
NINJA_BUILD = os.path.join(ROOT_DIR, 'build.ninja')
|
NINJA_BUILD = os.path.join(ROOT_DIR, 'build.ninja')
|
||||||
|
|
||||||
|
SRC_DIR = os.path.relpath(ROOT_DIR, os.getcwd())
|
||||||
|
if SRC_DIR == '.':
|
||||||
|
DST_DIR = 'out'
|
||||||
|
NINJA_DIR = '.'
|
||||||
|
else:
|
||||||
|
DST_DIR = '.'
|
||||||
|
NINJA_DIR = '.'
|
||||||
|
|
||||||
CFLAGS_COMMON = [
|
CFLAGS_COMMON = [
|
||||||
'-O2',
|
'-O2',
|
||||||
'-I', '$src',
|
'-I', '$src',
|
||||||
@ -105,41 +113,84 @@ WIN_LFLAGS64 = [
|
|||||||
'/LIBPATH:"c:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/ucrt/x64"',
|
'/LIBPATH:"c:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/ucrt/x64"',
|
||||||
] + WIN_LIBS
|
] + WIN_LIBS
|
||||||
|
|
||||||
LOCALAPPDATAR = str(subprocess.check_output('cmd.exe /c echo "%LOCALAPPDATA%"',
|
PICO_ICE_ENABLED = False
|
||||||
shell=True, stderr=subprocess.DEVNULL).splitlines()[0], 'ascii').replace('\\', '/')
|
WINDOWS_ENABLED = False
|
||||||
LOCALAPPDATA = LOCALAPPDATAR.replace('C:/', '/mnt/c/')
|
|
||||||
ARDUINO_CLI = LOCALAPPDATA + '/Programs/arduino-ide/resources/app/lib/backend/resources/arduino-cli.exe'
|
WINTMP = '/UNSUPPORTED'
|
||||||
WINTMP = LOCALAPPDATA + '/Temp'
|
ARDUINO_CLI = 'UNSUPPORTED'
|
||||||
WINTMPR = LOCALAPPDATAR + '/Temp'
|
WIN_CL32 = 'UNSUPPORTED'
|
||||||
|
WIN_CL64 = 'UNSUPPORTED'
|
||||||
|
WIN_LINK32 = 'UNSUPPORTED'
|
||||||
|
WIN_LINK64 = 'UNSUPPORTED'
|
||||||
|
WIN_RC32 = 'UNSUPPORTED'
|
||||||
|
WIN_RC64 = 'UNSUPPORTED'
|
||||||
|
|
||||||
|
# Mutable global state.
|
||||||
|
build_files = []
|
||||||
|
output = ''
|
||||||
|
|
||||||
def Escape(path):
|
def Escape(path):
|
||||||
return path.replace(' ', '\\ ').replace('(', '\\(').replace(')', '\\)')
|
return path.replace(' ', '\\ ').replace('(', '\\(').replace(')', '\\)')
|
||||||
|
|
||||||
def LSQ(path):
|
def LSQ(path):
|
||||||
return '"' + str(subprocess.check_output('ls ' + Escape(path), shell=True), 'ascii').splitlines()[0] + '"'
|
return '"' + str(subprocess.check_output('ls ' + Escape(path), shell=True,
|
||||||
|
stderr=subprocess.DEVNULL), 'ascii').splitlines()[0] + '"'
|
||||||
|
|
||||||
|
def DetectWindowsTools(args):
|
||||||
|
global WINDOWS_ENABLED
|
||||||
|
global WINTMP, ARDUINO_CLI
|
||||||
|
global WIN_CL32, WIN_CL64, WIN_LINK32, WIN_LINK64, WIN_RC32, WIN_RC64
|
||||||
|
try:
|
||||||
|
LOCALAPPDATAR = str(subprocess.check_output('cmd.exe /c echo "%LOCALAPPDATA%"', shell=True,
|
||||||
|
stderr=subprocess.DEVNULL).splitlines()[0], 'ascii').replace('\\', '/')
|
||||||
|
except:
|
||||||
|
if not args.quiet:
|
||||||
|
sys.stderr.write('Windows %LOCALAPPDATA% not available, Windows support disabled.\n')
|
||||||
|
return
|
||||||
|
LOCALAPPDATA = LOCALAPPDATAR.replace('C:/', '/mnt/c/')
|
||||||
|
ARDUINO_CLI = LOCALAPPDATA + '/Programs/arduino-ide/resources/app/lib/backend/resources/arduino-cli.exe'
|
||||||
|
WINTMP = LOCALAPPDATA + '/Temp'
|
||||||
|
WINTMPR = LOCALAPPDATAR + '/Temp'
|
||||||
PROGFILES = '/mnt/c/Program Files (x86)'
|
PROGFILES = '/mnt/c/Program Files (x86)'
|
||||||
MSVS = PROGFILES + '/Microsoft Visual Studio'
|
MSVS = PROGFILES + '/Microsoft Visual Studio'
|
||||||
MSKITS = PROGFILES + '/Windows Kits'
|
MSKITS = PROGFILES + '/Windows Kits'
|
||||||
|
try:
|
||||||
WIN_CL32 = LSQ(MSVS + '/*/*/VC/Tools/MSVC/*/bin/Hostx86/x86/cl.exe')
|
WIN_CL32 = LSQ(MSVS + '/*/*/VC/Tools/MSVC/*/bin/Hostx86/x86/cl.exe')
|
||||||
WIN_CL64 = LSQ(MSVS + '/*/*/VC/Tools/MSVC/*/bin/Hostx86/x64/cl.exe')
|
WIN_CL64 = LSQ(MSVS + '/*/*/VC/Tools/MSVC/*/bin/Hostx86/x64/cl.exe')
|
||||||
WIN_LINK32 = LSQ(MSVS + '/*/*/VC/Tools/MSVC/*/bin/Hostx86/x86/link.exe')
|
WIN_LINK32 = LSQ(MSVS + '/*/*/VC/Tools/MSVC/*/bin/Hostx86/x86/link.exe')
|
||||||
WIN_LINK64 = LSQ(MSVS + '/*/*/VC/Tools/MSVC/*/bin/Hostx86/x64/link.exe')
|
WIN_LINK64 = LSQ(MSVS + '/*/*/VC/Tools/MSVC/*/bin/Hostx86/x64/link.exe')
|
||||||
WIN_RC32 = LSQ(MSKITS + '/*/bin/*/x86/rc.exe')
|
WIN_RC32 = LSQ(MSKITS + '/*/bin/*/x86/rc.exe')
|
||||||
WIN_RC64 = LSQ(MSKITS + '/*/bin/*/x64/rc.exe')
|
WIN_RC64 = LSQ(MSKITS + '/*/bin/*/x64/rc.exe')
|
||||||
|
except:
|
||||||
|
if not args.quiet:
|
||||||
|
sys.stderr.write('Windows tools not available, Windows support disabled.\n')
|
||||||
|
return
|
||||||
|
WINDOWS_ENABLED = True
|
||||||
|
|
||||||
|
|
||||||
|
def DetectGenericTools(args):
|
||||||
|
global D8, NODEJS, PICO_ICE_ENABLED
|
||||||
|
try:
|
||||||
D8 = LSQ('${HOME}/src/v8/v8/out/x64.release/d8')
|
D8 = LSQ('${HOME}/src/v8/v8/out/x64.release/d8')
|
||||||
|
except:
|
||||||
|
if not args.quiet:
|
||||||
|
sys.stderr.write('V8 checkout in $HOME/src/v8 not found, ignoring.\n')
|
||||||
|
try:
|
||||||
NODEJS = LSQ('/usr/bin/nodejs')
|
NODEJS = LSQ('/usr/bin/nodejs')
|
||||||
|
except:
|
||||||
|
if not args.quiet:
|
||||||
|
sys.stderr.write('/usr/bin/nodejs not found, required!\n')
|
||||||
|
sys.exit(1)
|
||||||
|
try:
|
||||||
|
LSQ('/usr/bin/arm-none-eabi-gcc')
|
||||||
|
PICO_ICE_ENABLED = True
|
||||||
|
except:
|
||||||
|
if not args.quiet:
|
||||||
|
sys.stderr.write('Missing package gcc-arm-none-eabi, pico-ice diabled!\n')
|
||||||
|
|
||||||
SRC_DIR = os.path.relpath(ROOT_DIR, os.getcwd())
|
|
||||||
if SRC_DIR == '.':
|
|
||||||
DST_DIR = 'out'
|
|
||||||
NINJA_DIR = '.'
|
|
||||||
else:
|
|
||||||
DST_DIR = '.'
|
|
||||||
NINJA_DIR = '.'
|
|
||||||
|
|
||||||
build_files = []
|
def InitOutput():
|
||||||
|
global output
|
||||||
output = f"""
|
output = f"""
|
||||||
ninja_required_version = 1.1
|
ninja_required_version = 1.1
|
||||||
src = {SRC_DIR}
|
src = {SRC_DIR}
|
||||||
@ -456,11 +507,22 @@ def Default(target):
|
|||||||
return target
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
class SkipFileException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def Return():
|
||||||
|
raise SkipFileException()
|
||||||
|
|
||||||
|
|
||||||
def Include(path):
|
def Include(path):
|
||||||
build_files.append(os.path.join('$src', path, 'BUILD'))
|
build_files.append(os.path.join('$src', path, 'BUILD'))
|
||||||
path = os.path.join(ROOT_DIR, path, 'BUILD')
|
path = os.path.join(ROOT_DIR, path, 'BUILD')
|
||||||
data = open(path).read()
|
data = open(path).read()
|
||||||
|
try:
|
||||||
exec(data)
|
exec(data)
|
||||||
|
except SkipFileException:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def Main():
|
def Main():
|
||||||
@ -469,6 +531,9 @@ def Main():
|
|||||||
description='Generate ninja.build')
|
description='Generate ninja.build')
|
||||||
parser.add_argument('-q', '--quiet', action='store_true')
|
parser.add_argument('-q', '--quiet', action='store_true')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
DetectGenericTools(args)
|
||||||
|
DetectWindowsTools(args)
|
||||||
|
InitOutput()
|
||||||
Include('.')
|
Include('.')
|
||||||
with open('build.ninja', 'w') as fh:
|
with open('build.ninja', 'w') as fh:
|
||||||
fh.write(output)
|
fh.write(output)
|
||||||
|
|||||||
@ -66,6 +66,7 @@ Run('$dst/gen/esp32_sim_opcodes.h', '$dst/gen/print-esp32-builtins')
|
|||||||
|
|
||||||
# Main Alias.
|
# Main Alias.
|
||||||
Alias('esp32', ' '.join(ESP32_FILES))
|
Alias('esp32', ' '.join(ESP32_FILES))
|
||||||
|
Default('esp32')
|
||||||
|
|
||||||
# Automate building / flashing.
|
# Automate building / flashing.
|
||||||
BOARDS = {
|
BOARDS = {
|
||||||
|
|||||||
@ -12,6 +12,9 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
if not PICO_ICE_ENABLED:
|
||||||
|
Return()
|
||||||
|
|
||||||
PICO_ICE_FILES = []
|
PICO_ICE_FILES = []
|
||||||
PICO_ICE_ZIP_FILES = []
|
PICO_ICE_ZIP_FILES = []
|
||||||
|
|
||||||
@ -42,12 +45,18 @@ Command(' '.join(['$dst/pico-ice/build.ninja',
|
|||||||
'cmake $dst/pico-ice -G Ninja -S pico-ice -B $dst/pico-ice 2>&1 | cat >$dst/pico-ice/cmake.err')
|
'cmake $dst/pico-ice -G Ninja -S pico-ice -B $dst/pico-ice 2>&1 | cat >$dst/pico-ice/cmake.err')
|
||||||
|
|
||||||
# Check out submodules if needed.
|
# Check out submodules if needed.
|
||||||
Command('$src/pico-ice/pico-sdk/README.md',
|
Command(' '.join([
|
||||||
|
'$src/pico-ice/pico-sdk/README.md',
|
||||||
|
'$src/pico-ice/pico-sdk/LICENSE.TXT',
|
||||||
|
]),
|
||||||
'', 'git submodule update --init pico-ice/pico-sdk')
|
'', 'git submodule update --init pico-ice/pico-sdk')
|
||||||
Command('$src/pico-ice/pico-sdk/lib/tinyusb/README.rst',
|
Command('$src/pico-ice/pico-sdk/lib/tinyusb/README.rst',
|
||||||
'$src/pico-ice/pico-sdk/README.md',
|
'$src/pico-ice/pico-sdk/README.md',
|
||||||
'cd $src/pico-ice/pico-sdk && git submodule update --init lib/tinyusb')
|
'cd $src/pico-ice/pico-sdk && git submodule update --init lib/tinyusb')
|
||||||
Command('pico-ice/pico-ice-sdk/README.md',
|
Command(' '.join([
|
||||||
|
'$src/pico-ice/pico-ice-sdk/README.md',
|
||||||
|
'$src/pico-ice/pico-ice-sdk/LICENSE.md',
|
||||||
|
]),
|
||||||
'', 'git submodule update --init pico-ice/pico-ice-sdk')
|
'', 'git submodule update --init pico-ice/pico-ice-sdk')
|
||||||
|
|
||||||
# Zip it.
|
# Zip it.
|
||||||
@ -65,3 +74,4 @@ Importation('$dst/gen/pico_ice_boot.h', '$src/pico-ice/pico_ice_boot.fs', name='
|
|||||||
|
|
||||||
# Main Alias.
|
# Main Alias.
|
||||||
Alias('pico', ' '.join(PICO_ICE_FILES))
|
Alias('pico', ' '.join(PICO_ICE_FILES))
|
||||||
|
Default('pico')
|
||||||
|
|||||||
@ -25,3 +25,5 @@ OneShot('install',
|
|||||||
'$dst/posix/ueforth',
|
'$dst/posix/ueforth',
|
||||||
'sudo cp $dst/posix/ueforth /usr/bin/ueforth',
|
'sudo cp $dst/posix/ueforth /usr/bin/ueforth',
|
||||||
pool='console')
|
pool='console')
|
||||||
|
|
||||||
|
Default('posix')
|
||||||
|
|||||||
34
site/BUILD
34
site/BUILD
@ -48,11 +48,15 @@ DEPLOY_ITEMS += [
|
|||||||
'esp-cam-wiring.jpg',
|
'esp-cam-wiring.jpg',
|
||||||
'serial_bridge.jpg',
|
'serial_bridge.jpg',
|
||||||
]
|
]
|
||||||
] + [
|
]
|
||||||
|
|
||||||
|
if WINDOWS_ENABLED:
|
||||||
|
DEPLOY_ITEM += [
|
||||||
Copy('$dst/deploy/static/favicon.ico', '$dst/resources/eforth.ico'),
|
Copy('$dst/deploy/static/favicon.ico', '$dst/resources/eforth.ico'),
|
||||||
]
|
]
|
||||||
|
|
||||||
Alias('site', ' '.join(DEPLOY_ITEMS))
|
Alias('site', ' '.join(DEPLOY_ITEMS))
|
||||||
|
Default('site')
|
||||||
|
|
||||||
Alias('deploy', ' '.join([
|
Alias('deploy', ' '.join([
|
||||||
Command('deploy-esp32', 'site',
|
Command('deploy-esp32', 'site',
|
||||||
@ -61,7 +65,9 @@ Alias('deploy', ' '.join([
|
|||||||
'cd $dst/deploy && gcloud app deploy -q --project eforth *.yaml', pool='console'),
|
'cd $dst/deploy && gcloud app deploy -q --project eforth *.yaml', pool='console'),
|
||||||
]))
|
]))
|
||||||
|
|
||||||
PUBLISH_PARTS = [
|
PUBLISH_PARTS = []
|
||||||
|
|
||||||
|
PUBLISH_PARTS += [
|
||||||
Alias('publish-esp32', ' '.join([
|
Alias('publish-esp32', ' '.join([
|
||||||
Publish('publish-esp32-rev',
|
Publish('publish-esp32-rev',
|
||||||
'$dst/esp32/ESP32forth.zip',
|
'$dst/esp32/ESP32forth.zip',
|
||||||
@ -70,14 +76,6 @@ PUBLISH_PARTS = [
|
|||||||
'$dst/esp32/ESP32forth.zip',
|
'$dst/esp32/ESP32forth.zip',
|
||||||
'ESP32forth-{{VERSION}}.zip'),
|
'ESP32forth-{{VERSION}}.zip'),
|
||||||
])),
|
])),
|
||||||
Alias('publish-pico-ice', ' '.join([
|
|
||||||
Publish('publish-pico-ice-rev',
|
|
||||||
'$dst/pico-ice/ueforth-pico-ice.zip',
|
|
||||||
'ueforth-pico-ice-{{VERSION}}-{{REVSHORT}}.zip'),
|
|
||||||
Publish('publish-pico-ice-ver',
|
|
||||||
'$dst/pico-ice/ueforth-pico-ice.zip',
|
|
||||||
'ueforth-pico-ice-{{VERSION}}.zip'),
|
|
||||||
])),
|
|
||||||
Alias('publish-linux', ' '.join([
|
Alias('publish-linux', ' '.join([
|
||||||
Publish('publish-linux-rev',
|
Publish('publish-linux-rev',
|
||||||
'$dst/posix/ueforth',
|
'$dst/posix/ueforth',
|
||||||
@ -94,6 +92,22 @@ PUBLISH_PARTS = [
|
|||||||
'$dst/web/ueforth.js',
|
'$dst/web/ueforth.js',
|
||||||
'ueforth-{{VERSION}}.js'),
|
'ueforth-{{VERSION}}.js'),
|
||||||
])),
|
])),
|
||||||
|
]
|
||||||
|
|
||||||
|
if PICO_ICE_ENABLED:
|
||||||
|
PUBLISH_PARTS += [
|
||||||
|
Alias('publish-pico-ice', ' '.join([
|
||||||
|
Publish('publish-pico-ice-rev',
|
||||||
|
'$dst/pico-ice/ueforth-pico-ice.zip',
|
||||||
|
'ueforth-pico-ice-{{VERSION}}-{{REVSHORT}}.zip'),
|
||||||
|
Publish('publish-pico-ice-ver',
|
||||||
|
'$dst/pico-ice/ueforth-pico-ice.zip',
|
||||||
|
'ueforth-pico-ice-{{VERSION}}.zip'),
|
||||||
|
])),
|
||||||
|
]
|
||||||
|
|
||||||
|
if WINDOWS_ENABLED:
|
||||||
|
PUBLISH_PARTS += [
|
||||||
Alias('publish-win', ' '.join([
|
Alias('publish-win', ' '.join([
|
||||||
Alias('publish-win32', ' '.join([
|
Alias('publish-win32', ' '.join([
|
||||||
Publish('publish-win32-rev',
|
Publish('publish-win32-rev',
|
||||||
|
|||||||
@ -34,3 +34,4 @@ WEB_ITEMS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
Alias('web', ' '.join(WEB_ITEMS))
|
Alias('web', ' '.join(WEB_ITEMS))
|
||||||
|
Default('web')
|
||||||
|
|||||||
@ -12,7 +12,11 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
if not WINDOWS_ENABLED:
|
||||||
|
Return()
|
||||||
|
|
||||||
Alias('windows', 'win32 win64')
|
Alias('windows', 'win32 win64')
|
||||||
|
Default('windows')
|
||||||
|
|
||||||
# Create boot.
|
# Create boot.
|
||||||
Importation('$dst/gen/windows_boot.h', '$src/windows/windows_boot.fs',
|
Importation('$dst/gen/windows_boot.h', '$src/windows/windows_boot.fs',
|
||||||
|
|||||||
Reference in New Issue
Block a user