-
Notifications
You must be signed in to change notification settings - Fork 147
fix build error on latest gcc and linux, gets is deprecated, and raspberry pi build of scons. add mac build of scons #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 6 commits
db545ab
9165494
7708750
228ba76
f850c76
57c651a
7385542
10a36da
b7001ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import sys | ||
| import os | ||
| import platform | ||
| import re | ||
|
|
||
| EnsureSConsVersion(0,98,1) | ||
|
|
||
|
|
@@ -16,7 +17,8 @@ PLATFORM_TO_TARGET_MAP = { | |
| 'linux2' : 'x86-unknown-linux', | ||
| 'win32' : 'x86-microsoft-win32', | ||
| 'cygwin' : 'x86-unknown-cygwin', | ||
| 'darwin' : 'universal-apple-macosx' | ||
| 'darwin' : 'universal-apple-macosx', | ||
| 'raspberry-pi-arm' : 'arm-raspberry-pi-linux' | ||
| } | ||
|
|
||
| # list all target dirs | ||
|
|
@@ -25,17 +27,50 @@ targets_dir = scons_root+'/Build/Targets' | |
| targets_dirs = os.listdir(targets_dir) | ||
| TARGET_PLATFORMS = [x for x in targets_dirs if os.path.exists(targets_dir +'/'+x+'/Config.scons')] | ||
|
|
||
| def pi_version(): | ||
| """Detect the version of the Raspberry Pi. Returns either 1, 2 or | ||
| None depending on if it's a Raspberry Pi 1 (model A, B, A+, B+), | ||
| Raspberry Pi 2 (model B+), or not a Raspberry Pi. | ||
| """ | ||
| # Check /proc/cpuinfo for the Hardware field value. | ||
| # 2708 is pi 1 | ||
| # 2709 is pi 2 | ||
| # 2835 is pi 3 on 4.9.x kernel | ||
| # Anything else is not a pi. | ||
| with open('/proc/cpuinfo', 'r') as infile: | ||
| cpuinfo = infile.read() | ||
| # Match a line like 'Hardware : BCM2709' | ||
| match = re.search('^Hardware\s+:\s+(\w+)$', cpuinfo, | ||
| flags=re.MULTILINE | re.IGNORECASE) | ||
| if not match: | ||
| # Couldn't find the hardware, assume it isn't a pi. | ||
| return None | ||
| if match.group(1) == 'BCM2708': | ||
| # Pi 1 | ||
| return 1 | ||
| elif match.group(1) == 'BCM2709': | ||
| # Pi 2 | ||
| return 2 | ||
| elif match.group(1) == 'BCM2835': | ||
| # Pi 3 / Pi on 4.9.x kernel | ||
| return 3 | ||
| else: | ||
| # Something else, not a pi. | ||
| return None | ||
|
|
||
| def DefaultTarget(): | ||
| platform_id = sys.platform | ||
| if platform.system() == 'Linux': | ||
| if (platform.machine() == 'i386' or | ||
| if pi_version() is not None: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any way to hook into |
||
| platform_id = 'raspberry-pi-arm' | ||
| elif (platform.machine() == 'i386' or | ||
| platform.machine() == 'i486' or | ||
| platform.machine() == 'i586'or | ||
| platform.machine() == 'i686'): | ||
| platform_id = 'linux-i386' | ||
| if (platform.machine() == 'x86_64'): | ||
| elif (platform.machine() == 'x86_64'): | ||
| platform_id = 'linux-x86_64' | ||
| if (platform.machine().startswith('arm')): | ||
| elif (platform.machine().startswith('arm')): | ||
| platform_id = 'linux-arm' | ||
|
|
||
| if PLATFORM_TO_TARGET_MAP.has_key(platform_id): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| LoadTool('gcc-generic', env, gcc_cross_prefix='') | ||
|
|
||
| ### Neptune System Files | ||
| env['NPT_SYSTEM_SOURCES']={'System/StdC':'*.cpp', 'System/Bsd':'*.cpp', 'System/Posix':'*.cpp', 'System/Null':'NptNullAutoreleasePool.cpp'} | ||
| env['NPT_EXTRA_LIBS']=['pthread'] | ||
|
|
||
| env['STRIP'] = '' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| LoadTool('gcc-generic', env) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intentionally not supported because building iOS/macOS with Scons is unstable and unsupported at the moment. |
||
|
|
||
| ### Neptune System Files | ||
| env['NPT_SYSTEM_SOURCES']={'System/StdC':'*.cpp', 'System/Bsd':'*.cpp', 'System/Posix':'*.cpp', 'System/Null':'NptNullAutoreleasePool.cpp NptNullSerialPort.cpp'} | ||
| env['NPT_EXTRA_LIBS']=['pthread'] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| LoadTool('gcc-generic', env) | ||
|
|
||
| ### Neptune System Files | ||
| env['NPT_SYSTEM_SOURCES']={'System/StdC':'*.cpp', 'System/Bsd':'*.cpp', 'System/Posix':'*.cpp', 'System/Null':'NptNullAutoreleasePool.cpp NptNullSerialPort.cpp'} | ||
| env['NPT_EXTRA_LIBS']=['pthread'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could you align the
:please?