Commit 48b73769 authored by Adkins, Cameron's avatar Adkins, Cameron
Browse files

init: initial package setup

parents
Loading
Loading
Loading
Loading

.editorconfig

0 → 100644
+13 −0
Original line number Diff line number Diff line
# https://EditorConfig.org
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4

[*.nix]
indent_size = 2

.envrc

0 → 100644
+3 −0
Original line number Diff line number Diff line
watch_file package.nix

use flake

.gitignore

0 → 100644
+103 −0
Original line number Diff line number Diff line
# Temporary Files
*.swp
*.bak
*.tmp
*.tmp.diff
*.tmp.patch

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj
*.ko
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Build folders
build/
misc/
unstaged/
install/
output/

# Symlinks
result

# Nix closures
*.closure.*

# IDE files
*.pro.user
*.autosave
CMakeLists.txt.user
CMakeCache.txt
cmake-build-debug/
cmake-build-release/
cmake-build-relwithdebinfo/
.idea/
.cache/
.xdg_config/
.desktop/
.direnv/

# Generated git hooks
.gitsetup/hooks/post-checkout
.gitsetup/hooks/post-commit
.gitsetup/hooks/post-merge
.gitsetup/hooks/pre-push

# Binary files we don't want to accidentally track
*.3ds
*.blend
*.dae
*.dxf
*.fbx
*.zip
*.ilk
*.pdb

# No files with caps please, rename them instead
*.3DS
*.JPG
*.GIF
*.ZIP
*.STL

CMakeLists.txt

0 → 100644
+100 −0
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.25)

project(
  opcua_bridge
  LANGUAGES CXX C
  VERSION 2025.2.1
  DESCRIPTION "OPCUA ROS2 Bridge"
  HOMEPAGE_URL "https://code.ornl.gov/ros/packages/opcua-bridge"
)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON)

# Compiler config.
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# Ament
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)

# ROS
find_package(rclcpp REQUIRED)

# Standard (e.g. fmt)
find_package(fmt REQUIRED)
find_package(oru REQUIRED)
find_package(open62541pp REQUIRED)

list(
  APPEND DEPENDENCIES
  rclcpp::rclcpp
  fmt::fmt
  open62541pp::open62541pp
  oru::core
)

# Interface generation.
file(GLOB_RECURSE PROJECT_ACTIONS  RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/interfaces/**.action")
file(GLOB_RECURSE PROJECT_MESSAGES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/interfaces/**.msg")
file(GLOB_RECURSE PROJECT_SERVICES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/interfaces/**.srv")

if(PROJECT_ACTIONS OR PROJECT_MESSAGES OR PROJECT_SERVICES)
  rosidl_generate_interfaces(
    ${PROJECT_NAME}
    ${PROJECT_ACTIONS}
    ${PROJECT_MESSAGES}
    ${PROJECT_SERVICES}
  )

  rosidl_get_typesupport_target(CPP_TYPESUPPORT_TARGET ${PROJECT_NAME} "rosidl_typesupport_cpp")
endif()

function(GenerateNode)
  set(
    one_value_args
    NODE_NAME
  )
  set(
    multi_value_args
    SOURCES
    HEADERS
  )

  cmake_parse_arguments(GenerateNode "" "${one_value_args}" "${multi_value_args}" ${ARGN})

  # Generate target.
  add_executable(${GenerateNode_NODE_NAME})
  target_sources(${GenerateNode_NODE_NAME} PRIVATE ${GenerateNode_SOURCES})
  target_sources(${GenerateNode_NODE_NAME} PUBLIC FILE_SET HEADERS BASE_DIRS include FILES ${GenerateNode_HEADERS})

  target_include_directories(
    ${GenerateNode_NODE_NAME} PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
    $<INSTALL_INTERFACE:include>
  )

  target_link_libraries(
    ${GenerateNode_NODE_NAME}
    ${DEPENDENCIES}
  )

  target_link_libraries(${GenerateNode_NODE_NAME} "${CPP_TYPESUPPORT_TARGET}")

  # Install.
  install(TARGETS ${GenerateNode_NODE_NAME} DESTINATION lib/${PROJECT_NAME})
endfunction()

# Actually create nodes.
file(GLOB_RECURSE PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/**.cpp")
file(GLOB_RECURSE PROJECT_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/**.hpp")

GenerateNode(
  NODE_NAME ${PROJECT_NAME}
  SOURCES ${PROJECT_SOURCES}
  HEADERS ${PROJECT_HEADERS}
)

ament_package()

flake.lock

0 → 100644
+239 −0
Original line number Diff line number Diff line
{
  "nodes": {
    "extended-msgs": {
      "inputs": {
        "fire": [
          "oru",
          "fire"
        ]
      },
      "locked": {
        "lastModified": 1753312847,
        "narHash": "sha256-v9MNcFVlHw/xyn7v/aT0zh+Ze8ZEn+k9CM8AhqI59Nw=",
        "ref": "master",
        "rev": "956da98e4f4714062841f9508cd8a3ddc26bb374",
        "revCount": 8,
        "type": "git",
        "url": "ssh://git@code.ornl.gov/mdf/ros/extended-msgs.git"
      },
      "original": {
        "ref": "master",
        "type": "git",
        "url": "ssh://git@code.ornl.gov/mdf/ros/extended-msgs.git"
      }
    },
    "fire": {
      "inputs": {
        "lasm": "lasm",
        "nixpkgs": [
          "fire",
          "ornlpkgs",
          "nixpkgs"
        ],
        "nro": "nro",
        "ornlpkgs": "ornlpkgs",
        "parts": [
          "fire",
          "ornlpkgs",
          "parts"
        ]
      },
      "locked": {
        "host": "code.ornl.gov",
        "lastModified": 1753319212,
        "narHash": "sha256-/E79cRl3C5bNMHCkLIMRxklT6JnOaQ6+POZH1GkexQY=",
        "owner": "ros",
        "repo": "fire",
        "rev": "ecbd67c9f5fd31ecfc3fc9fd8bddbaea843486d1",
        "type": "gitlab"
      },
      "original": {
        "host": "code.ornl.gov",
        "owner": "ros",
        "repo": "fire",
        "type": "gitlab"
      }
    },
    "flake-utils": {
      "inputs": {
        "systems": "systems"
      },
      "locked": {
        "lastModified": 1731533236,
        "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "lasm": {
      "inputs": {
        "flake-utils": [
          "fire",
          "nro",
          "flake-utils"
        ],
        "nixpkgs": [
          "fire",
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1749414546,
        "narHash": "sha256-K28T2POA8mKNs0TwfjYZCSCAljPX3rLy9KnCcRrRvbY=",
        "owner": "cadkin",
        "repo": "ld-audit-search-mod",
        "rev": "b662dd19c285acc2cd912f45a6f563882ad4913a",
        "type": "github"
      },
      "original": {
        "owner": "cadkin",
        "repo": "ld-audit-search-mod",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1748026580,
        "narHash": "sha256-rWtXrcIzU5wm/C8F9LWvUfBGu5U5E7cFzPYT1pHIJaQ=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "11cb3517b3af6af300dd6c055aeda73c9bf52c48",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "25.05",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs-lib": {
      "locked": {
        "lastModified": 1751159883,
        "narHash": "sha256-urW/Ylk9FIfvXfliA1ywh75yszAbiTEVgpPeinFyVZo=",
        "owner": "nix-community",
        "repo": "nixpkgs.lib",
        "rev": "14a40a1d7fb9afa4739275ac642ed7301a9ba1ab",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "repo": "nixpkgs.lib",
        "type": "github"
      }
    },
    "nro": {
      "inputs": {
        "flake-utils": "flake-utils",
        "nixpkgs": [
          "fire",
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1748720382,
        "narHash": "sha256-8CC1XSJMO+6LU9LOm58u4dqjHTb6dpRFXv+YoA2EO98=",
        "owner": "lopsided98",
        "repo": "nix-ros-overlay",
        "rev": "2435baa8acbd4bf244551dff13a42978f8075319",
        "type": "github"
      },
      "original": {
        "owner": "lopsided98",
        "repo": "nix-ros-overlay",
        "type": "github"
      }
    },
    "ornlpkgs": {
      "inputs": {
        "nixpkgs": "nixpkgs",
        "parts": "parts"
      },
      "locked": {
        "host": "code.ornl.gov",
        "lastModified": 1752346665,
        "narHash": "sha256-1wC9lnFEU9y7N+y6xUr8Bpm7KnoYJynND5gyNEI2W70=",
        "owner": "nix",
        "repo": "ornlpkgs",
        "rev": "2539d16f222c02ada3704993b78238cdc662388e",
        "type": "gitlab"
      },
      "original": {
        "host": "code.ornl.gov",
        "owner": "nix",
        "repo": "ornlpkgs",
        "type": "gitlab"
      }
    },
    "oru": {
      "inputs": {
        "extended-msgs": "extended-msgs",
        "fire": [
          "fire"
        ]
      },
      "locked": {
        "lastModified": 1753373956,
        "narHash": "sha256-YN8VBE6UFOJyrbmmL2CBbSD8zb4wdxslSFJcqvAWB/k=",
        "ref": "master",
        "rev": "4f7b8dc7ac2e64fe00e5b7d612012be1357ebbbc",
        "revCount": 15,
        "type": "git",
        "url": "ssh://git@code.ornl.gov/mdf/ros/oru.git"
      },
      "original": {
        "ref": "master",
        "type": "git",
        "url": "ssh://git@code.ornl.gov/mdf/ros/oru.git"
      }
    },
    "parts": {
      "inputs": {
        "nixpkgs-lib": "nixpkgs-lib"
      },
      "locked": {
        "lastModified": 1751413152,
        "narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=",
        "owner": "hercules-ci",
        "repo": "flake-parts",
        "rev": "77826244401ea9de6e3bac47c2db46005e1f30b5",
        "type": "github"
      },
      "original": {
        "owner": "hercules-ci",
        "repo": "flake-parts",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "fire": "fire",
        "oru": "oru"
      }
    },
    "systems": {
      "locked": {
        "lastModified": 1681028828,
        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
        "owner": "nix-systems",
        "repo": "default",
        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
        "type": "github"
      },
      "original": {
        "owner": "nix-systems",
        "repo": "default",
        "type": "github"
      }
    }
  },
  "root": "root",
  "version": 7
}