armory/blender/arm/make_utils.py

58 lines
2.1 KiB
Python
Raw Normal View History

2017-03-15 12:30:14 +01:00
import arm.utils
2016-10-19 13:28:06 +02:00
import subprocess
2017-01-31 20:15:58 +01:00
import bpy
2017-10-20 12:12:27 +02:00
import os
2016-10-19 13:28:06 +02:00
2017-10-24 11:23:28 +02:00
def kode_studio_mklink(sdk_path):
# Fight long-path issues on Windows
if not os.path.exists(sdk_path + '/win32/resources/app/extensions/kha/Kha'):
source = sdk_path + '/win32/resources/app/extensions/kha/Kha'
target = sdk_path + '/win32/Kha'
subprocess.check_call('mklink /J "%s" "%s"' % (source, target), shell=True)
if not os.path.exists(sdk_path + '/win32/resources/app/extensions/krom/Krom'):
source = sdk_path + '/win32/resources/app/extensions/krom/Krom'
target = sdk_path + '/win32/Krom'
subprocess.check_call('mklink /J "%s" "%s"' % (source, target), shell=True)
2016-10-19 13:28:06 +02:00
def kode_studio():
2017-03-15 12:30:14 +01:00
sdk_path = arm.utils.get_sdk_path()
project_path = arm.utils.get_fp()
if arm.utils.get_os() == 'win':
2017-10-24 11:23:28 +02:00
kode_studio_mklink(sdk_path)
2016-11-01 12:02:58 +01:00
kode_path = sdk_path + '/win32/Kode Studio.exe'
2017-03-15 12:30:14 +01:00
subprocess.Popen([kode_path, arm.utils.get_fp()])
elif arm.utils.get_os() == 'mac':
2016-11-01 12:02:58 +01:00
kode_path = '"' + sdk_path + '/Kode Studio.app/Contents/MacOS/Electron"'
2017-03-28 14:30:51 +02:00
subprocess.Popen([kode_path + ' "' + arm.utils.get_fp() + '"'], shell=True)
2016-10-19 13:28:06 +02:00
else:
2016-11-01 12:02:58 +01:00
kode_path = sdk_path + '/linux64/kodestudio'
2017-03-15 12:30:14 +01:00
subprocess.Popen([kode_path, arm.utils.get_fp()])
2016-10-19 13:28:06 +02:00
def def_strings_to_array(strdefs):
defs = strdefs.split('_')
defs = defs[1:]
defs = ['_' + d for d in defs] # Restore _
return defs
def get_kha_target(target_name): # TODO: remove
if target_name == 'macos':
return 'osx'
return target_name
2017-01-31 20:15:58 +01:00
2017-08-21 15:36:21 +02:00
def target_to_gapi(arm_project_target):
2017-01-31 20:15:58 +01:00
# TODO: align target names
2017-08-21 15:36:21 +02:00
if arm_project_target == 'krom':
2017-03-15 12:30:14 +01:00
return 'arm_gapi_' + arm.utils.get_os()
2017-08-21 15:36:21 +02:00
elif arm_project_target == 'macos':
2017-01-31 20:15:58 +01:00
return 'arm_gapi_mac'
2017-08-21 15:36:21 +02:00
elif arm_project_target == 'windows':
2017-01-31 20:15:58 +01:00
return 'arm_gapi_win'
2017-08-21 15:36:21 +02:00
elif arm_project_target == 'windowsapp':
2017-06-20 15:50:06 +02:00
return 'arm_gapi_winapp'
2017-08-21 15:36:21 +02:00
elif arm_project_target == 'android-native':
2017-01-31 20:15:58 +01:00
return 'arm_gapi_android'
2017-08-21 15:36:21 +02:00
elif arm_project_target == 'node':
2017-07-01 13:12:22 +02:00
return 'arm_gapi_html5'
2017-01-31 20:15:58 +01:00
else:
2017-08-21 15:36:21 +02:00
return 'arm_gapi_' + arm_project_target