Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctest support added. test/CMakeLists cleanup #39

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ nosetests.xml
.pydevproject

MANIFEST
/nbproject/
17 changes: 15 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
language: cpp

dist: trusty
sudo: required

cache:
apt: true


compiler:
- gcc
- clang
- clang

env:
- TARGET=cpp
- PYVERSION=2.6.9
Expand All @@ -13,15 +22,19 @@ env:
before_install:
# contains mostly new versions of gcc
- echo "yes" | sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- echo "yes" | sudo add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.8 main" -y
# this one contains python 2.6.9
- if [ "$PYVERSION" = "2.6.9" ]; then sudo add-apt-repository ppa:fkrull/deadsnakes -y ; fi
- sudo apt-get update -qq
- sudo apt-get install -qq

install:
- echo "== Install step =="
- if [[ "$CC" == gcc* ]]; then sudo apt-get install -y --no-install-recommends gcc-6 g++-6 ; fi
- if [[ "$CC" == clang* ]]; then sudo apt-get install -y --no-install-recommends clang-3.8 libc++-dev ; fi

script:
- if [[ "$CC" == gcc* ]]; then export CXX=g++-6 CC=gcc-6 ; fi
- if [[ "$CC" == clang* ]]; then export CXXFLAGS="-stdlib=libc++" CXX=clang++-3.8 CC=clang-3.8 ; fi
- if [ "$TARGET" = "cpp" ]; then sh travis/build_cpp.sh ; fi
- if [ ! "$TARGET" = "cpp" ]; then cd pybindings ; fi
- if [ ! "$TARGET" = "cpp" ] && [ "$PYVERSION" = "2.6.9" ]; then source ../travis/prepare_py26.sh ; fi
Expand Down
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.6)
cmake_minimum_required (VERSION 3.1)
project (PlateTectonics)
add_library(PlateTectonics src/sqrdmd.cpp src/heightmap.cpp src/lithosphere.cpp src/plate.cpp src/rectangle.cpp src/platecapi.cpp src/simplexnoise.cpp src/noise.cpp src/utils.cpp src/simplerandom.cpp src/plate_functions.cpp src/bounds.cpp src/movement.cpp src/mass.cpp src/segments.cpp src/world_point.cpp src/geometry.cpp src/segment_creator.cpp src/segment_data.cpp)

Expand Down Expand Up @@ -43,19 +43,19 @@ if(MSVC)
endforeach()
endif()
endif()

# -fp-model disable floating point optimization, for the sake of having
# reproducible results across platforms
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
ELSE()
set(CMAKE_C_FLAGS "-std=c99 -O3")
set(CMAKE_CXX_FLAGS "-O3 -g -rdynamic")
ENDIF()
#
## -fp-model disable floating point optimization, for the sake of having
## reproducible results across platforms
#IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
#ELSE()
set (CMAKE_CXX_STANDARD 14)
#ENDIF()

option(WITH_EXAMPLES "compile also the example" OFF)
option(WITH_TESTS "compile also the tests" ON)

IF(WITH_TESTS)
enable_testing()
add_subdirectory (test)
ENDIF(WITH_TESTS)
IF(WITH_EXAMPLES)
Expand Down
2 changes: 2 additions & 0 deletions pybindings/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from setuptools import setup, Extension, Command
import os
import shutil
import sys


def ensure_clean_dir(f):
if os.path.exists(f):
Expand Down
6 changes: 3 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cmake_minimum_required (VERSION 2.6)

add_subdirectory (googletest)

project (PlateTectonicsTests)

add_executable(PlateTectonicsTests test_acceptance.cpp test_heightmap.cpp test_plate.cpp test_rectangle.cpp test_sqrdmd.cpp test_randomness.cpp test_portability.cpp test_bounds.cpp test_mass.cpp test_movement.cpp)

add_test(NAME PlateTectonicsTests COMMAND PlateTectonicsTests)

include_directories("../src" "googletest/include" ${PNG_INCLUDE_DIR})

# Standard linking to gtest stuff.
Expand Down
2 changes: 1 addition & 1 deletion travis/build_cpp.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
$CXX --version
cmake . -G 'Unix Makefiles'
cmake . -DCMAKE_BUILD_TYPE=Release
make
cd test
make
Expand Down
2 changes: 1 addition & 1 deletion travis/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
$PYCMD --version
sudo $PIP install -r dev-requirements.txt
sudo $PYCMD setup.py clean build sdist develop
sudo $PYCMD setup.py nosetests
sudo $PYCMD setup.py nosetests
2 changes: 1 addition & 1 deletion travis/prepare_py26.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo apt-get install python2.6 python2.6-dev
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O ez_setup.py
wget https://bootstrap.pypa.io/ez_setup.py O ez_setup.py
sudo python2.6 ez_setup.py
sudo easy_install-2.6 pip
export PYCMD="python2.6"
Expand Down