-
Notifications
You must be signed in to change notification settings - Fork 15
Add installation script for open62541 to ease installation. #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
eddybl
wants to merge
4
commits into
epics-modules:master
Choose a base branch
from
KIT-IBPT:open62541-install-script
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| #!/bin/bash | ||
| # | ||
| # This script installs the open62541 library for OPC UA support in EPICS. | ||
| # It downloads the specified version of open62541, builds it, and configures the EPICS environment. | ||
| # It requires curl, cmake and openssl-dev to be installed on the system. | ||
| # | ||
| # Usage: ./install_open62541.sh [version] | ||
| # If no version is specified, a default version is defined in the script. | ||
|
|
||
| # Default version of open62541 to use | ||
| DEFAULT_VERSION="1.3.15" | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| BUILD_DIR="$SCRIPT_DIR/temp_build" | ||
| LIB_DIR="$SCRIPT_DIR/lib-open62541" | ||
| OPEN62541_VERSION=${1:-$DEFAULT_VERSION} | ||
|
|
||
| # Check if cmake and curl are available | ||
| if ! command -v cmake &> /dev/null || ! command -v curl &> /dev/null; then | ||
| echo "Error: cmake and/or curl is not installed. Please install them and try again." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Removing any existing build and library directory..." | ||
| rm -rf "$BUILD_DIR" | ||
| rm -rf "$LIB_DIR" | ||
|
|
||
| mkdir -p "$BUILD_DIR" | ||
| mkdir -p "$LIB_DIR" | ||
|
|
||
| # Download and extract open62541 if not already present | ||
| echo "Downloading open62541 version $OPEN62541_VERSION..." | ||
| curl -L "https://github.com/open62541/open62541/archive/refs/tags/v$OPEN62541_VERSION.tar.gz" \ | ||
| | tar -xz -C "$BUILD_DIR" --strip-components=1 | ||
| if [ $? -ne 0 ]; then | ||
| echo "Error: Failed to download and unpack." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Building open62541..." | ||
| cmake \ | ||
| -S "$BUILD_DIR" \ | ||
| -B "$BUILD_DIR"/build \ | ||
| -DBUILD_SHARED_LIBS=OFF \ | ||
| -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
| -DCMAKE_INSTALL_PREFIX="$SCRIPT_DIR"/lib-open62541 \ | ||
| -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \ | ||
| -DOPEN62541_VERSION="v$OPEN62541_VERSION" \ | ||
| -DUA_ENABLE_ENCRYPTION=OPENSSL | ||
| if [ $? -ne 0 ]; then | ||
| echo "Error: cmake configuration failed." | ||
| exit 1 | ||
| fi | ||
| make -C "$BUILD_DIR"/build | ||
| if [ $? -ne 0 ]; then | ||
| echo "Error: make failed." | ||
| exit 1 | ||
| fi | ||
| make -C "$BUILD_DIR"/build install | ||
| if [ $? -ne 0 ]; then | ||
| echo "Error: make install failed." | ||
| exit 1 | ||
| fi | ||
| rm -rf "$BUILD_DIR" | ||
|
|
||
| echo "Writing configuration to CONFIG_SITE.local..." | ||
| cat <<EOL > "$SCRIPT_DIR/../../configure/CONFIG_SITE.local" | ||
| OPEN62541 = \$(TOP)/devOpcuaSup/open62541/lib-open62541 | ||
| OPEN62541_DEPLOY_MODE = EMBED | ||
| OPEN62541_USE_CRYPTO = YES | ||
| OPEN62541_USE_XMLPARSER = YES | ||
| USR_CXXFLAGS += -std=c++11 | ||
| EOL | ||
|
|
||
| echo "open62541 version $OPEN62541_VERSION installed successfully. You should now be able to build the OPC UA support in EPICS." | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.