Mac OS X compile fixes

This commit is contained in:
Dennis Luxen 2011-05-07 07:36:17 +00:00
parent 4f78634994
commit a93738dd79
3 changed files with 58 additions and 5 deletions

View File

@ -53,7 +53,7 @@ AddOption('--cxx', dest='cxx', type='string', nargs=1, action='store', metavar='
AddOption('--stxxlroot', dest='stxxlroot', type='string', nargs=1, action='store', metavar='STRING', help='root directory of STXXL')
AddOption('--verbosity', dest='verbosity', type='string', nargs=1, action='store', metavar='STRING', help='make Scons talking')
AddOption('--buildconfiguration', dest='buildconfiguration', type='string', nargs=1, action='store', metavar='STRING', help='debug or release')
env = Environment(COMPILER = GetOption('cxx'))
env = Environment(ENV = {'PATH' : os.environ['PATH']} ,COMPILER = GetOption('cxx'))
if GetOption('cxx') is None:
#default Compiler
print 'Using default C++ Compiler: ', env['CXX']
@ -83,7 +83,10 @@ else:
conf = Configure(env, custom_tests = { 'CheckBoost' : CheckBoost, 'CheckProtobuf' : CheckProtobuf })
if not conf.CheckHeader('omp.h'):
print "Compiler does not support OpenMP. Exiting"
Exit(-1)
if sys.platform == 'darwin':
print "Continuing because we are on Mac. This might be fatal."
else:
Exit(-1)
if not conf.CheckLibWithHeader('xml2', 'libxml/xmlreader.h', 'CXX'):
print "libxml2 library or header not found. Exiting"
Exit(-1)

49
Util/MachineInfo.h Normal file
View File

@ -0,0 +1,49 @@
/*
open source routing machine
Copyright (C) Dennis Luxen, others 2010
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU AFFERO General Public License as published by
the Free Software Foundation; either version 3 of the License, or
any later version.
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 Affero General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
or see http://www.gnu.org/licenses/agpl.txt.
*/
#ifndef MACHINE_INFO_H
#define MACHINE_INFO_H
#ifdef __APPLE__
extern "C" {
#include <sys/sysctl.h>
}
#endif
/* Returns the physical memory size in kilobytes */
unsigned GetPhysicalmemory(void){
#if defined(SUN5) || defined(LINUX)
return (sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE));
#elif defined(__APPLE__)
int mib[2] = {CTL_HW, HW_MEMSIZE};
long long memsize;
size_t len;
len = sizeof(memsize);
sysctl(mib, 2, &memsize, &len, NULL, 0);
return memsize/1024;
#else
std::cout << "[Warning] Compiling on unknown architecture." << std::endl << "Please file a ticket at http://project-osrm.org" << std::endl;
return 2048*1024; /* 128 Mb default memory */
#endif
}
#endif

View File

@ -46,6 +46,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "DataStructures/XMLParser.h"
#include "Util/BaseConfiguration.h"
#include "Util/InputFileUtil.h"
#include "Util/MachineInfo.h"
typedef BaseConfiguration ExtractorConfiguration;
@ -62,7 +63,7 @@ bool removeIfUnused(ClassT n) { return (false == n.used); }
int main (int argc, char *argv[]) {
if(argc <= 1) {
std::cerr << "usage: " << endl << argv[0] << " <file.osm>" << std::endl;
std::cerr << "usage: " << endl << argv[0] << " <file.osm/.osm.bz2/.osm.pbf>" << std::endl;
exit(-1);
}
@ -91,8 +92,8 @@ int main (int argc, char *argv[]) {
unsigned amountOfRAM = 1;
unsigned installedRAM = (sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE));
if(installedRAM < 2097422336) {
unsigned installedRAM = GetPhysicalmemory();
if(installedRAM < 2048264) {
std::cout << "[Warning] Machine has less than 2GB RAM." << std::endl;
}
if(testDataFile("extractor.ini")) {