Skip to content

Commit e240771

Browse files
authored
Merge pull request #48 from bpuchala/0.2.X
0.2.1
2 parents b20bd4e + 45e9e9a commit e240771

333 files changed

Lines changed: 23405 additions & 6462 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
*.bkup
2525
*.old
2626

27+
# Debugging files
28+
*.bc
29+
2730
# Mac files
2831
.DS_Store
2932

@@ -58,6 +61,7 @@ src/general/populator
5861

5962
#scons
6063
.sconsign.dblite
64+
.sconf_temp
6165

6266
#binaries
6367
bin/*

INSTALL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
**C++11**
77

8-
CASM must be compiled with a compiler that supports the C++11 standard.
8+
CASM must be compiled with a compiler that supports the C++11 standard. Testing is done with gcc-4.8.5 and clang-800.0.42.1.
99

1010
**If using Mac OS X - Xcode command-line tools**
1111

@@ -44,7 +44,7 @@ Scons can be downloaded and installed from source following instructions found a
4444

4545
### Boost
4646

47-
CASM uses several Boost libraries, which are often available installed on many computing clusters. you can install Boost yourself via a package management tool, or by downloading from the Boost website: [http://www.boost.org](http://www.boost.org). CASM uses the system, filesystem, program_options, and unit_test_framework libraries, and their dependencies. Most CASM testing has been performed with Boost version 1.54 or later.
47+
CASM uses several Boost libraries, which are often available installed on many computing clusters. you can install Boost yourself via a package management tool, or by downloading from the Boost website: [http://www.boost.org](http://www.boost.org). CASM uses the system, filesystem, program_options, and unit_test_framework libraries, and their dependencies. Most CASM testing has been performed with Boost version 1.54 or later. Known bugs in version 1.53 and earlier will cause failures.
4848

4949
*Important: Boost should be compiled using the same compiler that you will use to compile CASM.*
5050

Makefile.am

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#===========================================================#
2+
#To understand why it's structured this way see
3+
#http://karelzak.blogspot.co.uk/2013/02/non-recursive-automake.html
4+
5+
ACLOCAL_AMFLAGS = -I build-aux/m4
6+
7+
#===========================================================#
8+
#Start out empty, let the Makemodule.am files fill these in
9+
lib_LTLIBRARIES=
10+
noinst_LIBRARIES=
11+
bin_PROGRAMS=
12+
check_PROGRAMS=
13+
man1_MANS=
14+
dist_bin_SCRIPTS=
15+
TESTS=
16+
17+
#===========================================================#
18+
#Define flags for everything ever
19+
TXT_VERSION:=$(shell cat $(top_srcdir)/build-aux/casm_version.txt)
20+
21+
AM_CXXFLAGS = -DTXT_VERSION='"$(TXT_VERSION)"'\
22+
-DEIGEN_DEFAULT_DENSE_INDEX_TYPE=long\
23+
-DGZSTREAM_NAMESPACE=gz\
24+
-I$(srcdir)/include\
25+
-I$(srcdir)/include/casm/external/gzstream\
26+
-I$(srcdir)/include/casm/external/qhull/libqhullcpp
27+
28+
AM_CPPFLAGS = -I$(srcdir)/include/casm/external/qhull/libqhull_r/\
29+
-I$(srcdir)/include/casm/external/gzstream\
30+
$(BOOST_CPPFLAGS)
31+
32+
AM_LDFLAGS = $(BOOST_LDFLAGS)
33+
34+
BUILT_SOURCES=
35+
36+
#============================================================#
37+
#Files that arent sources for executalbes or headers that get installed, but are needed in the distribution.
38+
#Even though the include/casm/external is distributed through headers, the licensing and other files should
39+
#also be included.
40+
EXTRA_DIST=
41+
42+
EXTRA_DIST+=./build-aux/casm_version.txt\
43+
./man\
44+
./casmenv.sh\
45+
./sample_input_files
46+
47+
#Extra files that should be cleaned up upon `distclean`
48+
DISTCLEANFILES=
49+
50+
#============================================================#
51+
#Always have included modules use paths relative to this
52+
#parent Makefile.am. Avoid variable expansion in *_SOURCES
53+
#============================================================#
54+
#Create shared casm libraries
55+
include $(srcdir)/src/casm/Makemodule.am
56+
include $(srcdir)/src/ccasm/Makemodule.am
57+
58+
#============================================================#
59+
#Take care of all the include headers
60+
include $(srcdir)/include/casm/Makemodule.am
61+
include $(srcdir)/include/ccasm/Makemodule.am
62+
63+
#============================================================#
64+
#Take care of applications
65+
include $(srcdir)/apps/casm/Makemodule.am
66+
include $(srcdir)/apps/completer/Makemodule.am
67+
68+
#============================================================#
69+
#Take care of tests
70+
include $(srcdir)/tests/Makemodule.am
71+
72+
#============================================================#
73+
#Take care of python stuff
74+
include $(srcdir)/python/Makemodule.am
75+
76+
#============================================================#
77+
#Misc targets
78+
.FORCE:
79+
80+
test:
81+
echo $(srcdir)
82+
echo $(top_srcdir)
83+
echo $(AM_LDFLAGS)
84+
echo $(AM_CXXFLAGS)
85+
echo $(AM_CPPFLAGS)
86+
echo $(casm_LDFLAGS)
87+
echo $(BOOST_LDFLAGS)
88+
echo $(BOOST_CXXFLAGS)
89+
echo $(BOOST_CPPFLAGS)
90+
echo $(TXT_VERSION)
91+
92+
#============================================================#
93+
#Recurse into these places (must be direct children, don't be fancy)
94+
#SUBDIRS= ##DO NOT USE THIS. SERIOUSLY.##
95+

SConstruct

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,15 @@ def lib_name(prefix, includename, libname):
172172
Uses re.match('lib(' + libname + '.*)\.(dylib|a|so).*',string) on all files
173173
in the prefix/lib directory to get the libname to use. If none found, return None.
174174
"""
175-
for p in os.listdir(lib_path(prefix, includename)):
176-
m = re.match('lib(' + libname + '.*)\.(dylib|a|so).*',p)
177-
if m:
178-
return m.group(1)
175+
try:
176+
for p in os.listdir(lib_path(prefix, includename)):
177+
if p is None:
178+
continue
179+
m = re.match('lib(' + libname + '.*)\.(dylib|a|so).*',p)
180+
if m:
181+
return m.group(1)
182+
except TypeError:
183+
pass
179184
return None
180185

181186
def debug_level():
@@ -315,10 +320,16 @@ env['ENV']['TERM'] = os.environ['TERM']
315320
# set testing environment (for running tests)
316321
env['ENV']['PATH'] = env['BINDIR'] + ":" + env['ENV']['PATH']
317322

318-
# set LD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH (for running configuration tests)
319-
for x in ['LD_LIBRARY_PATH', 'DYLD_LIBRARY_FALLBACK_PATH']:
320-
if x in os.environ:
321-
env['ENV'][x] = os.environ[x]
323+
# set execution environment variables (for running tests)
324+
casm_var = ['CXX', 'CASM_CXX', 'CASM_CXXFLAGS', 'CASM_SOFLAGS',
325+
'CASM_BOOST_PREFIX', 'CASM_BOOST_INCLUDEDIR', 'CASM_BOOST_LIBDIR',
326+
'LD_LIBRARY_PATH', 'DYLD_LIBRARY_FALLBACK_PATH']
327+
for var in casm_var:
328+
if var in os.environ:
329+
env['ENV'][var] = os.environ[var]
330+
331+
env['ENV']['CASM_INCLUDEDIR'] = env['INCDIR']
332+
env['ENV']['CASM_LIBDIR'] = env['LIBDIR']
322333

323334
# add methods to use elsewhre
324335
env.AddMethod(include_path)
@@ -493,6 +504,19 @@ if not env['IS_INSTALL']:
493504
##### Configuration checks
494505
if 'configure' in COMMAND_LINE_TARGETS:
495506

507+
def CheckCXX11(conf):
508+
conf.Message('Checking for c++11... ')
509+
510+
ret = conf.TryRun("""
511+
int main() {
512+
int a = 1;
513+
auto b = a;
514+
return 0;
515+
}
516+
""", '.cpp')[0]
517+
conf.Result(ret)
518+
return ret
519+
496520
def CheckBoost_prefix(conf, boost_prefix):
497521
conf.Message('BOOST_PREFIX: ' + str(boost_prefix) + '\n')
498522
conf.Message('Checking for boost headers... ')
@@ -598,6 +622,7 @@ if 'configure' in COMMAND_LINE_TARGETS:
598622
env.Clone(LIBPATH=install_lib_paths,
599623
CPPPATH=cpppath),
600624
custom_tests = {
625+
'CheckCXX11' : CheckCXX11,
601626
'CheckBoost_prefix' : CheckBoost_prefix,
602627
'CheckBoost_libname' : CheckBoost_libname,
603628
'CheckBoost_version' : CheckBoost_version,
@@ -610,6 +635,8 @@ if 'configure' in COMMAND_LINE_TARGETS:
610635

611636
# Note: CheckLib with autoadd=1 (default), because some libraries depend on each other
612637

638+
if not conf.CheckCXX11():
639+
if_failed("C++11 is required. Please check your compiler.")
613640
for x in ['z', 'dl']:
614641
if not conf.CheckLib(env[x]):
615642
if_failed("Please check your installation")

apps/casm/Makemodule.am

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bin_PROGRAMS += casm
2+
man1_MANS += man/casm.1
3+
4+
casm_SOURCES = ./apps/casm/casm.cpp
5+
casm_LDADD=libcasm.la\
6+
$(BOOST_SYSTEM_LIB)\
7+
$(BOOST_FILESYSTEM_LIB)\
8+
$(BOOST_PROGRAM_OPTIONS_LIB)\
9+
$(BOOST_REGEX_LIB)\
10+
$(BOOST_CHRONO_LIB)

apps/completer/Makemodule.am

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
if ENABLE_BASH_COMPLETION
2+
bashcompletiondir=$(BASH_COMPLETION_DIR)
3+
dist_bashcompletion_DATA=./apps/completer/casm
4+
5+
bin_PROGRAMS += casm-complete
6+
7+
casm_complete_SOURCES = ./apps/completer/complete.cpp
8+
casm_complete_LDADD=libcasm.la\
9+
$(BOOST_SYSTEM_LIB)\
10+
$(BOOST_FILESYSTEM_LIB)\
11+
$(BOOST_PROGRAM_OPTIONS_LIB)\
12+
$(BOOST_REGEX_LIB)\
13+
$(BOOST_CHRONO_LIB)
14+
endif

bootstrap.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
bash version.sh
4+
5+
if [ ! $# -eq 0 ]; then
6+
echo "Applying specified tag to version string: $1"
7+
8+
version=$(cat build-aux/casm_version.txt)
9+
reversion=$1-${version#*-}
10+
echo $reversion > build-aux/casm_version.txt
11+
fi
12+
13+
autoreconf -ivf

casmenv.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
### Set environment variables recognized by CASM during installation and use
22

3-
# Recognized by install scripts and 'casm' CLI executable for CASM install location (headers and shared libraries)
3+
# Recognized by scons install scripts and 'casm' CLI executable for CASM install
4+
# location assuming $CASM_PREFIX/include for headers and $CASM_PREFIX/lib for libcasm
45
# Order of precedence:
5-
# 1) $CASM_PREFIX
6-
# 2) "/usr/local"
6+
# 1) $CASM_INCLUDEDIR, $CASM_LIBDIR
7+
# 2) $CASM_PREFIX/include, $CASM_PREFIX/lib
8+
# 3) "/usr/local"
79
#
810
#export CASM_PREFIX="/usr/local"
11+
#export CASM_INCLUDEDIR="/usr/local/include"
12+
#export CASM_LIBDIR="/usr/local/lib"
913

1014

11-
# Recognized by install scripts and 'casm' CLI executable for locating boost install location
15+
# Recognized by install scripts and 'casm' CLI executable for locating boost
16+
# install location
1217
# Order of precedence:
13-
# 1) $CASM_BOOST_PREFIX
14-
# 2) "" (default uses system defaults)
18+
# 1) $CASM_BOOST_INCLUDEDIR, $CASM_BOOST_LIBDIR
19+
# 2) $CASM_BOOST_PREFIX/include $CASM_BOOST_PREFIX/lib
20+
# 3) "" (default uses system defaults)
1521
#
1622
#export CASM_BOOST_PREFIX=""
17-
18-
#
23+
#export CASM_BOOST_INCLUDEDIR=""
24+
#export CASM_BOOST_LIBDIR=""
25+
1926

2027
# Recognized by install scripts. Use this if linking to boost libraries compiled without c++11. If defined, (i.e. CASM_BOOST_NO_CXX11_SCOPED_ENUMS=1) will compile with -DBOOST_NO_CXX11_SCOPED_ENUMS option.
2128
# Order of precedence:

configure.ac

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# -*- Autoconf -*-
2+
# Process this file with autoconf to produce a configure script.
3+
4+
AC_PREREQ([2.69])
5+
AC_INIT([CASM],
6+
m4_esyscmd([tr -d '\n' < ./build-aux/casm_version.txt]),
7+
[casm-developers@lists.engr.ucsb.edu],
8+
[],
9+
[https://github.com/prisms-center/CASMcode])
10+
AC_CONFIG_AUX_DIR([build-aux]) #This is my doing
11+
AC_CONFIG_MACRO_DIR([build-aux/m4])
12+
#Rules to apply to every Makefile.am. Using tar-ustar due to loooooong file names (I'm looking at you Eigen)
13+
AM_INIT_AUTOMAKE([foreign subdir-objects 1.9 tar-ustar])
14+
15+
16+
AC_CONFIG_SRCDIR([src/casm/CASM_global_definitions.cc])
17+
AC_CONFIG_HEADERS([config.h])
18+
19+
# Checks for programs.
20+
AC_PROG_CXX
21+
AC_PROG_CC
22+
AC_PROG_CPP
23+
24+
## Checks for libraries.
25+
## FIXME: Replace `main' with a function in `-lgzstream':
26+
#AC_CHECK_LIB([gzstream], [main])
27+
## FIXME: Replace `main' with a function in `-lz':
28+
AC_CHECK_LIB([z], [gzread], [], AC_MSG_ERROR(gzread from z library not found!))
29+
AC_CHECK_LIB([dl], [dlopen], [], AC_MSG_ERROR(dlopen from dl library not found!))
30+
#AC_CHECK_LIB([z], [gzwrite])
31+
#AC_CHECK_LIB([z], [gzopen])
32+
#AC_CHECK_LIB([z], [gzclose])
33+
34+
#I added this
35+
LT_INIT([shared disable-static])
36+
AC_PROG_LIBTOOL
37+
LT_LIB_DLLOAD
38+
AC_DISABLE_STATIC
39+
if test "$enable_static" != "no"; then
40+
echo "Sorry Dave, I can't let you do that. Static libraries are currently disabled.";
41+
exit 1;
42+
fi;
43+
44+
AX_CXX_COMPILE_STDCXX_11
45+
BOOSTV=1.54
46+
AX_BOOST_BASE([$BOOSTV],[],AC_MSG_ERROR(You need Boost $BOOSTV libraries or higher.))
47+
AX_BOOST_FILESYSTEM
48+
AX_BOOST_SYSTEM
49+
AX_BOOST_REGEX
50+
AX_BOOST_CHRONO
51+
AX_BOOST_PROGRAM_OPTIONS
52+
AX_BOOST_UNIT_TEST_FRAMEWORK
53+
54+
#Where to install bash completion
55+
AC_ARG_WITH([bash-completion-dir],
56+
AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
57+
[Install the bash auto-completion script in this directory. @<:@default=yes@:>@]),
58+
[],
59+
[with_bash_completion_dir=yes])
60+
61+
if test "x$with_bash_completion_dir" = "xyes"; then
62+
PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
63+
[BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"],
64+
[BASH_COMPLETION_DIR="$datadir/bash-completion/completions"])
65+
else
66+
BASH_COMPLETION_DIR="$with_bash_completion_dir"
67+
fi
68+
69+
AC_SUBST([BASH_COMPLETION_DIR])
70+
AM_CONDITIONAL([ENABLE_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"])
71+
72+
73+
#Require at least this version
74+
AM_PATH_PYTHON([2.6])
75+
76+
# Checks for header files.
77+
AC_CHECK_HEADERS([float.h limits.h stdlib.h string.h sys/time.h unistd.h])
78+
79+
# Checks for typedefs, structures, and compiler characteristics.
80+
AC_CHECK_HEADER_STDBOOL
81+
AC_C_INLINE
82+
AC_TYPE_INT32_T
83+
AC_TYPE_INT64_T
84+
AC_C_RESTRICT
85+
AC_TYPE_SIZE_T
86+
AC_TYPE_UINT64_T
87+
AC_CHECK_TYPES([ptrdiff_t])
88+
89+
# Checks for library functions.
90+
AC_FUNC_ERROR_AT_LINE
91+
AC_FUNC_MALLOC
92+
AC_HEADER_MAJOR
93+
AC_FUNC_REALLOC
94+
AC_FUNC_STRTOD
95+
AC_CHECK_FUNCS([floor iswprint memmove memset mkdir pow rmdir select sqrt strchr strpbrk strrchr strstr strtol])
96+
97+
#Generate all the necessary files from *.in
98+
AC_CONFIG_FILES([Makefile])
99+
AC_CONFIG_FILES([tests/unit/App/run_test_App], [chmod +x tests/unit/App/run_test_App])
100+
AC_CONFIG_FILES([tests/unit/casm_io/run_test_casm_io], [chmod +x tests/unit/casm_io/run_test_casm_io])
101+
AC_CONFIG_FILES([tests/unit/clex/run_test_clex], [chmod +x tests/unit/clex/run_test_clex])
102+
AC_CONFIG_FILES([tests/unit/clusterography/run_test_clusterography], [chmod +x tests/unit/clusterography/run_test_clusterography])
103+
AC_CONFIG_FILES([tests/unit/container/run_test_container], [chmod +x tests/unit/container/run_test_container])
104+
AC_CONFIG_FILES([tests/unit/crystallography/run_test_crystallography], [chmod +x tests/unit/crystallography/run_test_crystallography])
105+
AC_CONFIG_FILES([tests/unit/monte_carlo/run_test_monte_carlo], [chmod +x tests/unit/monte_carlo/run_test_monte_carlo])
106+
AC_CONFIG_FILES([tests/unit/system/run_test_system], [chmod +x tests/unit/system/run_test_system])
107+
108+
109+
AC_OUTPUT

configure.mimic.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./configure --prefix=$(pwd)/builds/auto CXXFLAGS='-DNDEBUG -O3 --std=c++11 -Wno-deprecated-register -Wno-deprecated-declarations -DEIGEN_DEFAULT_DENSE_INDEX_TYPE=long -Wno-unused-parameter -DGZSTREAM_NAMESPACE=gz -fPIC'

0 commit comments

Comments
 (0)