Skip to content
Snippets Groups Projects
Commit 89d8a125 authored by m.marn's avatar m.marn Committed by al.schwinn
Browse files

Transition to CMake

Fixes #53

See merge request !27
parent 18d0b898
No related branches found
No related tags found
1 merge request!27Transition to CMake
Showing
with 370 additions and 398 deletions
......@@ -9,3 +9,5 @@ venv
builds
builds/*
.data
build
build-yocto
cmake_minimum_required(VERSION 3.20.2)
project(opensilecs VERSION 2.5.0)
include(CTest)
enable_testing()
option(BUILD_COMMUNICATION_LIB_ONLY "Setup only the Silecs communication library." OFF)
option(ADD_LATEST_LINK "Link this install release as latest." ON)
set(GSI_SILECS_PATH "/common/usr/cscofe/silecs" CACHE STRING "GSI_SILECS_PATH")
set(BUILD_TARGET "x86_64" CACHE STRING "BUILD_TARGET")
# Use, i.e. don't skip the full RPATH for the build tree.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# When building, don't use the install RPATH already (but later on when installing).
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# Add the automatically determined parts of the RPATH which point to directories outside the build
# tree to the install RPATH.
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if (BUILD_COMMUNICATION_LIB_ONLY)
add_subdirectory(silecs-communication-cpp)
else()
add_subdirectory(silecs_cli)
add_subdirectory(silecs-codegen)
add_subdirectory(silecs-model)
add_subdirectory(silecs-communication-cpp)
add_subdirectory(silecs-cli-client)
add_subdirectory(silecs-diagnostic-cpp)
# Create a silecs_environment file which can be sourced to use the silecs command line tools.
FILE(WRITE ${CMAKE_BINARY_DIR}/silecs_environment
"SILECS_VERSION=${CMAKE_PROJECT_VERSION}\n"
"export PATH=${CMAKE_INSTALL_PREFIX}/\$SILECS_VERSION/silecs-cli:\${PATH}\n"
"export PATH=${CMAKE_INSTALL_PREFIX}/\$SILECS_VERSION/silecs-cli-client/bin/x86_64:\${PATH}\n"
"export PATH=${CMAKE_INSTALL_PREFIX}/\$SILECS_VERSION/silecs-diagnostic-cpp/bin/x86_64:\${PATH}\n"
)
# The silecs_environment file is released/installed together with the other sub-projects.
install(
FILES ${CMAKE_BINARY_DIR}/silecs_environment
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_VERSION}/
)
endif()
if(ADD_LATEST_LINK)
# Symlink this release as latest.
install(CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E create_symlink \
${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_VERSION} \
${CMAKE_INSTALL_PREFIX}/latest )"
)
endif()
......@@ -8,13 +8,20 @@ Supported PLC vendors: Siemens, Beckhoff(untested), Schneider(untested)
## Getting Started
If you plan to just use the silecs framework, please check the [Opensilecs Wiki](https://www-acc.gsi.de/wiki/Frontend/SILECS) for handson courses and all required documentation.
If you plan to just use the silecs framework, please check the [Opensilecs Wiki](https://www-acc.gsi.de/wiki/Frontend/SILECS) for hands-on courses and all required documentation.
## Build & Install
If you want to touch the code of silecs itself, you can build it like this:
If you want to touch the code of silecs itself, you can build it using CMake.
There are three scripts available `configure.sh`, `build.sh` and `install.sh`. To setup the CMake build environment use `configure.sh`. The script accepts a few options (use `configure.sh -h` to see available options)
with which the release path, target and the build type can be configured. Once the build is configured
use `build.sh` to compile all the projects and `install.sh` to install them to the release path you
provided to `configure.sh`. In case no release path is provided the project will be released/installed
to the build directory. You can optionally specify the build target to `build.sh` and `install.sh`
scripts which can be used to build with yocto SDK.
`./build_and_install.sh v1.2.3 /home/user/MyCustomDir`
Note: when using the option `--target yocto` a different build directory is used `build-yocto`.
This means that for a full yocto build you need to provide the `--target yocto` option to all three scripts (`configure.sh`, `build.sh` and `install.sh`).
Please open issues / merge requests in order to upstream your changes. ([GSI account required](https://www-oracle.gsi.de/pls/gsi/a_admin.acc_antrag))
......
build.sh 0 → 100755
#!/bin/bash
TARGET=x86_64
usage(){
echo "Usage: $0 [--target yocto]"
echo "-t | --target"
echo " $TARGET when not specified"
echo "-h | --help"
exit 1
}
USER_TARGET=$TARGET
# Loop through all the arguments and determine provided options.
while [ "${1:-}" != "" ]; do
case $1 in
-t | --target ) shift
USER_TARGET=$1
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
# Based on the build target select the build directory (build by default & build-yocto for yocto SDK).
# Using a different build directory for yocto builds since mixing between the two cmake versions doesn't work to well.
BUILD_DIR_NAME=build
if [[ $USER_TARGET == yocto ]] || [[ $USER_TARGET == x86_64-yocto ]]; then
TARGET=x86_64-yocto
BUILD_DIR_NAME=build-yocto
elif [[ $USER_TARGET != x86_64 ]]; then
echo "Unsupported target" $USER_TARGET
usage
exit 1
fi
SCRIPT_PATH=$(dirname $(readlink -f "$0"))
BUILD_DIR=$SCRIPT_PATH/$BUILD_DIR_NAME
echo "------------------------------------------------------------------------"
echo "Build target: " $TARGET
echo "Build directory: " $BUILD_DIR
echo "------------------------------------------------------------------------"
cmake --build $BUILD_DIR -j 8
\ No newline at end of file
#!/bin/bash
# release locations
GLOBAL_RELEASE_DIR=/common/usr/cscofe/silecs
function help {
echo -e ""
echo -e "Script in order to build and install the complete silecs framework"
echo -e ""
echo -e "Usage:"
echo -e ""
echo -e "\t Install version 1.2.3 to default directory ($GLOBAL_RELEASE_DIR):"
echo -e "\t\t ./build_and_install.sh 1.2.3"
echo -e ""
echo -e "\t Install version 1.2.3 to custom directory:"
echo -e "\t\t ./build_and_install.sh 1.2.3 /home/user/MyCustomDir"
echo -e ""
exit 1;
}
if [ $# -lt 1 ]
then
echo "Error: Wrong number of arguments supplied."
help
fi
if [[ "$1" == "-h" || "$1" == "--help" ]];
then
help
fi
# List of silecs packages which can be released
PACKAGES="silecs-codegen silecs-model silecs-communication-cpp silecs-diagnostic-cpp silecs_cli silecs-cli-client"
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT") # path where this script is located in
SILECS_VERSION_FULL=$1
SILECS_VERSION_MAJOR=`echo ${SILECS_VERSION_FULL} | cut -d. -f1`
SILECS_VERSION_MINOR=`echo ${SILECS_VERSION_FULL} | cut -d. -f2`
if [ -z "$2" ]
then
RELEASE_DIR_BASE=$GLOBAL_RELEASE_DIR
else
RELEASE_DIR_BASE=$2
fi
for PACKAGE in $PACKAGES; do
echo "installing package ${PACKAGE} into ${RELEASE_DIR_BASE}"
mkdir -p ${RELEASE_DIR_BASE}
${PACKAGE}/install.sh ${RELEASE_DIR_BASE} ${SILECS_VERSION_FULL}
if [ "$?" -eq "1" ]; then
echo "Error: Package ${PACKAGE} skipped"
fi
done
# Create silecs environment file to be easily sourced for users
echo -e "Create silecs environment file"
SILECS_ENV_FILE=${RELEASE_DIR_BASE}/${SILECS_VERSION_FULL}/silecs_environment
echo $SILECS_ENV_FILE
touch $SILECS_ENV_FILE
echo -e "SILECS_VERSION=${SILECS_VERSION_FULL}" >> $SILECS_ENV_FILE;
echo -e "export PATH=${RELEASE_DIR_BASE}/\$SILECS_VERSION/silecs-cli:\${PATH}" >> $SILECS_ENV_FILE;
echo -e "export PATH=${RELEASE_DIR_BASE}/\$SILECS_VERSION/silecs-cli-client/bin/x86_64:\${PATH}" >> $SILECS_ENV_FILE;
echo -e "export PATH=${RELEASE_DIR_BASE}/\$SILECS_VERSION/silecs-diagnostic-cpp/bin/x86_64:\${PATH}" >> $SILECS_ENV_FILE;
# Update links to latest versions
echo -e "Update links to silecs versions"
# Update link to latest version
LATEST_LINK=${RELEASE_DIR_BASE}/latest
if [ -L ${LATEST_LINK} ]; then
rm ${LATEST_LINK}
fi
ln -fvs ${RELEASE_DIR_BASE}/${SILECS_VERSION_FULL} ${LATEST_LINK}
# Update link to major.minor version
MAJOR_MINOR_LINK=${RELEASE_DIR_BASE}/${SILECS_VERSION_MAJOR}.${SILECS_VERSION_MINOR}
if [ -L ${MAJOR_MINOR_LINK} ]; then
rm ${MAJOR_MINOR_LINK}
fi
ln -fvs ${RELEASE_DIR_BASE}/${SILECS_VERSION_FULL} ${MAJOR_MINOR_LINK}
# Update link to major version
MAJOR_LINK=${RELEASE_DIR_BASE}/${SILECS_VERSION_MAJOR}
if [ -L ${MAJOR_LINK} ]; then
rm ${MAJOR_LINK}
fi
ln -fvs ${RELEASE_DIR_BASE}/${SILECS_VERSION_FULL} ${MAJOR_LINK}
exit 0
#!/bin/bash
GLOBAL_RELEASE_DIR=/common/usr/cscofe/silecs/
TARGET=x86_64
usage(){
echo "Usage: $0 [--release [path]] [--target yocto]"
echo "-r | --release"
echo " Install path prefix. If only option is provided without any paths $GLOBAL_RELEASE_DIR is used."
echo "-t | --target"
echo " $TARGET when not specified"
echo "-d | --debug"
echo " Use debug compilation flags."
echo "-h | --help"
exit 1
}
DEBUG=""
USER_RELEASE_DIR=""
USER_TARGET=$TARGET
# Loop through all the arguments and determine provided options.
while [ "${1:-}" != "" ]; do
case $1 in
-r | --release ) if [[ $2 == -* ]] || [[ $2 == "" ]]; then
USER_RELEASE_DIR=$GLOBAL_RELEASE_DIR
else
shift
USER_RELEASE_DIR=$1
fi
;;
-t | --target ) shift
USER_TARGET=$1
;;
-d | --debug ) DEBUG=y
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
# Based on the build target select the build directory (build by default & build-yocto for yocto SDK).
# Using a different build directory for yocto builds since mixing between the two cmake versions doesn't work to well.
BUILD_DIR_NAME=build
if [[ $USER_TARGET == yocto ]] || [[ $USER_TARGET == x86_64-yocto ]]; then
TARGET=x86_64-yocto
BUILD_DIR_NAME=build-yocto
elif [[ $USER_TARGET != x86_64 ]]; then
echo "Unsupported target" $USER_TARGET
usage
exit 1
fi
SCRIPT_PATH=$(dirname $(readlink -f "$0"))
BUILD_DIR=$SCRIPT_PATH/$BUILD_DIR_NAME
# If user didn't provide a release directory use the build directory. Otherwise use whatever the user provided.
if [[ $USER_RELEASE_DIR == "" ]]; then
RELEASE_DIR=$BUILD_DIR
else
RELEASE_DIR=$USER_RELEASE_DIR
fi
BUILD_TYPE=Release
# Only enable debug compilation mode when the user requests it.
if [[ $DEBUG == y ]]; then
BUILD_TYPE=Debug
fi
echo "------------------------------------------------------------------------"
echo "Build type: " $BUILD_TYPE
echo "Build target: " $TARGET
echo "Build directory: " $BUILD_DIR
echo "Install directory:" $RELEASE_DIR
echo "------------------------------------------------------------------------"
if [[ $TARGET == x86_64-yocto ]]; then
# Configure yocto environment.
unset LD_LIBRARY_PATH; source /common/usr/embedded/yocto/sdk/environment-setup-core2-64-ffos-linux
cmake -S . -B $BUILD_DIR -DBUILD_TARGET=$TARGET -DCMAKE_INSTALL_PREFIX=$RELEASE_DIR -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_COMMUNICATION_LIB_ONLY=ON -DADD_LATEST_LINK=OFF
else
cmake -S . -B $BUILD_DIR -DBUILD_TARGET=$TARGET -DCMAKE_INSTALL_PREFIX=$RELEASE_DIR -DCMAKE_BUILD_TYPE=$BUILD_TYPE
fi
#!/bin/bash
TARGET=x86_64
usage(){
echo "Usage: $0 [--target yocto]"
echo "-t | --target"
echo " $TARGET when not specified"
echo "-h | --help"
exit 1
}
USER_TARGET=$TARGET
# Loop through all the arguments and determine provided options.
while [ "${1:-}" != "" ]; do
case $1 in
-t | --target ) shift
USER_TARGET=$1
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
# Based on the build target select the build directory (build by default & build-yocto for yocto SDK).
# Using a different build directory for yocto builds since mixing between the two cmake versions doesn't work to well.
BUILD_DIR_NAME=build
if [[ $USER_TARGET == yocto ]] || [[ $USER_TARGET == x86_64-yocto ]]; then
TARGET=x86_64-yocto
BUILD_DIR_NAME=build-yocto
elif [[ $USER_TARGET != x86_64 ]]; then
echo "Unsupported target" $USER_TARGET
usage
exit 1
fi
SCRIPT_PATH=$(dirname $(readlink -f "$0"))
BUILD_DIR=$SCRIPT_PATH/$BUILD_DIR_NAME
echo "------------------------------------------------------------------------"
echo "Build target: " $TARGET
echo "Build directory: " $BUILD_DIR
echo "------------------------------------------------------------------------"
cd $BUILD_DIR
# Run tests and exit if any of them fail.
ctest || exit 1
cd $SCRIPT_PATH
cmake --install $BUILD_DIR -j 8
#!/bin/sh
set -e
echo "##############################################"
echo "configuration of build environment"
echo "##############################################"
# $WORKSPACE is the jenkins workspace, will be filled by jenkins
export COMMON_MAKE_PATH="$WORKSPACE/../../generics/generic-makefiles"
export SNAP7_BASE="$WORKSPACE/snap7/snap7-full"
export BOOST_HOME="$WORKSPACE/../../generics/boost_1.54.0/boost/1.54.0"
export SILECS_COMM_HOME="$WORKSPACE/silecs-communication-cpp/build"
echo "##############################################"
echo "building snap7"
echo "##############################################"
cd snap7
./build.sh
cd ..
echo "##############################################"
echo "building silecs-communication-cpp"
echo "##############################################"
cd silecs-communication-cpp
make clean
make all CPU=x86_64 -j4
cd ..
echo "##############################################"
echo "building silecs-codegen"
echo "##############################################"
cd silecs-codegen/src/xml
python runTests.py
cd ../../..
echo "##############################################"
echo "building silecs-diagnostic-cpp"
echo "##############################################"
cd silecs-diagnostic-cpp
make clean
make CPU=x86_64 -j1
cd ..
echo "##############################################"
echo "building silecs-cli-client"
echo "##############################################"
cd silecs-cli-client
make clean
make CPU=x86_64 -j1
cd ..
echo "##############################################"
echo "build finished sucessfully"
echo "##############################################"
cmake_minimum_required(VERSION 3.20.2)
project(silecs-cli-client LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-Wall -Wextra)
add_executable(${PROJECT_NAME} src/silecs-cli-client/main.cpp)
target_link_libraries(${PROJECT_NAME} silecs-comm)
install(
TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_PROJECT_VERSION}/${PROJECT_NAME}/bin/${BUILD_TARGET}
)
install(
DIRECTORY examples
DESTINATION ${CMAKE_PROJECT_VERSION}/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.sh*"
)
\ No newline at end of file
# Copyright 2016 CERN and GSI
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
PROJECT = silecs
PRODUCT = cli-client
VERSION = 0.0.0
SKIP_MANIFEST = TRUE
#local
#COMMON_MAKE_PATH ?= /common/home/bel/schwinn/lnx/workspace-silecs-neon/generic-makefiles
#global
COMMON_MAKE_PATH ?= /opt/cern/buildsystem/generic/2.13.2
#Enable C++11 Support
COMPILER_FLAGS += -std=c++11
# product configuration
BIN_NAME = $(PROJECT)-$(PRODUCT)
DBG = false
# Include the generic make file
include $(COMMON_MAKE_PATH)/Make.generic
\ No newline at end of file
BOOST_VERSION ?= 1.54.0
SILECS_COMM_VERSION = 1.0.2
BOOST_HOME ?= /acc/local/$(CPU)/3rdparty/boost/$(BOOST_VERSION)
SILECS_COMM_HOME ?= ../silecs-communication-cpp/build
LIBXML_PATH ?= /usr/include/libxml2/
GSI_SILECS_BASE = /common/usr/cscofe/silecs
SNAP7_BASE ?= $(GSI_SILECS_BASE)/snap7/latest
DEPENDENT_COMPILER_OPTIONS += -I$(SILECS_COMM_HOME)/include
DEPENDENT_COMPILER_OPTIONS += -I$(LIBXML_PATH)
DEPENDENT_COMPILER_OPTIONS += -I$(BOOST_HOME)/include
DEPENDENT_LINKER_OPTIONS += -L$(SNAP7_BASE)/lib/$(CPU)-linux -lsnap7
DEPENDENT_LINKER_OPTIONS += -L/usr/lib64 -lxml2
DEPENDENT_LINKER_OPTIONS += -L$(SILECS_COMM_HOME)/lib/$(CPU) -lsilecs-comm
DEPENDENT_LINKER_OPTIONS += -lstdc++ -lxml2 -lboost_system -lboost_filesystem -lcurl
# Set default library search path
DEPENDENT_LINKER_OPTIONS += -Wl,-rpath=$(SNAP7_BASE)/lib/$(CPU)-linux
#!/bin/sh
set -e
RELEASE_DIR_BASE=$1
SILECS_VERSION=$2
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT") # path where this script is located in
RELEASE_DIR=${RELEASE_DIR_BASE}/${SILECS_VERSION}/silecs-cli-client
if [ -d ${RELEASE_DIR} ]; then
echo "Error: ${RELEASE_DIR} already exists ...skipping"
exit 1
fi
make -C ${SCRIPTPATH} clean
make -C ${SCRIPTPATH} CPU=x86_64 MAJOR=${MAJOR} MINOR=${MINOR} PATCH=${PATCH} -j4
mkdir -p ${RELEASE_DIR}
cp -r ${SCRIPTPATH}/build/bin ${RELEASE_DIR}
cp -r ${SCRIPTPATH}/examples ${RELEASE_DIR}
# Make all files write-protected to prevent overwriting an old version by accident
chmod a-w -R ${RELEASE_DIR}
\ No newline at end of file
cmake_minimum_required(VERSION 3.20.2)
project(silecs-codegen)
find_package(Python COMPONENTS Interpreter)
add_test (NAME codegen-tests
COMMAND ${Python_EXECUTABLE} -m unittest
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src/xml/
)
install (
DIRECTORY ${PROJECT_SOURCE_DIR}/src/xml
DESTINATION ${CMAKE_PROJECT_VERSION}/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.py*")
#!/bin/sh
set -e
RELEASE_DIR_BASE=$1
SILECS_VERSION=$2
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT") # path where this script is located in
RELEASE_DIR=${RELEASE_DIR_BASE}/${SILECS_VERSION}/silecs-codegen
if [ -d ${RELEASE_DIR} ]; then
echo "Error: ${RELEASE_DIR} already exists ...skipping"
exit 1
fi
cd ${SCRIPTPATH}/src/xml
python3 -m unittest
mkdir -p ${RELEASE_DIR}
cp -r ${SCRIPTPATH}/src/xml ${RELEASE_DIR}
# Make all files write-protected to prevent overwriting an old version by accident
chmod a-w -R ${RELEASE_DIR}
\ No newline at end of file
cmake_minimum_required(VERSION 3.20.2)
project(silecs-comm LANGUAGES CXX)
# NI support is not supported at GSI yet.
# option(NI_SUPPORT_ENABLED "Enable NI support." OFF)
option(MODBUS_SUPPORT_ENABLED "Enable Modbus support." ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-Wall -Wextra)
find_package(LibXml2 REQUIRED)
file(GLOB_RECURSE COMM_SOURCES ${PROJECT_SOURCE_DIR}/src/silecs-communication/*.cpp)
add_library(${PROJECT_NAME} STATIC ${COMM_SOURCES})
target_compile_definitions(${PROJECT_NAME}
PRIVATE
MAJOR=${CMAKE_PROJECT_VERSION_MAJOR}
MINOR=${CMAKE_PROJECT_VERSION_MINOR}
PATCH=${CMAKE_PROJECT_VERSION_PATCH})
if (NI_SUPPORT_ENABLED)
add_definitions(-DNI_SUPPORT_ENABLED)
endif()
if (MODBUS_SUPPORT_ENABLED)
add_definitions(-DMODBUS_SUPPORT_ENABLED)
target_include_directories(${PROJECT_NAME}
PRIVATE ${GSI_SILECS_PATH}/modbus/latest/include/
)
endif()
target_include_directories(${PROJECT_NAME}
PUBLIC
${PROJECT_SOURCE_DIR}/src
LibXml2::LibXml2
PRIVATE
${GSI_SILECS_PATH}/snap7/latest/include/
)
target_link_directories(${PROJECT_NAME}
PUBLIC
${GSI_SILECS_PATH}/snap7/latest/${BUILD_TARGET}-linux/lib/
${GSI_SILECS_PATH}/modbus/latest/${BUILD_TARGET}-linux/lib/
)
target_link_libraries(${PROJECT_NAME} libmodbus.a)
target_link_libraries(${PROJECT_NAME} LibXml2::LibXml2 snap7)
install (
TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_PROJECT_VERSION}/silecs-communication-cpp/lib/${BUILD_TARGET}
)
install (
DIRECTORY ${PROJECT_SOURCE_DIR}/src/
DESTINATION ${CMAKE_PROJECT_VERSION}/silecs-communication-cpp/include
FILES_MATCHING PATTERN "*.h*"
)
# Copyright 2016 CERN and GSI
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
PROJECT = silecs
PRODUCT = communication
VERSION = 0.0.0
SKIP_MANIFEST = TRUE
#local
#COMMON_MAKE_PATH ?= /common/home/bel/schwinn/lnx/workspace-silecs-neon/generic-makefiles
#global
COMMON_MAKE_PATH ?= /opt/cern/buildsystem/generic/2.13.2
# product configuration
LIB_NAME = comm
DBG = true
#COMPILER_FLAGS = -Os -fno-strict-aliasing -fexceptions -DLINUX -DARM_FIX -DDAVE_LITTLE_ENDIAN -D_GNU_SOURCE -DMAJOR=$(MAJOR) -DMINOR=$(MINOR) -DPATCH=$(PATCH)
# The default, used for DEV, overwrite for productive releases
MAJOR ?= 0
MINOR ?= 0
PATCH ?= 0
COMPILER_FLAGS = -DMAJOR=$(MAJOR) -DMINOR=$(MINOR) -DPATCH=$(PATCH)
#Enable C++11 Support
COMPILER_FLAGS += -std=c++11 -Wall -Wextra
ifdef NI_SUPPORT_ENABLED
COMPILER_FLAGS += -DNI_SUPPORT_ENABLED=TRUE
$(info --- Build with NI support: enabled)
else
$(info --- Build with NI support: disabled)
endif
ifdef MODBUS_SUPPORT_ENABLED
COMPILER_FLAGS += -DMODBUS_SUPPORT_ENABLED=TRUE
$(info --- Build with modbus support: enabled)
else
$(info --- Build with modbus support: disabled)
endif
# Include the generic make file
include $(COMMON_MAKE_PATH)/Make.generic
BOOST_VERSION ?= 1.54.0
GSI_SILECS_BASE = /common/usr/cscofe/silecs
LIBXML_PATH ?= /usr/include/libxml2/
SNAP7_BASE ?= $(GSI_SILECS_BASE)/snap7/latest
BOOST_HOME ?= /opt/gsi/3rdparty/boost/$(BOOST_VERSION)
ifdef MODBUS_SUPPORT_ENABLED
MODBUS_BASE=$(GSI_SILECS_BASE)/modbus/latest
DEPENDENT_COMPILER_OPTIONS += -I$(MODBUS_BASE)/include
endif
DEPENDENT_COMPILER_OPTIONS += -I$(LIBXML_PATH)
DEPENDENT_COMPILER_OPTIONS += -I$(SNAP7_BASE)/include
DEPENDENT_COMPILER_OPTIONS += -I$(BOOST_HOME)/include
\ No newline at end of file
#!/bin/sh
set -e
RELEASE_DIR_BASE=$1
SILECS_VERSION=$2
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT") # path where this script is located in
CPU=x86_64
RELEASE_DIR=${RELEASE_DIR_BASE}/${SILECS_VERSION}/silecs-communication-cpp
if [ -d ${RELEASE_DIR} ]; then
echo "Error: ${RELEASE_DIR} already exists ...skipping"
exit 1
fi
MAJOR=`echo $SILECS_VERSION | cut -d. -f1`
MINOR=`echo $SILECS_VERSION | cut -d. -f2`
PATCH=`echo $SILECS_VERSION | cut -d. -f3`
make -C ${SCRIPTPATH} clean
MODBUS_SUPPORT_ENABLED=true make -C ${SCRIPTPATH} CPU=${CPU} MAJOR=${MAJOR} MINOR=${MINOR} PATCH=${PATCH} -j4
# Squash the silecs library with the modbus library, so no extra-lining will be required
SILECS_LIB=${SCRIPTPATH}/build/lib/${CPU}/libsilecs-comm.a
SQUASHED_LIB=${SCRIPTPATH}/build/lib/${CPU}/libsquashed.a
cd ${SCRIPTPATH}
ar -M <squash_modbus_lib.mri
rm ${SILECS_LIB}
mv ${SQUASHED_LIB} ${SILECS_LIB}
mkdir -p ${RELEASE_DIR}
cp -r ${SCRIPTPATH}/build/include ${RELEASE_DIR}
cp -r ${SCRIPTPATH}/build/lib ${RELEASE_DIR}
# Make all files write-protected to prevent overwriting an old version by accident
chmod a-w -R ${RELEASE_DIR}
\ No newline at end of file
#!/usr/bin/python
import os
import sys
depVersion = 'SILECS_MAKEFILE_VERSION=DEV RDA_VERSION=DEV'
ctbPaths = 'RELEASE_LOCATION=/local/RELEASE_LOCATION'
makeFlags = ' RELEASE_GROUP=si ' + depVersion + ' ' + ctbPaths
# compile first as we can't use -j in local-devrelease
cmd = 'make -j4' + makeFlags
rc = os.system(cmd + ' CPU=L865')
if(rc != 0):
sys.exit(-1)
rc = os.system(cmd + ' CPU=L866')
if(rc != 0):
sys.exit(-1)
# now release ==========================================
cmd = 'make local-devrelease' + makeFlags + ' TMP_DIR=.'
rc = os.system(cmd + ' CPU=L865')
if(rc != 0):
sys.exit(-1)
rc = os.system(cmd + ' CPU=L866')
if(rc != 0):
sys.exit(-1)
\ No newline at end of file
create build/lib/x86_64/libsquashed.a
addlib build/lib/x86_64/libsilecs-comm.a
addlib /common/usr/cscofe/silecs/modbus/latest/lib/libmodbus.a
save
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment