Skip to content

Commit

Permalink
Merge branch 'release/0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
acgetchell committed Aug 18, 2018
2 parents 6d76f6e + 2175fdb commit 4cd1a19
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 105 deletions.
20 changes: 5 additions & 15 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#version: 1.0.(build)
version: 0.1.2.{build}

platform:
- x64
Expand All @@ -18,21 +18,13 @@ shallow_clone: true

configuration: Release

#cache:
# - C:\.conan
# - C:\Users\appveyor\.conan -> registry.txt

install:
# Upgrade pip
- python -m pip install --upgrade pip
# Install Conan
- echo "Downloading conan..."
- set PATH=%PATH%;%PYTHON%\Scripts\
- pip.exe install conan
- conan user # create the conan data directory
- conan --version
# Verify CMake
- cmake --version

before_build:
- cd C:\projects\causal-sets-explorer
Expand All @@ -41,18 +33,16 @@ before_build:
build_script:
- mkdir build
- cd build
- conan install .. --build=missing
- conan profile new default --detect
- conan install .. -pr default --build=missing
- conan build ..

on_success:
# - cd bin
- causal_sets_explorer.exe
# - causal_sets_explorer.exe

test_script:
- cd bin
- pwd
- causal_sets_explorer_test.exe
# - cmake --build .. --target test
- ctest -C Release

notifications:
- provider: Email
Expand Down
6 changes: 0 additions & 6 deletions .ci/gcc

This file was deleted.

50 changes: 25 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: cpp
sudo: false
dist: trusty
osx_image: xcode9.1
dist: xenial

addons:
apt:
Expand All @@ -11,15 +10,17 @@ addons:
- clang-6.0
- valgrind
- python3-pip
- python3-setuptools
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- sourceline: "ppa:ubuntu-toolchain-r/test"
# - ubuntu-toolchain-r-test
# - llvm-toolchain-trusty-6.0

cache:
- pip
- ccache
- directories:
- /home/travis/.conan/data/
# - directories:
# - /home/travis/.conan/data/

os:
- linux
Expand All @@ -35,26 +36,26 @@ matrix:
# - os: linux
# - compiler: gcc
# - env: VALGRIND=true
# allow_failures:
# - os: linux
# compiler: clang
allow_failures:
- os: osx
compiler: gcc

before_install:
# Workaround for https://github.com/travis-ci/travis-ci/issues/6307
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
rvm get stable --auto-dotfiles
brew update
python -m pip install --upgrade pip
fi
install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew install ccache
export PATH="/usr/local/opt/ccache/libexec:$PATH"
brew install gcc
brew link --overwrite gcc
if [[ "$CXX" == "g++" ]]; then
brew install gcc
brew link --overwrite gcc
fi
brew install ninja
brew install conan
else
Expand All @@ -66,27 +67,26 @@ install:

script:
- mkdir build && cd build
- conan profile new default --detect
# Use Ninja
- conan profile update env.CONAN_CMAKE_GENERATOR=Ninja default
- |
if [[ "$CXX" == "g++" ]]; then
conan install .. --build=missing -pr ./.ci/gcc
if [[ "$TRAVIS_OS_NAME" == "osx" && "$CXX" == "clang++" ]]; then
echo osx/clang autodetected libcxx is fine
conan install .. -pr default --build=missing
else
conan install .. --build=missing
conan profile update settings.compiler.libcxx=libstdc++11 default
conan install .. -pr default --build=missing
fi
- conan build ..

after_success:
- cmake --version
- cd bin
- ./causal_sets_explorer
# - ./causal_sets_explorer_test
- if [[ ${VALGRIND} == "true" ]]; then valgrind --leak-check=full --show-leak-kinds=all ./causal_sets_explorer
# CTest
- cmake --build .. --target test
- ctest

notifications:
webhooks:
urls:
- https://www.travisbuddy.com

on_success: change
on_success: never
on_failure: always
57 changes: 27 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,50 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.11)

project(causal_sets_explorer VERSION 0.1 LANGUAGES CXX)
project(causal_sets_explorer VERSION 0.1.2 LANGUAGES CXX)

if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
else()
message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.")
execute_process(COMMAND conan install .. --build=missing)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Do not build in-source.
Please remove CMakeCache.txt and the CMakeFiles/ directory. Then build out-of-source.")
endif()

# Activate C++17 support
# Run Conan from CMake
# Download automatically, you can also just copy the conan.cmake file
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.12/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()

include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(CONANFILE conanfile.py # or relative build/conanfile.txt
BASIC_SETUP CMAKE_TARGETS
BUILD missing)

#Activate C++ 17 support
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Disable CLion generation of RelWithDebInfo and MinSizeRel, et. al
#Disable CLion generation of RelWithDebInfo and MinSizeRel, et.al
set(CMAKE_CONFIGURATION_TYPES "Release" "Debug" CACHE STRING "" FORCE)

include_directories(src)
file(GLOB_RECURSE PROJECT_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")

#Extra warnings
#add_definitions(-Wall)

# Exclude main file for library generation, only use it in the final
# executable. This lets us test everything without compiling twice.
set(PROJECT_MAIN "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
list(REMOVE_ITEM PROJECT_SOURCE ${PROJECT_MAIN})

# Build our project with the help of conan.
include_directories(${CONAN_INCLUDE_DIRS})
add_library(causal_sets_explorerlib STATIC ${PROJECT_SOURCE})
add_executable(causal_sets_explorer ${PROJECT_MAIN})
target_link_libraries(causal_sets_explorer causal_sets_explorerlib ${CONAN_LIBS})
#Build our project with the help of conan.
add_executable(causal_sets_explorer ${PROJECT_SOURCE_DIR}/src/main.cpp)
target_link_libraries(causal_sets_explorer CONAN_PKG::boost CONAN_PKG::catch2)
target_compile_features(causal_sets_explorer PRIVATE cxx_std_17)

# Now enable our tests
#Now enable our tests
enable_testing()
add_subdirectory(tests)

#CTest Integration tests
include(CTest)

# Does the causal_sets_explorer run?
add_test(NAME causal_sets_explorer-Run
COMMAND causal_sets_explorer)
# --config $<CONFIGURATION>)
# --exe $<TARGET_FILE:causal_sets_explorer>)
#Does the causal_sets_explorer run ?
add_test(NAME causal_sets_explorer-Run COMMAND $<TARGET_FILE:causal_sets_explorer>)
set_tests_properties(causal_sets_explorer-Run
PROPERTIES
PASS_REGULAR_EXPRESSION "digraph")

40 changes: 33 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,53 @@
It's also a test-bed for [CDT-plusplus].

## Initial Set Up
This project uses the [Conan C/C++ package manager][conan]. To get started on MacOS
using [Homebrew][homebrew], for example, do:
This project uses the [Conan C/C++ package manager][conan].
To get started, first install `Conan`.

On MacOS using [Homebrew][homebrew], for example, do:

~~~
brew install conan
~~~

On Windows/Linux:
~~~
pip install conan
~~~

Next, clone this repo:

~~~
git clone https://github.com/acgetchell/causal-sets-explorer.git
cd causal-sets-explorer
~~~

Next, we'll let `Conan` auto-detect your compiler settings:

~~~
conan profile new default --detect
~~~

Now, `Conan` will build and link all the dependencies and compile:

~~~
mkdir build && cd build
conan install .. --build=missing -s compiler=apple-clang -s compiler.version=9.1 -s compiler.libcxx=libc++
conan install .. -pr default
conan build ..
~~~

Linux and Windows are nearly identical, with `pip install conan` replacing `brew install conan`.
The executable will be in the `bin` directory.

If you want to run tests, you can do:

You must also specify compiler options; the above example is for macOS. It's probably better to use a [profile].
~~~
ctest -C Release
~~~

(Note that on Linux, you should actually use pip3 and Python 3 in order to avoid [SNIMIssingWarning][sni].)
This is mostly automated in the `build.sh` script.

[conan]: https://www.conan.io
[causets]: https://en.wikipedia.org/wiki/Causal_sets
[homebrew]: https://brew.sh/
[sni]: https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning
[cdt-plusplus]: https://github.com/acgetchell/CDT-plusplus
[profile]: https://github.com/acgetchell/causal-sets-explorer/blob/devel/.ci/gcc
9 changes: 7 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash
rm -rf build/
mkdir build && cd build
conan install .. --build=missing -s compiler=apple-clang -s compiler.version=9.1 -s compiler.libcxx=libc++
conan build ..
#cmake -DCMAKE_BUILD_TYPE=Debug ..
#cmake --build .
#cmake --build . --target test

conan install .. -pr default
conan build ..
ctest
6 changes: 2 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CausalSetsExplorer(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "boost/1.67.0@conan/stable", "catch2/2.3.0@bincrafters/stable"
requires = "boost/1.67.0@conan/stable", "catch2/2.2.2@bincrafters/stable"
generators = "cmake"
default_options = "Boost:header_only=True"

Expand All @@ -13,6 +13,4 @@ def build(self):
cmake.build()

def build_requirements(self):
# AppVeyor already has modern CMake installed
if self.settings.os != "Windows":
self.build_requires("cmake_installer/3.11.3@conan/stable")
self.build_requires("cmake_installer/3.11.3@conan/stable")
6 changes: 0 additions & 6 deletions src/dummy.cpp

This file was deleted.

14 changes: 4 additions & 10 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.11)

file(GLOB_RECURSE TEST_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
add_executable(causal_sets_explorer_test ${PROJECT_SOURCE_DIR}/tests/main.cpp GraphTest.cpp)
target_link_libraries(causal_sets_explorer_test CONAN_PKG::boost CONAN_PKG::catch2)

add_executable(causal_sets_explorer_test ${TEST_SOURCE})
target_link_libraries(causal_sets_explorer_test causal_sets_explorerlib ${CONAN_LIBS})
# We run our test from the source directory, so we can consistently
# load files with known paths.
# I also like color in my verbose output, so I put in a --force-colour flag.
add_test(NAME causal_sets_explorer_tests
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_BINARY_DIR}/bin/causal_sets_explorer_test --force-colour)
add_test(NAME causal_sets_explorer-Graph COMMAND $<TARGET_FILE:causal_sets_explorer_test>)

0 comments on commit 4cd1a19

Please sign in to comment.