Skip to content

Commit

Permalink
Merge pull request #212 from mtconnect/dev_merge
Browse files Browse the repository at this point in the history
  • Loading branch information
wsobel authored May 25, 2022
2 parents 766cbac + 3fad54d commit 0928b1f
Show file tree
Hide file tree
Showing 858 changed files with 371,587 additions and 24,673 deletions.
34 changes: 28 additions & 6 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,43 @@ AllowShortFunctionsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: false
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 4
SpaceBeforeCpp11BracedList: true
AlignEscapedNewlines: true
BreakStringLiterals: true
BreakBeforeBraces: Allman
BinPackParameters: true
BinPackArguments: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: true
IncludeCategories:
- Regex: '^("|<)boost/'
Priority: 1
- Regex: '^<boost/asio.+'
Priority: -1
- Regex: '^("|<)date/'
Priority: 2
- Regex: '^("|<)dlib/'
Priority: 3
- Regex: '^("|<)libxml/'
Priority: 4
- Regex: '^("|<)nlohmann/'
Priority: 5
- Regex: '<[[:alnum:].]+>'
Priority: 6
- Regex: '^<.+'
Priority: 2
- Regex: '.*'
Priority: 1
Priority: 8
69 changes: 69 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# build docker image

# needs github secrets set for these -
# ACCESS_TOKEN - a github personal access token to access the private repo
# DOCKERHUB_TOKEN - token for the account specified at env.dockerhub_username

name: Build Docker image

# variables
# can use these below, eg with ${{ env.version }}
env:
version: 2.0.0.1 #. keep uptodate (how?)
dockerhub_username: ladder99 #. change to mtconnect
platforms: linux/amd64,linux/arm64

# when to run workflow
on:
# # run on push or pull request events for the master branch
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]

# allows you to run this workflow manually from the actions tab
workflow_dispatch:

# a workflow run has one or more jobs that can run sequentially or in parallel
jobs:
# this workflow contains a single job called "build"
build:
# the type of runner that the job will run on
runs-on: ubuntu-latest

# steps represent a sequence of tasks that will be executed as part of the job
steps:
# checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v3

# the QEMU emulator lets us build for arm processors also
# see https://github.com/docker/setup-qemu-action
- name: Set up QEMU emulator
uses: docker/setup-qemu-action@v1

# see https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ env.dockerhub_username }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# see https://github.com/docker/build-push-action
- name: Build image and push to DockerHub
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
platforms: ${{ env.platforms }}
secrets: "access_token=${{ secrets.ACCESS_TOKEN }}"

# docker hub user/repo:tag
tags: |
ladder99/agent2:latest
ladder99/agent2:${{ env.version }}
# push to docker hub
push: true
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ Release
*.log
test/agent.log*
build/
cmake-build-debug/**
cmake-build-release/**
.idea/**
ACCESS_TOKEN
.DS_Store
.vscode
45 changes: 31 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# The version number.
set(AGENT_VERSION_MAJOR 1)
set(AGENT_VERSION_MINOR 8)
set(AGENT_VERSION_MAJOR 2)
set(AGENT_VERSION_MINOR 0)
set(AGENT_VERSION_PATCH 0)
set(AGENT_VERSION_BUILD 3)
#set(AGENT_VERSION_RC "RC9")
set(AGENT_VERSION_BUILD 2)
set(AGENT_VERSION_RC "")

# This minimum version is to support Visual Studio 2017 and C++ feature checking and FetchContent
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

set(USE_FOLDERS ON)

Expand All @@ -19,13 +19,15 @@ set(INSTALL_GTEST OFF FORCE)

project(cppagent LANGUAGES C CXX)

# All of the C++ Agent code, DLib require C++ 14 features to compile.
# We will define these properties by default for each CMake target to be created.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CXX_COMPILE_FEATURES cxx_std_17)

set(WITH_PYTHON OFF CACHE STRING "With Python Support")
set(WITH_RUBY OFF CACHE STRING "With Ruby Support")

# By default only generate 2 configurations (Debug and Release) for simplicity.
# The user can change this option if required for the additional ones such as 'RelWithDebInfo'.
# The first type will be used as the default build type if the user does not specify one.
Expand Down Expand Up @@ -61,17 +63,31 @@ if(MSVC)
set(WINVER "0x0600" CACHE STRING "Windows Target Version: 0x0400 - 95 & NT 4.0, 0x0500 - 2000, 0x0501 - XP, 0x0600 - Vista, 0x0601 - 7, 0x0602 - 8")
endif()

if (UNIX)
add_compile_options(-fPIC -Wno-psabi -fvisibility-inlines-hidden -fvisibility=hidden)
ENDIF()

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
if (CONAN_USER_MRUBY_mruby)
message(INFO ": Turning on Embedded Ruby")
set(WITH_RUBY ON FORCE)
endif()

conan_basic_setup(TARGETS)

if(WITH_PYTHON)
set(Python_USE_STATIC_LIBS ON)

find_package(Python3 COMPONENTS Interpreter Development Development.Embed)
message("Include dirs of Python: " ${Python3_INCLUDE_DIRS} )
message("Libs of Python: " ${Python3_LIBRARIES} )
endif()

include(cmake/msvc_use_static_runtime.cmake)
include(cmake/osx_no_app_or_frameworks.cmake)
include(cmake/ClangFormat.cmake)
include(cmake/ClangTidy.cmake)

# Add our dependency projects
include(cmake/LibXML2.cmake)
include(cmake/DLib.cmake)
include(cmake/Date.cmake)
include(cmake/json.cmake)

# Add our projects
add_subdirectory(agent_lib)
add_subdirectory(agent)
Expand All @@ -82,6 +98,8 @@ endif()

include(cmake/ide_integration.cmake)

create_clangformat_target()

# For Visual Studio generators it is now possible (since V3.6) to set a default startup project.
# We will set this to the agent_test project.
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT agent_test)
Expand All @@ -91,6 +109,7 @@ install(DIRECTORY schemas/ DESTINATION "schemas")
install(DIRECTORY simulator/ DESTINATION "simulator")
install(DIRECTORY styles/ DESTINATION "styles")
install(DIRECTORY tools/ DESTINATION "tools")
install(DIRECTORY demo/ DESTINATION "demo")
install(FILES simulator/agent.cfg DESTINATION "bin")

set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
Expand All @@ -102,5 +121,3 @@ set(CPACK_PACKAGE_NAME "cppagent")
set(CPACK_PACKAGE_VENDOR "MTConnect.org")

include(CPack)


Loading

0 comments on commit 0928b1f

Please sign in to comment.