Skip to content

Commit

Permalink
Initial public release
Browse files Browse the repository at this point in the history
  • Loading branch information
samarabdi committed May 20, 2016
0 parents commit 1345cb4
Show file tree
Hide file tree
Showing 115 changed files with 23,828 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
*.a
build/
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
cmake_uninstall.cmake
*Config.cmake
*ConfigVersion.cmake
core/config.h
CPackConfig.cmake
CPackSourceConfig.cmake
install_manifest.txt
Makefile
*.pb.cc
*.pb.h
*Targets.cmake
_CPack_Packages/
.deb
doc/
72 changes: 72 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
sudo: required

language: cpp

compiler:
- clang
- gcc

# N.B. - The P4 cmake configure step under Travis will install all of its dependencies,
# some of which overlap with our dependencies. Notably:
# - nanomsg
# - nnpy
# - libpcap
before_install:
# Before anything else, lint it to make sure everything's good
- sudo pip install cpplint
- .travis/run_lint.sh
# Copy pasted from https://github.com/jdm64/saphyr/blob/8808c34dec4f94f86a8dd6a832037cba4ba2d88a/.travis.yml
- sudo cp /etc/apt/sources.list /etc/apt/sources.list.d/trusty.list
- sudo sed -i 's/precise/trusty/g' /etc/apt/sources.list.d/trusty.list
- sudo apt-get update -qq
- sudo apt-get install -qq -y --force-yes flexc++ bisonc++ protobuf-compiler libprotobuf-dev python-setuptools
#
# Install SystemC
- wget http://www.accellera.org/images/downloads/standards/systemc/systemc-2.3.1.tgz
- tar -xzf systemc-2.3.1.tgz
- cd systemc-2.3.1
- ./configure --prefix=/usr --with-unix-layout
- make
- sudo make install
- cd ..

# Build and install our packages
install:
- cmake .
- make
- sudo make install

# Test that the libraries was installed correctly
script:
# Test that both are installed properly
# TODO(gordon) - (cd tests/PFP-P4 && cmake .)
# TODO(gordon) - (cd tests/PFPSIM && cmake .)
# Test that a simple PFPSIM project works
- (mkdir -p tests/simple-pfp/simple/build && cd tests/simple-pfp/simple/build && cmake ../src && make && ./simple-sim -v debug)
# Test uninstall
- sudo make uninstall && sudo rm install_manifest.txt
# TODO(gordon) - (cd tests/PFP-P4/ && ./check-cmake-fails)
# TODO(gordon) - (cd tests/PFP-P4/ && ./check-cmake-fails)
# Test making deb package and installing it
- make package
- sudo dpkg -i pfpsim-$VERSION_NUMBER-Linux.deb
# Test that both are installed properly
# TODO(gordon) - (cd tests/PFP-P4 && cmake .)
# TODO(gordon) - (cd tests/PFPSIM && cmake .)
# Test that a simple PFPSIM project works
- (mkdir -p tests/simple-pfp/simple/build && cd tests/simple-pfp/simple/build && cmake ../src && make && for i in {1..100}; do ./simple-sim -v debug; done)

before_deploy:
- mv pfpsim-$VERSION_NUMBER-Linux.deb pfpsim-$VERSION_NUMBER-Linux-$CXX.deb

env:
global:
- VERSION_NUMBER=$(.travis/get_version_from_tag.sh complete)
deploy:
provider: releases
api_key:
secure: "PwoOnJFSC/x1hW2zJ0oicOKSGz44gurQvMmMsg/bKgbzJ66xHzu6CuEOa/y9oMbb/zu6za+Cm2wbU4hTuvQIUA17zEiTfOw8hwSgH0Iu8l8Go7G3FqjduiWC/1o9yzZ3Zanyz/HD97LzlWUIN2FdfrtHjivazIPlaVt4/L6qTUlNdmue6mt3F8qU2sjSn1ibvYsXy4+2fm0sDY+/fkvk57+Y8SAgAfrUHvx0rFFJZ/zyTCXH0NKPbXQT+2yq5h4DMpp4+dq/q9dUcbdLATAZ/nmhfOWJ+fWRj0YMsteKm1vzZFt6DbYeL5h+GHu9ZqJs6fOw47BOjut+TyRf8+eASIqk6stkrH29aroVAYYeQbbj34HJrOIHshpvrwU3t+wVVKeP3CvXa/LciQB73MrZNgx2PkfTDSYmsUPM4qAsrQ+79iMk3UbRVp2WLIVJKMADnZuQS+Vyn9GXH7wg+hpt7kuoK2lvqHPFsln9/drQARnWvTayq9LfNjENfb8i/NfGpe3Rks2kzpCsj3Ti27f6zKf8XciGxrrEBvRvHP6Ho5RBWdZk7D1lPE+QkFba/5N7Mcwx0eIKZHFxvtsExagIIvOQHmjTqHuqr+UOc4htJPituuJ3aIoM5l47mOw4p3oUlB19JckV8RsrI+0BrQYURIaOvd1ttZuXMMoeU7upGow="
file: pfpsim-$VERSION_NUMBER-Linux-$CXX.deb
skip_cleanup: true
on:
tags: true
55 changes: 55 additions & 0 deletions .travis/get_version_from_tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
#
# PFPSim: Library for the Programmable Forwarding Plane Simulation Framework
#
# Copyright (C) 2016 Concordia Univ., Montreal
# Samar Abdi
# Umair Aftab
# Gordon Bailey
# Faras Dewal
# Shafigh Parsazad
# Eric Tremblay
#
# Copyright (C) 2016 Ericsson
# Bochra Boughzala
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#


# If a tag is not set, return 0
if [ -z "$TRAVIS_TAG" ]
then
complete=0.0.0
major=0
minor=0
patch=0
else
# Split the version number on dots, storing it in an array
complete=$(echo $TRAVIS_TAG | tr -d v )
major=$(echo $complete | awk 'BEGIN {FS="."} {print $1}')
minor=$(echo $complete | awk 'BEGIN {FS="."} {print $2}')
patch=$(echo $complete | awk 'BEGIN {FS="."} {print $3}')
fi


case $1 in
major) echo -n $major;;
minor) echo -n $minor;;
patch) echo -n $patch;;
complete) echo -n $complete;;
*) echo -n $complete;;
esac
71 changes: 71 additions & 0 deletions .travis/run_lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash
#
# PFPSim: Library for the Programmable Forwarding Plane Simulation Framework
#
# Copyright (C) 2016 Concordia Univ., Montreal
# Samar Abdi
# Umair Aftab
# Gordon Bailey
# Faras Dewal
# Shafigh Parsazad
# Eric Tremblay
#
# Copyright (C) 2016 Ericsson
# Bochra Boughzala
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#


# cpplint
# Script for running cpplint on a directory of code (.h and .cpp files only)
#
# Author: Eric Tremblay
# Created on: April 25th, 2016
#
# Usage: ./run_lint.sh [pattern]
# The optional pattern is used to grep the output. Useful if looking to fix a particular category of errors.

# Filters: -x --> ignore category x
# +y --> don't ignore category y
# Separate each by a comma with no space
# Example: -whitespace,+whitespace/braces --> ignores all 'whitespace' errors except the 'whitespace/braces' errors.
filters="-legal/copyright,-runtime/references,-build/include_subdir,-build/c++11"

# Root Directory: Used to determine appropriate header guards
# The path must be relative to the location of the directory containing the .git file
# Do not put a / at the end
# Example: rmt/src --> Old header guards: RMT_SRC_BEHAVIOURAL_LOGGER_H_, New header guards: BEHAVIOURAL_LOGGER_H_
root_dir="pfpsim"

# Lint Directory: Directory in which to start linting. The path is relative to where this script is run.
# Examples: ../src or .
lint_dir="pfpsim"

# Exclude Directories: Directories to exclude. Directories should be specified relative to the Lint Directory.
# Use regex syntax. In particular, must escape all . and all /. Use | to separate multiple directories
# Use NO_EXCLUDE_DIRS if there is nothing to exclude.
# Example: \.\.\/build\/|\.\.\/src\/tries\/ --> excludes ../build and ../src/tries/
exclude_dirs="pfpsim\/doxygen\/|pfpsim\/core\/proto\/|pfpsim\/core\/cp\/CommandParser.cpp|pfpsim\/core\/cp\/CommandScanner.cpp|pfpsim\/core\/cp\/CommandParserbase.h|pfpsim\/core\/cp\/CommandScannerbase.h|pfpsim\/core\/cmake\/"

# Lint Command: Command to run cpplint. Should not have to be modified.
lint_command="cpplint --root="${root_dir}" --counting=detailed --filter="${filters}" $( find "${lint_dir}" -name \*.h -or -name \*.cpp | grep -vE "${exclude_dirs}" )"

if [ $# -eq 0 ]; then
${lint_command}
else
${lint_command} 2>&1 | grep --color "$1"
fi
61 changes: 61 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#
# PFPSim: Library for the Programmable Forwarding Plane Simulation Framework
#
# Copyright (C) 2016 Concordia Univ., Montreal
# Samar Abdi
# Umair Aftab
# Gordon Bailey
# Faras Dewal
# Shafigh Parsazad
# Eric Tremblay
#
# Copyright (C) 2016 Ericsson
# Bochra Boughzala
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

project(pfpsim)

cmake_minimum_required(VERSION 2.8.7)

#--------------OPTION FLAGS------------------------------------------------
option(PFPSIM "PFPSIM" ON) # cmake -DPFPSIMCORE=ON|OFF
option(PFP-P4 "PFP-P4" ON) #cmake -DPFP-P4=ON|OFF

#--------------Add Subdirectories------------------------------------------------
if("${PFP-P4}" MATCHES "ON")
message (STATUS "Install PFP-P4? Yes")
add_subdirectory(pfp-p4)
else ()
message (STATUS "Install PFP-P4? No")
endif()

if("${PFPSIM}" MATCHES "ON")
message (STATUS "Install PFPSIM? Yes")
add_subdirectory(pfpsim)
else ()
message (STATUS "Install PFPSIM? No")
endif()

#------------------------ uninstall target -----------------
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
Loading

0 comments on commit 1345cb4

Please sign in to comment.