Skip to content

Commit

Permalink
Refine (#45)
Browse files Browse the repository at this point in the history
* Extra guards for CMAKE, extra configurations for Travis.

* Modification to requirements.

* Bug fix.

* Fixed unset syntax.

* Skip make test option.

* Typo in run fortran

* Syntax error near if.

* Fixed another syntax error.
  • Loading branch information
william-dawson authored Apr 20, 2018
1 parent b56d6e5 commit 399cf2a
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 34 deletions.
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ matrix:
- os: linux
sudo: required
dist: trusty
env: TESTOS="LINUX"
env: TESTOS="LINUX" TESTEXAMPLES=1 MAKETEST=1
- os: linux
sudo: required
dist: trusty
env: TESTOS="LINUX" FORTRAN_ONLY=1 SKIPDOXYGEN=1 SKIPSWIG=1 MAKETEST=0
- os: linux
sudo: required
dist: trusty
env: TESTOS="LINUX" SKIPDOXYGEN=1 SKIPSWIG=1 MAKETEST=0
- os: osx
sudo: required
env: TESTOS="OSX"
env: TESTOS="OSX" MAKETEST=1

cache:
pip: true
Expand All @@ -32,6 +40,6 @@ script:
- cd Build
- bash ../UnitTests/travis_run_cmake.sh
- make
- make test
- if [ "$MAKETEST" = 1 ]; then make test; fi
- cd ../UnitTests/
- bash travis_check_examples.sh
30 changes: 14 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ cmake_minimum_required (VERSION 3.2)
project(NTPoly)
set(CMAKE_VERBOSE_MAKEFILE ON)
enable_language(Fortran)

################################################################################
## Packages
find_package(MPI REQUIRED)
find_package(Doxygen)
find_package(SWIG 3.0)

################################################################################
## Testing
if (NOT FORTRAN_ONLY)
enable_testing()
else()
MESSAGE("Fortran only! No local testing will be generated.")
endif()

################################################################################
Expand All @@ -23,24 +30,15 @@ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/scratch)

################################################################################
## Documentation
find_package(Doxygen REQUIRED)
configure_file(${CMAKE_SOURCE_DIR}/Doxyfile.in
${CMAKE_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile)
if (DOXYGEN_FOUND)
configure_file(${CMAKE_SOURCE_DIR}/Doxyfile.in
${CMAKE_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile)
else()
MESSAGE("Doxygen not found! No documentation will be generated.")
endif()

################################################################################
## Toolchain File
#if(CMAKE_BUILD_TYPE MATCHES Debug)
# set(CMAKE_Fortran_FLAGS_DEBUG ${F_TOOLCHAINFLAGS_DEBUG})
# set(CMAKE_CXX_FLAGS_DEBUG ${CXX_TOOLCHAINFLAGS_DEBUG})
#elseif(CMAKE_BUILD_TYPE MATCHES Release)
# set(CMAKE_Fortran_FLAGS_RELEASE ${F_TOOLCHAINFLAGS_RELEASE})
# set(CMAKE_CXX_FLAGS_RELEASE ${CXX_TOOLCHAINFLAGS_RELEASE})
#else()
# set(CMAKE_Fortran_FLAGS ${F_TOOLCHAINFLAGS_RELEASE})
# set(CMAKE_CXX_FLAGS ${CXX_TOOLCHAINFLAGS_RELEASE})
#endif()

set(CMAKE_Fortran_FLAGS_DEBUG ${F_TOOLCHAINFLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_DEBUG ${CXX_TOOLCHAINFLAGS_DEBUG})
set(CMAKE_Fortran_FLAGS_RELEASE ${F_TOOLCHAINFLAGS_RELEASE})
Expand Down
15 changes: 15 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ repository. We of course recommend that you download a
[release version](https://github.com/william-dawson/NTPoly/releases)
to get started.

Installing NTPoly requires the following software:
* A Fortran Compiler.
* An MPI Installation (MPI-3 Standard+).
* CMake (Version 3.2+).

The following optional software can greatly enhance the NTPoly experience:
* BLAS: for multiplying dense matrices, if they emerge in the calculation.
* A C++ Compiler for building C++ bindings.
* Doxygen: for building documentation.
* Python (Version 2.7+): for testing.
* MPI4PY: for testing.
* SciPy: for testing.
* NumPy: for testing.
* SWIG (Version 3.0+): for building the Python bindings.

NTPoly uses CMake as a build system. First, take a look in the Targets
directory. You'll find a list of `.cmake` files which have example configurations
on popular systems. You should copy one of these files, and create your own
Expand Down
4 changes: 2 additions & 2 deletions Source/Swig/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
################################################################################
FIND_PACKAGE(SWIG 3.0)

if (SWIG_FOUND)
# Determine python path using python's distutils module
if(NOT DEFINED PYTHON_EXECUTABLE)
Expand Down Expand Up @@ -34,4 +32,6 @@ if (SWIG_FOUND)
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/python
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/python
)
else()
MESSAGE("Swig not found! No python bindings will be generated.")
endif()
26 changes: 15 additions & 11 deletions UnitTests/travis_before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,22 @@ if [[ "$TESTOS" == "OSX" ]]; then
else
sudo ldconfig
sudo apt-get install python-dev
sudo apt-get install doxygen
if [ -f "swig-3.0.12/README" ]; then
echo "Using cached swig";
else
wget https://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz;
tar xvf swig-3.0.12.tar.gz >/dev/null;
if [[ -z ${SKIPDOXYGEN+x} ]]; then
sudo apt-get install doxygen
fi
if [[ -z ${SKIPSWIG+x} ]] ; then
if [ -f "swig-3.0.12/README" ]; then
echo "Using cached swig";
else
wget https://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz;
tar xvf swig-3.0.12.tar.gz >/dev/null;
fi
cd swig-3.0.12;
./configure >/dev/null 2>&1;
make >/dev/null 2>&1;
sudo make install >/dev/null 2>&1
cd ../
fi
cd swig-3.0.12;
./configure >/dev/null 2>&1;
make >/dev/null 2>&1;
sudo make install >/dev/null 2>&1
cd ../
sudo pip install scipy --upgrade
sudo pip install numpy --upgrade
sudo pip install mpi4py --upgrade
Expand Down
4 changes: 3 additions & 1 deletion UnitTests/travis_check_examples.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
if [[ "$TESTOS" == "LINUX" ]]; then
if [ -z ${TESTEXAMPLES+x} ]; then
echo "Skipping examples"
else
python testBuildInstructions.py ../Examples/GraphTheory/ run-fortran
python testBuildInstructions.py ../Examples/GraphTheory/ run-c++
python testBuildInstructions.py ../Examples/GraphTheory/ run-python
Expand Down
7 changes: 6 additions & 1 deletion UnitTests/travis_run_cmake.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
if [[ "$TESTOS" == "OSX" ]]; then
cmake -DCMAKE_TOOLCHAIN_FILE=../Targets/Mac-python2.cmake .. ;
else
cmake -DCMAKE_TOOLCHAIN_FILE=../Targets/Linux.cmake .. ;
if [ -z ${FORTRAN_ONLY+x} ]; then
cmake -DCMAKE_TOOLCHAIN_FILE=../Targets/Linux.cmake .. ;
else
cmake -DCMAKE_TOOLCHAIN_FILE=../Targets/Linux.cmake \
-DFORTRAN_ONLY=YES .. ;
fi
fi

0 comments on commit 399cf2a

Please sign in to comment.