Skip to content

Commit

Permalink
Merge pull request #60 from abs-tudelft/assets
Browse files Browse the repository at this point in the history
Add assets workflow and update CMake files
  • Loading branch information
mbrobbel authored Mar 31, 2021
2 parents 3b1ae4c + 910b7b6 commit 59c486c
Show file tree
Hide file tree
Showing 11 changed files with 262 additions and 98 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Assets

on:
release:
types:
- created
pull_request:

env:
CMAKE_VERSION: '3.20.0'

jobs:
archive:
name: Linux
runs-on: ubuntu-latest
container: centos:7
strategy:
matrix:
sim:
- ON
- OFF
steps:
- name: Install dependencies
run: |
yum install -y epel-release
yum install -y curl make gcc gcc-c++ rpm-build git
- name: Install CMake
run: curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz | tar xz --strip-components=1 -C /usr
- uses: actions/checkout@v2
- name: Configure
run: cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_FLETCHER_AWS-SIM=${{ matrix.sim }}
- name: Package
run: make -j package
- id: tarball
run: echo "##[set-output name=name;]$(ls fletch*.tar.gz)"
- name: Install
run: tar xvfz ./${{ steps.tarball.outputs.name }} -C /usr
- name: Upload tarball
uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.tarball.outputs.name }}
asset_name: ${{ steps.tarball.outputs.name }}
asset_content_type: application/octet-stream

centos:
name: CentOS
runs-on: ubuntu-latest
strategy:
matrix:
version:
- 7
- 8
sim:
- ON
- OFF
container: centos:${{ matrix.version }}
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
yum install -y epel-release
yum install -y curl make rpm-build gcc gcc-c++ git
- name: Install CMake
run: curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz | tar xz --strip-components=1 -C /usr
- name: Configure
run: cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_FLETCHER_AWS-SIM=${{ matrix.sim }}
- name: Package
run: make -j package
- id: rpm
run: echo "##[set-output name=name;]$(ls fletch*.rpm)"
- name: Upload rpm
uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.rpm.outputs.name }}
asset_name: ${{ steps.rpm.outputs.name }}
asset_content_type: application/octet-stream

ubuntu:
name: Ubuntu
strategy:
matrix:
version:
- 18.04
- 20.04
sim:
- ON
- OFF
runs-on: ubuntu-${{ matrix.version }}
steps:
- uses: actions/checkout@v2
- name: Configure
run: cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_FLETCHER_AWS-SIM=${{ matrix.sim }}
- name: Package
run: make -j package
- id: deb
run: echo "##[set-output name=name;]$(ls fletch*.deb)"
- name: Upload deb
uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.deb.outputs.name }}
asset_name: ${{ steps.deb.outputs.name }}
asset_content_type: application/octet-stream
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Test

on:
push:
branches:
- master
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: CMake
run: cmake -DBUILD_FLETCHER_AWS-SIM=ON .
- name: Build
run: make -j
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

122 changes: 122 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(fletcher_aws
VERSION 0.2.0
DESCRIPTION "Fletcher platform support for Amazon AWS F1"
HOMEPAGE_URL "https://github.com/abs-tudelft/fletcher-aws"
LANGUAGES C
)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
endif()

include(FetchContent)

FetchContent_Declare(cmake-modules
GIT_REPOSITORY https://github.com/abs-tudelft/cmake-modules.git
GIT_TAG master
)
FetchContent_MakeAvailable(cmake-modules)

FetchContent_Declare(fletcher
GIT_REPOSITORY https://github.com/abs-tudelft/fletcher.git
GIT_TAG 0.0.19
)
if(NOT fletcher_POPULATED)
FetchContent_Populate(fletcher)
add_subdirectory(${fletcher_SOURCE_DIR}/common/c ${fletcher_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

include(CompileUnits)

include(ExternalProject)

cmake_policy(SET CMP0097 NEW)
ExternalProject_Add(aws-fpga
GIT_REPOSITORY https://github.com/aws/aws-fpga.git
GIT_TAG v1.4.17
GIT_SHALLOW ON
GIT_SUBMODULES ""
CONFIGURE_COMMAND ""
SOURCE_SUBDIR sdk/userspace
BUILD_IN_SOURCE ON
BUILD_COMMAND ./mkall_fpga_mgmt_tools.sh
BUILD_BYPRODUCTS <SOURCE_DIR>/hdk/common/software/src/fpga_pci_sv.c
INSTALL_COMMAND ""
)
ExternalProject_Get_property(aws-fpga SOURCE_DIR)

add_library(fpga_mgmt INTERFACE)
target_include_directories(fpga_mgmt INTERFACE ${SOURCE_DIR}/sdk/userspace/include)

add_library(fpga_mgmt_shared SHARED IMPORTED)
add_dependencies(fpga_mgmt_shared aws-fpga)
set_target_properties(fpga_mgmt_shared PROPERTIES IMPORTED_LOCATION ${SOURCE_DIR}/sdk/userspace/lib/so/libfpga_mgmt.so)
target_link_libraries(fpga_mgmt INTERFACE fpga_mgmt_shared)

add_library(fpga_pci_sv INTERFACE)
add_dependencies(fpga_pci_sv aws-fpga)
target_include_directories(fpga_pci_sv INTERFACE
${SOURCE_DIR}/sdk/userspace/include
${SOURCE_DIR}/hdk/common/software/include
)

add_subdirectory(runtime)

compile_units()

execute_process (
COMMAND bash -c "awk -F= '/^ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
OUTPUT_VARIABLE OS_NAME
)

execute_process (
COMMAND bash -c "awk -F= '/^VERSION_ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
OUTPUT_VARIABLE OS_VERSION
)

if(OS_NAME MATCHES "ubuntu")
set(CPACK_DEBIAN_PACKAGE_RELEASE "ubuntu${OS_VERSION}")
set(CPACK_GENERATOR "DEB")
elseif(OS_NAME MATCHES "centos")
set(CPACK_RPM_PACKAGE_RELEASE_DIST "el${OS_VERSION}")
if(OS_VERSION MATCHES "7")
set(CPACK_GENERATOR "RPM;TGZ")
else()
set(CPACK_GENERATOR "RPM")
endif()
endif()

if(BUILD_FLETCHER_AWS-SIM)
set(CPACK_COMPONENTS_ALL sim)
else()
set(CPACK_COMPONENTS_ALL library)
set(CPACK_RPM_MAIN_COMPONENT "library")
endif()

set(CPACK_PACKAGE_VENDOR "ABS TUDelft")
set(CPACK_PACKAGE_VERSION_MAJOR "${fletcher_aws_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${fletcher_aws_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${fletcher_aws_VERSION_PATCH}")
set(CPACK_PACKAGE_RELOCATABLE ON)

set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_LIBRARY_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_LIBRARY_PACKAGE_DEPENDS "fletcher (>= 0.0.19)")
set(CPACK_DEBIAN_SIM_PACKAGE_DEPENDS "fletcher (>= 0.0.19)")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}")

set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
set(CPACK_RPM_PACKAGE_LICENSE "ASL 2.0")
set(CPACK_RPM_LIBRARY_PACKAGE_REQUIRES "fletcher >= 0.0.19")
set(CPACK_RPM_SIM_PACKAGE_REQUIRES "fletcher >= 0.0.19")

set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_ARCHIVE_LIBRARY_FILE_NAME "${CMAKE_PROJECT_NAME}-${fletcher_aws_VERSION}-${CMAKE_SYSTEM_NAME}")
set(CPACK_ARCHIVE_SIM_FILE_NAME "${CMAKE_PROJECT_NAME}-sim-${fletcher_aws_VERSION}-${CMAKE_SYSTEM_NAME}")

include(CPack)
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Fletcher AWS platform support

[![Build Status](https://dev.azure.com/abs-tudelft/fletcher/_apis/build/status/abs-tudelft.fletcher-aws?branchName=master)](https://dev.azure.com/abs-tudelft/fletcher/_build/latest?definitionId=7&branchName=master)

Fletcher AWS platform support.
# Fletcher AWS F1 platform support

Before running any other command, source `sourceme.sh`. This will do everything
needed to set up the AWS SDK and HDK. It will also clone the subrepos if you
Expand Down
1 change: 0 additions & 1 deletion aws-fpga
Submodule aws-fpga deleted from e7a5ff
26 changes: 0 additions & 26 deletions azure-pipelines.yml

This file was deleted.

1 change: 0 additions & 1 deletion fletcher
Submodule fletcher deleted from afad4e
2 changes: 2 additions & 0 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(runtime)
add_subdirectory(runtime_sim)
29 changes: 1 addition & 28 deletions runtime/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,12 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(fletcher_aws VERSION 0.0.0 LANGUAGES C CXX)

find_library(AWS_FPGA fpga_mgmt HINTS "$ENV{SDK_DIR}/userspace/lib/so")
if(AWS_FPGA)
add_library(fpga_mgmt SHARED IMPORTED GLOBAL)
set_target_properties(fpga_mgmt PROPERTIES IMPORTED_LOCATION ${AWS_FPGA})
target_include_directories(fpga_mgmt INTERFACE "$ENV{SDK_DIR}/userspace/include")
else()
message(FATAL_ERROR "Dependency fpga_mgmt not found")
endif()

include(FetchContent)

FetchContent_Declare(cmake-modules
GIT_REPOSITORY https://github.com/abs-tudelft/cmake-modules.git
GIT_TAG master
)
FetchContent_MakeAvailable(cmake-modules)

add_subdirectory(../../fletcher/common/c c)

include(CompileUnits)

add_compile_unit(
NAME fletcher::aws
TYPE SHARED
COMPONENT library
PRPS
C_STANDARD 99
CFLAGS -g
SRCS
src/fletcher_aws.c
DEPS
fletcher::c
fpga_mgmt
)

compile_units()
35 changes: 4 additions & 31 deletions runtime/runtime_sim/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,14 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(fletcher_aws_sim VERSION 0.0.0 LANGUAGES C CXX)

find_library(AWS_FPGA fpga_mgmt HINTS "$ENV{SDK_DIR}/userspace/lib/so")
if(AWS_FPGA)
add_library(fpga_mgmt INTERFACE IMPORTED GLOBAL)
target_include_directories(fpga_mgmt INTERFACE "$ENV{SDK_DIR}/userspace/include")
add_library(fpga_pci_sv INTERFACE IMPORTED GLOBAL)
target_include_directories(fpga_pci_sv INTERFACE "$ENV{HDK_DIR}/common/software/include")
else()
message(FATAL_ERROR "Dependency fpga_mgmt not found")
endif()

include(FetchContent)

FetchContent_Declare(cmake-modules
GIT_REPOSITORY https://github.com/abs-tudelft/cmake-modules.git
GIT_TAG master
)
FetchContent_MakeAvailable(cmake-modules)

add_subdirectory(../../fletcher/common/c c)

include(CompileUnits)

add_compile_unit(
NAME fletcher::aws_sim
OPT
NAME fletcher::aws-sim
TYPE SHARED
COMPONENT sim
PRPS
C_STANDARD 99
SRCS
src/fletcher_aws_sim.c
${SOURCE_DIR}/hdk/common/software/src/fpga_pci_sv.c
DEPS
fletcher::c
fpga_mgmt
fpga_pci_sv
)


compile_units()

0 comments on commit 59c486c

Please sign in to comment.