-
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 all 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,20 +27,53 @@ 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): | ||
| if platform_id in PLATFORM_TO_TARGET_MAP: | ||
| return PLATFORM_TO_TARGET_MAP[platform_id] | ||
| else: | ||
| return None | ||
|
|
@@ -67,5 +102,5 @@ base_env = env | |
| for build_config in env['build_config']: | ||
| env = base_env.Clone() | ||
| env['build_config'] = build_config | ||
| print '********** Configuring Build Target =', env['target'], '/', build_config, '********' | ||
| print ('********** Configuring Build Target =', env['target'], '/', build_config, '********') | ||
| SConscript('Build.scons', variant_dir='Targets/'+env['target']+'/'+build_config, exports='env', duplicate=0) | ||
| 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'] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,22 +11,22 @@ | |
| | as published by the Free Software Foundation; either version 2 | ||
| | of the License, or (at your option) any later version. | ||
| | | ||
| | OEMs, ISVs, VARs and other distributors that combine and | ||
| | OEMs, ISVs, VARs and other distributors that combine and | ||
| | distribute commercially licensed software with Platinum software | ||
| | and do not wish to distribute the source code for the commercially | ||
| | licensed software under version 2, or (at your option) any later | ||
| | version, of the GNU General Public License (the "GPL") must enter | ||
| | into a commercial license agreement with Plutinosoft, LLC. | ||
| | [email protected] | ||
| | | ||
| | | ||
| | This program is distributed in the hope that it will be useful, | ||
| | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| | GNU General Public License for more details. | ||
| | | ||
| | You should have received a copy of the GNU General Public License | ||
| | along with this program; see the file LICENSE.txt. If not, write to | ||
| | the Free Software Foundation, Inc., | ||
| | the Free Software Foundation, Inc., | ||
| | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| | http://www.gnu.org/licenses/gpl-2.0.html | ||
| | | ||
|
|
@@ -59,11 +59,11 @@ class StreamValidator : public PLT_StreamValidator | |
| public: | ||
| StreamValidator(NPT_Reference<PLT_FrameBuffer>& buffer) : m_Buffer(buffer) {} | ||
| virtual ~StreamValidator() {} | ||
|
|
||
| // PLT_StreamValidator methods | ||
| bool OnNewRequestAccept(const NPT_HttpRequest& request, | ||
| bool OnNewRequestAccept(const NPT_HttpRequest& request, | ||
| const NPT_HttpRequestContext& context, | ||
| NPT_HttpResponse& response, | ||
| NPT_HttpResponse& response, | ||
| NPT_Reference<PLT_FrameBuffer>& buffer) { | ||
| NPT_COMPILER_UNUSED(request); | ||
| NPT_COMPILER_UNUSED(response); | ||
|
|
@@ -72,7 +72,7 @@ class StreamValidator : public PLT_StreamValidator | |
| buffer = m_Buffer; | ||
| return true; | ||
| } | ||
|
|
||
| NPT_Reference<PLT_FrameBuffer> m_Buffer; | ||
| }; | ||
|
|
||
|
|
@@ -83,7 +83,7 @@ class FrameWriter : public NPT_Thread | |
| { | ||
| public: | ||
| FrameWriter(NPT_Reference<PLT_FrameBuffer>& frame_buffer, | ||
| const char* frame_folder) : | ||
| const char* frame_folder) : | ||
| m_FrameBuffer(frame_buffer), | ||
| m_Aborted(false), | ||
| m_Folder(frame_folder) | ||
|
|
@@ -104,12 +104,12 @@ class FrameWriter : public NPT_Thread | |
| const char* frame_path = NULL; | ||
| NPT_DataBuffer frame; | ||
| NPT_List<NPT_String>::Iterator entry; | ||
|
|
||
| while (!m_Aborted) { | ||
| // has number of images changed since last time? | ||
| NPT_LargeSize count; | ||
| NPT_File::GetSize(m_Folder, count); | ||
|
|
||
| if (entries.GetItemCount() == 0 || entries.GetItemCount() != count) { | ||
| NPT_File::ListDir(m_Folder, entries); | ||
| entry = entries.GetFirstItem(); | ||
|
|
@@ -118,26 +118,26 @@ class FrameWriter : public NPT_Thread | |
| NPT_System::Sleep(NPT_TimeInterval(0.2f)); | ||
| continue; | ||
| } | ||
|
|
||
| // set delay based on number of files if necessary | ||
| m_Delay = NPT_TimeInterval((float)1.f/entries.GetItemCount()); | ||
| } | ||
|
|
||
| // look for path to next image | ||
| if (!(frame_path = GetPath(entry))) { | ||
| // loop back if necessary | ||
| entry = entries.GetFirstItem(); | ||
| continue; | ||
| } | ||
|
|
||
| if (NPT_FAILED(NPT_File::Load(NPT_FilePath::Create(m_Folder, frame_path), frame))) { | ||
| NPT_LOG_SEVERE_1("Image \"%s\" not found!", frame_path?frame_path:"none"); | ||
| // clear previously loaded names so we reload entire set | ||
| entries.Clear(); | ||
| continue; | ||
| } | ||
|
|
||
| if (NPT_FAILED(m_FrameBuffer->SetNextFrame(frame.GetData(), | ||
| if (NPT_FAILED(m_FrameBuffer->SetNextFrame(frame.GetData(), | ||
| frame.GetDataSize()))) { | ||
| NPT_LOG_SEVERE_1("Failed to set next frame %s", frame_path); | ||
| goto failure; | ||
|
|
@@ -183,7 +183,7 @@ ParseCommandLine(char** args) | |
|
|
||
| /* default values */ | ||
| Options.path = NULL; | ||
|
|
||
| while ((arg = *args++)) { | ||
| if (Options.path == NULL) { | ||
| Options.path = arg; | ||
|
|
@@ -207,24 +207,24 @@ int | |
| main(int argc, char** argv) | ||
| { | ||
| NPT_COMPILER_UNUSED(argc); | ||
|
|
||
| /* parse command line */ | ||
| ParseCommandLine(argv); | ||
| // frame buffer | ||
|
|
||
| // frame buffer | ||
| NPT_Reference<PLT_FrameBuffer> frame_buffer(new PLT_FrameBuffer("image/jpeg")); | ||
|
|
||
| // A Framewriter reading images from a folder and writing them | ||
| // into frame buffer in a loop | ||
| FrameWriter writer(frame_buffer, Options.path); | ||
| writer.Start(); | ||
|
|
||
| // stream request validation | ||
| StreamValidator validator(frame_buffer); | ||
| // frame server receiving requests and serving frames | ||
|
|
||
| // frame server receiving requests and serving frames | ||
| // read from frame buffer | ||
| NPT_Reference<PLT_FrameServer> device( | ||
| NPT_Reference<PLT_FrameServer> device( | ||
| new PLT_FrameServer( | ||
| "frame", | ||
| validator, | ||
|
|
@@ -235,7 +235,7 @@ main(int argc, char** argv) | |
| return 1; | ||
|
|
||
| char buf[256]; | ||
| while (true) { | ||
| while (true) { | ||
| fgets(buf, 256, stdin); | ||
| if (*buf == 'q') | ||
| break; | ||
|
|
||
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?