Changes to support using homebrew and ninja

This commit is contained in:
John Wiegley 2012-09-26 12:25:26 -05:00
parent 7c288b956d
commit 300cefd1a7
4 changed files with 27 additions and 73 deletions

50
acprep
View file

@ -659,21 +659,10 @@ class PrepareBuild(CommandLineApp):
def setup_for_johnw(self):
self.configure_args.append('-GNinja')
self.configure_args.append('-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON')
self.configure_args.append('-DBoost_USE_MULTITHREADED:BOOL=OFF')
if not self.options.compiler:
self.configure_args.append('-DCMAKE_CXX_COMPILER:PATH=/usr/local/bin/clang++')
self.CXXFLAGS.append('-Qunused-arguments')
self.CXXFLAGS.append('-nostdlibinc')
self.CXXFLAGS.append('-isystem')
self.CXXFLAGS.append('/usr/local/include/c++/v1')
self.CXXFLAGS.append('-isystem')
self.CXXFLAGS.append('/usr/include')
self.CXXFLAGS.append('-stdlib=libc++')
self.CXXFLAGS.append('-Wl,/usr/local/lib/libc++.dylib')
self.CXXFLAGS.append('-Wno-disabled-macro-expansion')
if self.current_flavor == 'opt':
self.configure_args.append('-DCMAKE_CXX_FLAGS_RELEASE:STRING=-O4')
self.configure_args.append('-DCMAKE_CXX_LINK_FLAGS_RELEASE:STRING=-O4')
@ -681,31 +670,13 @@ class PrepareBuild(CommandLineApp):
# self.CXXFLAGS.append('-g -O1 -faddress-sanitizer')
# self.LDFLAGS.append('-g -O1 -faddress-sanitizer')
self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/usr/local/include;/opt/local/include')
self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/usr/local/lib;/opt/local/lib')
self.configure_args.append('-DBOOST_ROOT=/usr/local')
self.configure_args.append('-DBOOST_INCLUDEDIR=/usr/local/include/boost-1_50')
self.configure_args.append('-DBoost_COMPILER=-clang-darwin')
self.configure_args.append(self.source_dir)
elif self.options.compiler == "icc":
self.configure_args.append('-DCMAKE_AR:PATH=/opt/intel/bin/xiar')
self.configure_args.append('-DCMAKE_CXX_COMPILER:PATH=/opt/intel/bin/icc')
if self.current_flavor == 'opt':
self.configure_args.append('-DCMAKE_CXX_FLAGS:STRING=-fast')
self.configure_args.append('-DCMAKE_CXX_LINK_FLAGS:STRING=-fast')
self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/opt/local/include')
self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/opt/local/lib')
self.configure_args.append('-DBOOST_ROOT=/opt/local')
self.configure_args.append(self.source_dir)
else:
self.configure_args.append('-DCMAKE_CXX_COMPILER:PATH=' + self.options.compiler)
self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/opt/local/include')
self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/opt/local/lib')
self.configure_args.append('-DBOOST_ROOT=/opt/local')
self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/usr/local/include')
self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/usr/local/lib')
self.configure_args.append('-DBOOST_ROOT=/usr/local')
self.configure_args.append(self.source_dir)
def setup_for_system(self):
@ -926,13 +897,24 @@ class PrepareBuild(CommandLineApp):
self.log.debug('Changing directory to ' + build_dir)
os.chdir(build_dir)
self.execute(*(['make'] + make_args))
self.execute(*(['ninja'] + make_args))
finally:
os.chdir(self.source_dir)
def phase_check(self, *args):
self.log.info('Executing phase: update')
self.execute(*(['ctest'] + make_args))
build_dir = self.ensure(self.build_directory())
try:
self.log.debug('Changing directory to ' + build_dir)
os.chdir(build_dir)
make_args = list(args)
if self.options.jobs > 1:
make_args.append('-j%d' % self.options.jobs)
self.execute(*(['ctest'] + list(make_args)))
finally:
os.chdir(self.source_dir)
def phase_update(self, *args):
self.log.info('Executing phase: update')

View file

@ -2,7 +2,7 @@
# This is only important if you intend to produce a Ledger binary for
# installation.
STOW_ROOT = /usr/local/stow
STOW_ROOT = /usr/local/Cellar/boost
PRODUCTS = $(HOME)/Products
GCC_VERSION = 4.7
@ -37,14 +37,10 @@ endif
BOOST_FLAGS = toolset=$(BOOST_TOOLSET) --layout=versioned \
link=shared threading=single $(BOOST_DEFINES)
BOOST_DIR = boost_$(BOOST_VERSION)-$(DIR_SUFFIX)
BOOST_STOW = $(STOW_ROOT)/$(BOOST_DIR)
BOOST_STOW = $(STOW_ROOT)/$(BOOST_VERSION)
BOOST_BUILD = $(PRODUCTS)/$(BOOST_DIR)
ICU_FLAGS = -sHAVE_ICU=1 -sICU_PATH=$(STOW_ROOT)/icu-$(DIR_SUFFIX)
BOOST_ICU_DIR = boost_$(BOOST_VERSION)-icu-$(DIR_SUFFIX)
BOOST_ICU_STOW = $(STOW_ROOT)/$(BOOST_ICU_DIR)
BOOST_ICU_BUILD = $(PRODUCTS)/$(BOOST_ICU_DIR)
all: boost-build #icu-build boost-icu-build
all: boost-build
prepare-boost:
perl -i -pe 's/local command = \[ common\.get-invocation-command darwin : g\+\+ : .*/local command = [ common.get-invocation-command darwin : g++ : $(CXX) ] ;/;' $(BOOST_SOURCE)/tools/build/v2/tools/darwin.jam
@ -56,29 +52,5 @@ boost-build: prepare-boost
./b2 $(OPTJ) debug release --prefix=$(BOOST_STOW) \
--build-dir=$(BOOST_BUILD) $(BOOST_FLAGS) install)
icu-build:
-(cd icu/source; make distclean)
(cd icu/source; sh autogen.sh; \
./configure CPPFLAGS="$(CPPFLAGS)" \
CFLAGS="$(CFLAGS)" \
LDFLAGS="$(LDFLAGS)" \
CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \
--enable-static --enable-debug \
--prefix=$(STOW_ROOT)/icu-$(DIR_SUFFIX) && \
make install)
boost-icu-build:
(cd $(BOOST_SOURCE) && \
sh bootstrap.sh && \
./bjam $(OPTJ) debug --prefix=$(BOOST_ICU_STOW) \
--build-dir=$(BOOST_ICU_BUILD) \
$(BOOST_FLAGS) $(ICU_FLAGS) install)
clean:
-rm -fr $(BOOST_STOW) $(BOOST_BUILD)
-rm -fr $(BOOST_ICU_STOW) $(BOOST_ICU_BUILD)
-rm -fr $(STOW_ROOT)/icu-$(DIR_SUFFIX)
-(cd icu/source; make distclean)
lib-clean:
-(cd icu/source; make distclean)

View file

@ -4,7 +4,7 @@
# clang-3.1 from MacPorts. I build my own Boost instead of using MacPorts'
# Boost in order to get better debugging support, and to link with libc++.
export PATH=$PATH:/opt/local/lib/openmpi/bin
#export PATH=$PATH:/opt/local/lib/openmpi/bin
cat > ~/user-config.jam <<EOF
using clang-darwin : : "/usr/local/bin/clang++" : <cxxflags>-std=c++11 ;
@ -14,4 +14,4 @@ EOF
# instead of /usr/local/lib/libc++.1.dylib
make CXX=clang++ LD=clang++ CC=clang OPTJ=-j20 \
BOOST_TOOLSET=clang-darwin DIR_SUFFIX=clang31 \
BOOST_DEFINES="-sHAVE_ICONV=1 -sICONV_PATH=/usr/local -sHAVE_ICU=1 -sICU_PATH=/usr/local cxxflags=\"-g -std=c++11 $* -nostdlibinc -isystem /usr/local/include -isystem /opt/local/include -isystem /usr/local/include/c++/v1 -isystem /usr/include -stdlib=libc++\" linkflags=\"-g $* -L/usr/local/lib -L/opt/local/lib -L/usr/lib /usr/local/lib/libc++.dylib -stdlib=libc++\""
BOOST_DEFINES="-sHAVE_ICONV=1 -sHAVE_ICU=1 -sICU_PATH=/usr/local/opt/icu4c cxxflags=\"-g -std=c++11 $* -nostdlibinc -isystem /usr/local/include -isystem /usr/local/include/c++/v1 -isystem /usr/include -stdlib=libc++\" linkflags=\"-g $* -L/usr/local/lib -L/usr/lib /usr/local/lib/libc++.dylib -stdlib=libc++\""

View file

@ -6,10 +6,10 @@ shift 1
JOBS=-j$(sysctl -n hw.activecpu)
OPTIONS="$flavor --debug --python --doxygen $JOBS"
time ( \
cd ~/src/ledger ; \
PATH=/usr/local/bin:/opt/local/bin:$PATH \
nice -n 20 ./acprep $OPTIONS make "$@" && \
PATH=/usr/local/bin:/opt/local/bin:$PATH \
nice -n 20 ./acprep $OPTIONS check "$@" \
time ( \
cd ~/src/ledger ; \
PATH=/usr/local/bin:/opt/local/bin:$PATH \
nice -n 20 ./acprep $OPTIONS make $JOBS "$@" && \
PATH=/usr/local/bin:/opt/local/bin:$PATH \
nice -n 20 ./acprep $OPTIONS check $JOBS "$@" \
)