Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
lerwys committed Aug 20, 2021
2 parents ecff152 + 48a25c3 commit 6df3337
Show file tree
Hide file tree
Showing 157 changed files with 4,782 additions and 5,035 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ jobs:
- compiler: gcc
env: OS=ubuntu DIST=bionic BUILD_TYPE=cpack CPACK_BOARDS="afcv3" CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+ubu1804" DEPLOY="yes"
- compiler: gcc
env: OS=ubuntu DIST=bionic BUILD_TYPE=cpack CPACK_BOARDS="afcv3_1" CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+ubu1804" DEPLOY="yes"
env: OS=ubuntu DIST=bionic BUILD_TYPE=cpack CPACK_BOARDS="afcv3_1" BUILD_PCIEDRIVER_PACKAGE=yes CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+ubu1804" DEPLOY="yes"
- compiler: gcc
env: OS=centos DIST=7 BUILD_TYPE=cpack CPACK_BOARDS="ml605" CPACK_GENERATORS="RPM" CPACK_DISTRO_VERSION="+el7" DEPLOY="yes"
- compiler: gcc
env: OS=centos DIST=7 BUILD_TYPE=cpack CPACK_BOARDS="afcv3" CPACK_GENERATORS="RPM" CPACK_DISTRO_VERSION="+el7" DEPLOY="yes"
- compiler: gcc
env: OS=centos DIST=7 BUILD_TYPE=cpack CPACK_BOARDS="afcv3_1" CPACK_GENERATORS="RPM" CPACK_DISTRO_VERSION="+el7" DEPLOY="yes"
env: OS=centos DIST=7 BUILD_TYPE=cpack CPACK_BOARDS="afcv3_1" BUILD_PCIEDRIVER_PACKAGE=yes CPACK_GENERATORS="RPM" CPACK_DISTRO_VERSION="+el7" DEPLOY="yes"
- compiler: gcc
env: OS=debian DIST=stretch BUILD_TYPE=cpack CPACK_BOARDS="ml605" CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+deb9" DEPLOY="yes"
- compiler: gcc
env: OS=debian DIST=stretch BUILD_TYPE=cpack CPACK_BOARDS="afcv3" CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+deb9" DEPLOY="yes"
- compiler: gcc
env: OS=debian DIST=stretch BUILD_TYPE=cpack CPACK_BOARDS="afcv3_1" CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+deb9" DEPLOY="yes"
env: OS=debian DIST=stretch BUILD_TYPE=cpack CPACK_BOARDS="afcv3_1" BUILD_PCIEDRIVER_PACKAGE=yes CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+deb9" DEPLOY="yes"
- compiler: gcc
env: OS=debian DIST=buster BUILD_TYPE=cpack CPACK_BOARDS="ml605" CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+deb10" DEPLOY="yes"
- compiler: gcc
env: OS=debian DIST=buster BUILD_TYPE=cpack CPACK_BOARDS="afcv3" CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+deb10" DEPLOY="yes"
- compiler: gcc
env: OS=debian DIST=buster BUILD_TYPE=cpack CPACK_BOARDS="afcv3_1" CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+deb10" DEPLOY="yes"
env: OS=debian DIST=buster BUILD_TYPE=cpack CPACK_BOARDS="afcv3_1" BUILD_PCIEDRIVER_PACKAGE=yes CPACK_GENERATORS="DEB" CPACK_DISTRO_VERSION="+deb10" DEPLOY="yes"
- compiler: gcc
env: BUILD_TYPE=cmake BOARD=afcv3_1 DEPLOY_PAGES="yes"

Expand Down
184 changes: 166 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ list(APPEND CMAKE_MODULE_PATH ${halcs_CMAKE_MODULES_DIR})

# add module to prevent in-source builds
include(PreventInSourceBuilds)
# detect target architecture
include(TargetArch)
# extract version numbers from header file
include(TestHalcsVersion)

target_architecture(ARCH)

# find pkg-config
find_package(PkgConfig)
Expand Down Expand Up @@ -71,20 +77,6 @@ endmacro()
# User compile-time options
########################################################################

# which board do we want.
set(halcs_BOARD_OPT "afcv3_1" CACHE STRING
"HALCS board")
set(halcs_BOARD_VALUES
"ml605;afcv3;afcv3_1"
)

set_property(CACHE halcs_BOARD_OPT PROPERTY STRINGS
${halcs_BOARD_VALUES}
)

message(STATUS
"Setting compile-time option halcs_BOARD='${halcs_BOARD_OPT}'")

########################################################################
# Library options
########################################################################
Expand Down Expand Up @@ -192,10 +184,6 @@ list(APPEND halcs_LIBRARIES disptable)
# HALCSCLIENT dependency
#########################################################################

# set compile options to halcsclient
set(halcsclient_BOARD_OPT ${halcs_BOARD_OPT} CACHE STRING
"HALCS board" FORCE)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/client)

# Add "target" name library dependency
Expand All @@ -221,6 +209,9 @@ add_subdirectory(libs/bpmclient)
# Sources/Headers definitions
########################################################################

# HALCS postinst file directory
set(halcs_POSTINST_FILE_DIR "${CMAKE_CURRENT_BINARY_DIR}/halcs")

set(common_INCLUDE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/include
)
Expand Down Expand Up @@ -254,6 +245,163 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ldconf)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/dev_mngr)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/apps)

#################################################
## CPack
#################################################

# ALL_COMPONENTS_IN_ONE or ONE_PER_GROUP
set(cpack_components_grouping_OPT "ALL_COMPONENTS_IN_ONE"
CACHE STRING "CPack CPACK_COMPONENTS_GROUPING variable"
)
set(CPACK_COMPONENTS_GROUPING "${cpack_components_grouping_OPT}")

# Any of Binaries;Libs;Scripts;Tools;Pciedriver
set(cpack_components_all_OPT "Binaries;Libs;Scripts;Tools"
CACHE STRING "CPack CPACK_COMPONENTS_ALL variable"
)
set(CPACK_COMPONENTS_ALL "${cpack_components_all_OPT}")

# Any CPACK generator
set(cpack_generator_OPT "RPM"
CACHE STRING "CPack CPACK_GENERATOR variable"
)

# CPack rules
option(ENABLE_CPACK "Enables cpack rules" ON)

if(ENABLE_CPACK)
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE)
set(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
endif()

include(InstallRequiredSystemLibraries)

# set architecture as detected by TargetArch module
set(arch_name ${ARCH})

set(halcs_DISTRO_VERSION "" CACHE STRING "halcs distribution version")

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR})

set(CPACK_GENERATOR "${cpack_generator_OPT}")
set(CPACK_PACKAGE_NAME "halcsd")

set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
# we also depend on malamute >= 1.0, but this has not been packaged into the official
# repositories yet
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libsodium-dev (>= 1.0.8), libzmq3-dev (>= 4.2.5), libczmq-dev (>= 4.0.2)")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${halcs_POSTINST_FILE_DIR}/debian/postinst")
# Seems broken in CMake and crashes with
# CPack: Create package
# terminate called after throwing an instance of 'std::logic_error'
# what(): basic_string::_M_construct null not valid
# Makefile:81: recipe for target 'package' failed
# make: *** [package] Aborted (core dumped)
# set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON)

set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_PACKAGE_AUTOREQ no)
set(CPACK_RPM_PACKAGE_AUTOPROV yes)
# we also depend on malamute >= 1.0, but this has not been packaged into the official
# repositories yet
set(CPACK_RPM_PACKAGE_REQUIRE "libsodium-devel >= 1.0.8, zeromq-devel >= 4.2.5, czmq-devel >= 4.0.2")
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
/lib
/usr/etc
/etc/systemd
/lib/systemd
/etc/systemd/system
/lib/systemd/system
/etc/udev
/etc/udev/rules.d
)
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${halcs_POSTINST_FILE_DIR}/redhat/postinst")
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/usr/src/debug/${CPACK_PACKAGE_NAME}-${halcs_VERSION}")
set(CPACK_RPM_DEBUGINFO_PACKAGE ON)

set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}_${halcs_VERSION}${halcs_DISTRO_VERSION}_${arch_name}"
)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "halcsd daemon")
set(CPACK_PACKAGE_VENDOR "LNLS")
set(CPACK_PACKAGE_CONTACT "Lucas Russo <[email protected]>")
#set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.txt")
# set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}/README.txt")
# set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_BINARY_DIR}/WELCOME.txt")
# set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/branding.bmp")

# if we are packaging Pciedriver use it's own version
if("${CPACK_COMPONENTS_ALL}" STREQUAL "Pciedriver")
set(CPACK_PACKAGE_VERSION ${pciedriver_VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${pciedriver_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${pciedriver_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${pciedriver_VERSION_PATCH})
else()
set(CPACK_PACKAGE_VERSION ${halcs_VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${halcs_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${halcs_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${halcs_VERSION_PATCH})
endif()
# set(CPACK_PACKAGE_INSTALL_DIRECTORY "halcsd Install Directory")
# set(CPACK_TEMPORARY_DIRECTORY "halcsd Temporary CPack Directory")

include(CPack)

# For HALCS
cpack_add_component_group(HalcsFull
DISPLAY_NAME "HALCS libs, scripts, tools, headers and binaries"
)

cpack_add_component(Binaries
DISPLAY_NAME "Halcs binaries"
GROUP HalcsFull
INSTALL_TYPES FullHalcs
)

cpack_add_component(Libs
DISPLAY_NAME "Halcs libraries"
GROUP HalcsFull
INSTALL_TYPES FullHalcs
)

cpack_add_component(Scripts
DISPLAY_NAME "Halcs scripts"
GROUP HalcsFull
INSTALL_TYPES FullHalcs
)

cpack_add_component(Tools
DISPLAY_NAME "Halcs tools"
GROUP HalcsFull
INSTALL_TYPES FullHalcs
)

cpack_add_install_type(FullHalcs
DISPLAY_NAME "Full Halcs"
)

# For Pciedriver
cpack_add_component_group(Pciedriver
DISPLAY_NAME "pcieDriver drivers, headers and libraries"
)

cpack_add_component(Pciedriver
DISPLAY_NAME "pcieDriver drivers, headers and libraries"
GROUP Pciedriver
INSTALL_TYPES FullDriver
)

cpack_add_install_type(FullDriver
DISPLAY_NAME "Full drivers, headers and libraries"
)

endif()

########################################################################
# Custom targets
########################################################################
Expand Down
41 changes: 7 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ SIZE ?= $(CROSS_COMPILE)size
MAKE ?= make
DEPMOD ?= depmod

# Select board in which we will work. Options are: ml605 or afcv3
BOARD ?= afcv3_1
# Select which application we want to generate. Options are: halcsd, halcs_generic_udev
APPS ?= halcsd halcs_generic_udev
# Select if we want to have the AFCv3 DDR memory shrink to 2^28 or the full size 2^32. Options are: (y)es ot (n)o.
Expand Down Expand Up @@ -57,12 +55,6 @@ LDCONF_ETC_PREFIX ?=
PREFIX ?= /usr/local
export PREFIX

# All of our supported boards
SUPPORTED_ML605_BOARDS = ml605
export SUPPORTED_ML605_BOARDS
SUPPORTED_AFCV3_BOARDS = afcv3 afcv3_1
export SUPPORTED_AFCV3_BOARDS

# Top Makefile directory
TOP := $(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))
SRC_DIR := $(TOP)/src
Expand Down Expand Up @@ -124,24 +116,9 @@ CFLAGS_USR = -std=gnu99 -O2
override CPPFLAGS +=
override CXXFLAGS +=

ifeq ($(BOARD),$(filter $(BOARD),$(SUPPORTED_AFCV3_BOARDS)))
ifeq ($(SHRINK_AFCV3_DDR_SIZE),y)
CFLAGS_USR += -D__SHRINK_AFCV3_DDR_SIZE__
endif
endif

# Board selection
ifeq ($(BOARD),$(filter $(BOARD),$(SUPPORTED_ML605_BOARDS)))
CFLAGS_USR += -D__BOARD_ML605__ -D__WR_SHIFT_FIX__=2
endif

ifeq ($(BOARD),afcv3_1)
CFLAGS_USR += -D__BOARD_AFCV3_1__
endif

ifeq ($(BOARD),$(filter $(BOARD),$(SUPPORTED_AFCV3_BOARDS)))
CFLAGS_USR += -D__BOARD_AFCV3__ -D__WR_SHIFT_FIX__=0
endif

# Program FMC130M_4CH EEPROM
ifeq ($(FMC130M_4CH_EEPROM_PROGRAM),active)
Expand Down Expand Up @@ -228,7 +205,7 @@ LDFLAGS_PLATFORM = -Wl,-T,$(LD_SCRIPT)
LDCONF = ldconf

# Libraries
LIBS = -lm -lzmq -lczmq -lmlm
LIBS = -lm -lzmq -lczmq -lmlm -ldl

# FIXME: make the project libraries easily interchangeable, specifying
# the lib only a single time
Expand Down Expand Up @@ -267,26 +244,23 @@ include $(SRC_DIR)/dev_mngr/dev_mngr.mk
include $(SRC_DIR)/dev_io/dev_io.mk
include $(SRC_DIR)/msg/msg.mk
include $(SRC_DIR)/revision/revision.mk
include $(SRC_DIR)/boards/$(BOARD)/board.mk
include $(SRC_DIR)/boards/common/common.mk
include $(SRC_DIR)/boards/afcv3_1/board.mk
include $(SRC_DIR)/boards/afcv3/board.mk
include $(SRC_DIR)/boards/ml605/board.mk
include $(APPS_MKS)
include $(LDCONF_DIR)/ldconf.mk

# Project boards
boards_INCLUDE_DIRS = -Iinclude/boards/$(BOARD)

# We need this until we merge smio and smio_table modules
# together
smio_table_DIRS = $(shell find $(SRC_DIR)/sm_io_table/modules -type d -print)
smio_table_INCLUDE_DIRS = $(addprefix -I, $(smio_table_DIRS))

# Include directories
INCLUDE_DIRS = $(boards_INCLUDE_DIRS) \
$(smio_table_INCLUDE_DIRS) \
INCLUDE_DIRS = $(smio_table_INCLUDE_DIRS) \
-Iinclude \
-I$(LIBBSMP_DIR)/include \
-I$(LIBSDBFS_DIR)/include \
-I$(LIBERRHAND_DIR)/include \
-I$(LIBERRHAND_DIR)/include \
-I$(LIBCONVC_DIR)/include \
-I$(LIBHUTILS_DIR)/include \
-I$(LIBDISPTABLE_DIR)/include \
Expand Down Expand Up @@ -319,7 +293,7 @@ dev_mngr_OBJS += $(dev_mngr_core_OBJS) $(debug_OBJS) \

common_app_OBJS = $(dev_io_core_OBJS) $(ll_io_OBJS) \
$(sm_io_OBJS) $(sm_io_table_OBJS) $(msg_OBJS) \
$(board_OBJS) $(board_common_OBJS)
$(board_OBJS)

apps_OBJS = $(foreach app_obj,$(APPS),$($(app_obj)_all_OBJS))

Expand All @@ -341,7 +315,6 @@ OBJS_all = $(ll_io_OBJS) \
$(dev_mngr_OBJS) \
$(common_app_OBJS) \
$(apps_OBJS) \
$(board_common_OBJS) \
$(revision_OBJS)

# Sources
Expand Down
45 changes: 45 additions & 0 deletions build_cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

set -euo pipefail

SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

GENERATOR="${1:-RPM}"

mkdir -p build
cd build
cmake3 \
-Dcpack_generator_OPT=${GENERATOR} \
-Dcpack_components_grouping_OPT=ONE_PER_GROUP \
-Dcpack_components_all_OPT="Pciedriver" \
../
make package
cmake3 \
-Dcpack_generator_OPT=${GENERATOR} \
-Dcpack_components_grouping_OPT=ALL_COMPONENTS_IN_ONE \
-Dcpack_components_all_OPT="Binaries;Libs;Scripts;Tools" \
../
make package

case "${GENERATOR}" in
RPM)
rpm -e halcsd || :
rpm -e halcsd-debuginfo || :
rpm -i halcsd-debuginfo*
rpm -i halcsd*_x86_64.rpm
;;
DEB)
dpkg -r halcsd || :
dpkg -r halcsd-debuginfo || :
dpkg -i halcsd-debuginfo*
dpkg -i halcsd-debuginfo*
;;
*)
echo "Invalid Gateware: "${FPGA_SYNTHESIS_NAME} >&2
exit 1
;;
esac

chmod 777 /tmp/malamute || :
ldconfig
systemctl daemon-reload
Loading

0 comments on commit 6df3337

Please sign in to comment.