diff --git a/.travis.yml b/.travis.yml index d34306df..019dc8d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index b8c83869..409d73be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() ################################################################################ @@ -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}) diff --git a/ReadMe.md b/ReadMe.md index ab715cdc..fc2deb75 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -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 diff --git a/Source/Swig/CMakeLists.txt b/Source/Swig/CMakeLists.txt index 2951a7c5..86f89a95 100644 --- a/Source/Swig/CMakeLists.txt +++ b/Source/Swig/CMakeLists.txt @@ -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) @@ -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() diff --git a/UnitTests/travis_before_install.sh b/UnitTests/travis_before_install.sh index 26740cac..d7731219 100644 --- a/UnitTests/travis_before_install.sh +++ b/UnitTests/travis_before_install.sh @@ -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 diff --git a/UnitTests/travis_check_examples.sh b/UnitTests/travis_check_examples.sh index 78d90d6b..64e805be 100644 --- a/UnitTests/travis_check_examples.sh +++ b/UnitTests/travis_check_examples.sh @@ -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 diff --git a/UnitTests/travis_run_cmake.sh b/UnitTests/travis_run_cmake.sh index 07e131b7..f6e70d05 100644 --- a/UnitTests/travis_run_cmake.sh +++ b/UnitTests/travis_run_cmake.sh @@ -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