Skip to content

Commit

Permalink
simply Makefile conf
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-dougherty committed Feb 19, 2015
1 parent 0e15b9b commit 9f73490
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 80 deletions.
32 changes: 24 additions & 8 deletions configure
Expand Up @@ -44,6 +44,9 @@ def main():
parser.add_argument('-c', '--cxx',
nargs = 1,
help = "specify compiler with optional path (e.g. clang++, /usr/bin/g++-4.9)")
parser.add_argument('-q', '--qmake',
nargs = 1,
help = "specify qmake with optional path (e.g. qmake, /usr/bin/qmake)")
parser.add_argument('--toolchain',
nargs = 1,
help = "specify toolchain ("+Supported_Toolchains_display+")")
Expand Down Expand Up @@ -83,6 +86,17 @@ def main():
else:
config['toolchain'] = 'gcc'
print 'Toolchain:', config['toolchain']

#
# Verify qmake
#
if not config['qmake']:
config['qmake'] = 'qmake'
else:
config['qmake'] = config['qmake'][0]
if not check_exit('which '+config['qmake']):
sys.exit('Cannot locate qmake')
print 'QMake:', config['qmake']

#
# Determine optimization level
Expand All @@ -93,7 +107,7 @@ def main():
#
# Create speculative conf and clean
#
config['omp'] = 'omp'
config['omp'] = True
generate_conf(config)
if not check_exit('make clean'):
sys.stderr.write("Warning! Encountered errors when cleaning build environment!\n")
Expand All @@ -102,8 +116,8 @@ def main():
# Check OpenMP support
#
if not check_exit('make omp_test'):
config['omp'] = 'no-omp'
print 'OpenMP Supported:', config['omp'] == 'omp'
config['omp'] = False
print 'OpenMP Supported:', config['omp']

#
# Create final configuration
Expand Down Expand Up @@ -137,12 +151,14 @@ def generate_conf(config):
f = open( os.path.join(pwhome, Conf), 'w' )

f.write( 'PWHOME = %s\n' % pwhome )
f.write( 'PWOS = %s\n' % config['os'] )
f.write( 'PWTOOLCHAIN = %s\n' % config['toolchain'] )
f.write( 'PWOMP = %s\n' % config['omp'] )
f.write( 'PWOPT = %s\n' % config['optimization'] )
f.write( 'PWQMAKE = %s\n' % config['qmake'] )
f.write( 'CXX = %s\n' % config['cxx'] )

confs = [config['os'], config['toolchain'], config['optimization'], config['omp'], 'common']
for conf in confs:
f.write('include ${PWHOME}/etc/bld/Makefile.%s.conf\n' % conf)

f.write('CXX = %s\n' % config['cxx'])
f.write( 'include ${PWHOME}/etc/bld/Makefile.conf\n' )

f.close()

Expand Down
73 changes: 72 additions & 1 deletion etc/bld/Makefile.common.conf → etc/bld/Makefile.conf
@@ -1,8 +1,33 @@
######################################################################
#
# Common System Configuration
# System Configuration
#
######################################################################
ifeq (${PWOS}, darwin)
SHARED_BASENAME = lib${1}.dylib

SHARED_LDFLAGS += -dynamiclib
# Some of our libraries reference symbols that are defined in other libraries.
# For example, the main library references renderers, but those are defined in
# other libraries, and we don't know which library will provide the library at
# the time the main library is being built.
SHARED_LDFLAGS += -undefined dynamic_lookup
# We want the library to be searched for on the runtime load path.
SHARED_LDFLAGS += -Wl,-install_name,@rpath/$(shell basename ${target})

OPENGL_CXXFLAGS = -I/System/Library/Frameworks/OpenGL.framework/Headers
OPENGL_LIBS = -framework OpenGL
else
SHARED_BASENAME = lib${1}.so

SHARED_LDFLAGS = -fPIC -shared

OPENGL_CXXFLAGS = -I/usr/include/GL
OPENGL_LIBS = -lGL -lGLU
endif

LD=${CXX}

CXXFLAGS += -g -std=c++11 -c -MMD -Wall

# Flags required for linking to a library in ${PWLIB}
Expand All @@ -12,6 +37,52 @@ DLOPEN_LIBS = -ldl
GSL_LIBS = -lgsl -lgslcblas
ZIP_LIBS = -lz

######################################################################
#
# Optimization
#
######################################################################
ifeq (${PWOPT}, optimized)
CXXFLAGS += -O2
endif

######################################################################
#
# OpenMP
#
######################################################################
ifeq (${PWOMP}, False)
OMP_CXXFLAGS = -Wno-unknown-pragmas
else
OMP_CXXFLAGS = -fopenmp
ifeq (${PWTOOLCHAIN}, gcc)
OMP_LIBS = -lgomp
endif
endif

######################################################################
#
# QMake Flags/Macros
#
######################################################################
ifeq (${PWOS}, darwin)
# Command-line spec
QMAKE=${PWQMAKE} -spec macx-llvm

# When we build a library, we want to specify it's on the runtime linker path.
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/

# Make edits to the qmake-generated Makefile for cases where a convenient
# or reliable official mechanism isn't currently available.
FIXUP_QT_MAKEFILE = sed -e 's/-mmacosx-version-min=[[:digit:]\.]*//' -i "" ${1} ;\
sed -e 's/export MACOSX_DEPLOYMENT_TARGET.*//' -i "" ${1} ;
else
QMAKE=${PWQMAKE}

# no-op
FIXUP_QT_MAKEFILE =
endif

######################################################################
#
# Project Directory Structure
Expand Down
35 changes: 0 additions & 35 deletions etc/bld/Makefile.darwin.conf

This file was deleted.

1 change: 0 additions & 1 deletion etc/bld/Makefile.debug.conf

This file was deleted.

3 changes: 0 additions & 3 deletions etc/bld/Makefile.gcc.conf

This file was deleted.

22 changes: 0 additions & 22 deletions etc/bld/Makefile.linux.conf

This file was deleted.

5 changes: 0 additions & 5 deletions etc/bld/Makefile.llvm.conf

This file was deleted.

2 changes: 0 additions & 2 deletions etc/bld/Makefile.no-omp.conf

This file was deleted.

2 changes: 0 additions & 2 deletions etc/bld/Makefile.omp.conf

This file was deleted.

1 change: 0 additions & 1 deletion etc/bld/Makefile.optimized.conf

This file was deleted.

0 comments on commit 9f73490

Please sign in to comment.