Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ClangRelWithDebInfoAsan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ jobs:
run: |
cmake "$GITHUB_WORKSPACE" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_TESTING=ON \
-DNODESETLOADER_ENABLE_TESTING=ON \
-DBUILD_SHARED_LIBS=ON \
-DENABLE_ASAN=ON ..
-DNODESETLOADER_ENABLE_ASAN=ON ..

- name: Build
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/GccDebugMemcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ jobs:
run: |
cmake "$GITHUB_WORKSPACE" \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_TESTING=ON \
-DNODESETLOADER_ENABLE_TESTING=ON \
-DBUILD_SHARED_LIBS=ON \
-DENABLE_DATATYPEIMPORT_TEST=ON \
-DCALC_COVERAGE=ON \
-DNODESETLOADER_ENABLE_DATATYPEIMPORT_TEST=ON \
-DNODESETLOADER_CALC_COVERAGE=ON \
..

- name: Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/GccIntegrationTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ jobs:
run: |
cmake "$GITHUB_WORKSPACE" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_TESTING=ON \
-DNODESETLOADER_ENABLE_TESTING=ON \
-DBUILD_SHARED_LIBS=ON \
-DENABLE_INTEGRATION_TEST=ON \
-DNODESETLOADER_ENABLE_INTEGRATION_TEST=ON \
..

- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: |
cd ./nodesetLoader && cmake "-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake-conan/conan_provider.cmake" -DCMAKE_BUILD_TYPE=Debug `
-DUA_NAMESPACE_ZERO=FULL `
-DENABLE_TESTING=ON . && `
-DNODESETLOADER_ENABLE_TESTING=ON . && `
cmake --build .

- name: Test
Expand Down
67 changes: 38 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,55 @@ include(GNUInstallDirs)

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

option(ENABLE_TESTING "enable tests" off)
option(ENABLE_EXAMPLES "enable examples" on)
option(ENABLE_BACKEND_STDOUT "backend for stdout" on)
option(ENABLE_ASAN "build with address sanitizer enabled" off)
option(ENABLE_INTEGRATION_TEST "run detailled tests to compare address spaces" off)
option(ENABLE_BUILD_INTO_OPEN62541 "make nodesetLoader part of the open62541 library" off)
option(ENABLE_DATATYPEIMPORT_TEST "run tests for importing datatypes" off)
option(CALC_COVERAGE "calculate code coverage" off)
option(NODESETLOADER_ENABLE_TESTING "enable tests" off)
option(NODESETLOADER_ENABLE_EXAMPLES "enable examples" on)
option(NODESETLOADER_ENABLE_BACKEND_STDOUT "backend for stdout" on)
option(NODESETLOADER_ENABLE_ASAN "build with address sanitizer enabled" off)
option(NODESETLOADER_ENABLE_INTEGRATION_TEST "run detailled tests to compare address spaces" off)
option(NODESETLOADER_ENABLE_BUILD_INTO_OPEN62541 "make nodesetLoader part of the open62541 library" off)
option(NODESETLOADER_ENABLE_DATATYPEIMPORT_TEST "run tests for importing datatypes" off)
option(NODESETLOADER_CALC_COVERAGE "calculate code coverage" off)

# deprecated options without project prefix
if(DEFINED ENABLE_BACKEND_STDOUT)
message(WARNING "ENABLE_BACKEND_STDOUT is deprecated. Use NODESETLOADER_ENABLE_BACKEND_STDOUT instead.")
set(NODESETLOADER_ENABLE_BACKEND_STDOUT ${ENABLE_BACKEND_STDOUT} CACHE BOOL "backend for stdout" FORCE)
endif()
if(DEFINED ENABLE_BUILD_INTO_OPEN62541)
message(WARNING "ENABLE_BUILD_INTO_OPEN62541 is deprecated. Use NODESETLOADER_ENABLE_BUILD_INTO_OPEN62541 instead.")
set(NODESETLOADER_ENABLE_BUILD_INTO_OPEN62541 ${ENABLE_BUILD_INTO_OPEN62541} CACHE BOOL "make nodesetLoader part of the open62541 library" FORCE)
endif()

# TODO: Include integration tests after support for XML Data
# Encoding has been added to the open62541 >= 1.3.2.
# Currently, the integration tests will fail for
# open62541 v1.3.2 and disable successful CI build.
set(ENABLE_INTEGRATION_TEST off)

if(${ENABLE_BUILD_INTO_OPEN62541})
set(NODESETLOADER_ENABLE_INTEGRATION_TEST off)

if(${NODESETLOADER_ENABLE_BUILD_INTO_OPEN62541})
# Disble code coverage, since this will be covered within open62541
set(CALC_COVERAGE off)
set(NODESETLOADER_CALC_COVERAGE off)

# TODO: Enable nodesetLoader tests within open62541 test suite
set(ENABLE_TESTING off)
set(NODESETLOADER_ENABLE_TESTING off)

# TODO: Enable nodesetLoader examples within open62541
set(ENABLE_EXAMPLES off)
set(NODESETLOADER_ENABLE_EXAMPLES off)

set(ENABLE_BACKEND_STDOUT off)
set(NODESETLOADER_ENABLE_BACKEND_STDOUT off)
endif()

# LibXML2 is always required
find_package(LibXml2 REQUIRED QUIET)

add_library(coverageLib INTERFACE)
add_library(NodesetLoaderCoverage INTERFACE)

if(NOT ${ENABLE_BUILD_INTO_OPEN62541})
if(NOT ${NODESETLOADER_ENABLE_BUILD_INTO_OPEN62541})
# open62541 ia always required.
# But we need to avoid a cyclic dependency if the loader is built into open62541.
find_package(open62541 REQUIRED)

if(${CALC_COVERAGE})
if(${NODESETLOADER_CALC_COVERAGE})
#link against this library to gather coverage info
#set(GCOV_COMPILE_OPTIONS -g -O0 -fno-inline -fno-inline-small-functions -fno-default-inline -fprofile-arcs -ftest-coverage)

Expand All @@ -56,12 +65,12 @@ if(NOT ${ENABLE_BUILD_INTO_OPEN62541})
# compiling and -lgcov when linking
#add_compile_options(--coverage -O0)
#add_link_options(--coverage)
target_compile_options(coverageLib INTERFACE
target_compile_options(NodesetLoaderCoverage INTERFACE
-O0 # no optimization
-g # generate debug info
--coverage # sets all required flags)
)
target_link_libraries(coverageLib INTERFACE --coverage)
target_link_libraries(NodesetLoaderCoverage INTERFACE --coverage)
endif()

if(MSVC)
Expand Down Expand Up @@ -90,7 +99,7 @@ if(NOT ${ENABLE_BUILD_INTO_OPEN62541})
endif()
endif()

if(${ENABLE_BUILD_INTO_OPEN62541})
if(${NODESETLOADER_ENABLE_BUILD_INTO_OPEN62541})
# Examples for the ${OPEN62541_VERSION} string are:
# v1.2
# v1.2.3
Expand Down Expand Up @@ -175,7 +184,7 @@ else()
endif()
endif()

if(${ENABLE_TESTING})
if(${NODESETLOADER_ENABLE_TESTING})
find_package(Check REQUIRED)
if(NOT CHECK_LIBRARIES)
set(CHECK_LIBRARIES Check::check)
Expand Down Expand Up @@ -236,7 +245,7 @@ set(NODESETLOADER_PRIVATE_HEADERS
${NODESETLOADER_BACKEND_PRIVATE_HEADERS}
CACHE INTERNAL "")

if(NOT ${ENABLE_BUILD_INTO_OPEN62541})
if(NOT ${NODESETLOADER_ENABLE_BUILD_INTO_OPEN62541})
add_library(NodesetLoader ${NODESETLOADER_SOURCES})

target_include_directories(NodesetLoader
Expand All @@ -246,27 +255,27 @@ if(NOT ${ENABLE_BUILD_INTO_OPEN62541})
target_link_libraries(NodesetLoader PRIVATE ${NODESETLOADER_DEPS_LIBS})
target_link_libraries(NodesetLoader PRIVATE open62541::open62541)

if(${CALC_COVERAGE})
target_link_libraries(NodesetLoader PUBLIC coverageLib)
if(${NODESETLOADER_CALC_COVERAGE})
target_link_libraries(NodesetLoader PUBLIC NodesetLoaderCoverage)
endif()

target_compile_options(NodesetLoader PRIVATE ${C_COMPILE_DEFS})
set_target_properties(NodesetLoader PROPERTIES C_VISIBILITY_PRESET hidden)
if(${ENABLE_ASAN})
if(${NODESETLOADER_ENABLE_ASAN})
target_link_libraries(NodesetLoader INTERFACE "-g -fno-omit-frame-pointer -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,trace-cmp -fsanitize=leak -fsanitize=undefined")
endif()
endif()

if(${ENABLE_TESTING})
if(${NODESETLOADER_ENABLE_TESTING})
add_subdirectory(tests)
endif()

if(${CALC_COVERAGE})
if(${NODESETLOADER_CALC_COVERAGE})
add_subdirectory(coverage)
endif()

#install
if(NOT ${CALC_COVERAGE} AND NOT ${ENABLE_BUILD_INTO_OPEN62541})
if(NOT ${NODESETLOADER_CALC_COVERAGE} AND NOT ${NODESETLOADER_ENABLE_BUILD_INTO_OPEN62541})
set_target_properties(NodesetLoader PROPERTIES PUBLIC_HEADER "${NODESETLOADER_PUBLIC_HEADERS}")

install(TARGETS NodesetLoader
Expand Down
2 changes: 1 addition & 1 deletion backends/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(NODESETLOADER_BACKEND_DEPS_LIBS "")
set(NODESETLOADER_BACKEND_PUBLIC_HEADERS "")
set(NODESETLOADER_BACKEND_PRIVATE_HEADERS "")

if(${ENABLE_BACKEND_STDOUT})
if(${NODESETLOADER_ENABLE_BACKEND_STDOUT})
add_subdirectory(stdout)
endif()

Expand Down
4 changes: 2 additions & 2 deletions backends/open62541/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ set(NODESETLOADER_BACKEND_OPEN62541_PRIVATE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/RefServiceImpl.h
PARENT_SCOPE)

if(${ENABLE_TESTING})
if(${NODESETLOADER_ENABLE_TESTING})
add_subdirectory(tests)
endif()
if(${ENABLE_EXAMPLES})
if(${NODESETLOADER_ENABLE_EXAMPLES})
add_subdirectory(examples)
endif()
2 changes: 2 additions & 0 deletions backends/open62541/src/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ addNodeImpl(AddNodeContext *context, NL_Node *node) {
res = handleViewNode((const NL_ViewNode *)node, &id, &parentId,
&parentReferenceId, &lt, &qn, &description, server);
break;
default:
addedNodeStatus = UA_STATUSCODE_BADNOTIMPLEMENTED;
}

// If a node was not added to the server due to an error, we add such a node
Expand Down
4 changes: 2 additions & 2 deletions backends/open62541/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ add_test(NAME issue_266_Test
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND issue_266 ${CMAKE_CURRENT_SOURCE_DIR}/issue266_TestData.NodeSet2.xml)

if(${ENABLE_DATATYPEIMPORT_TEST})
if(${NODESETLOADER_ENABLE_DATATYPEIMPORT_TEST})
add_subdirectory(dataTypeImport)
endif()

if(${ENABLE_INTEGRATION_TEST})
if(${NODESETLOADER_ENABLE_INTEGRATION_TEST})
add_subdirectory(integration)
endif()
2 changes: 1 addition & 1 deletion backends/stdout/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
if(${ENABLE_EXAMPLES})
if(${NODESETLOADER_ENABLE_EXAMPLES})
add_subdirectory(examples)
endif()
8 changes: 4 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ add_executable(sort sort.c
${CMAKE_CURRENT_SOURCE_DIR}/../src/Sort.c
${CMAKE_CURRENT_SOURCE_DIR}/../src/Node.c)
target_include_directories(sort PRIVATE ${CHECK_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_SOURCE_DIR}/../include)
target_link_libraries(sort PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib open62541::open62541)
target_link_libraries(sort PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} NodesetLoaderCoverage open62541::open62541)
add_test(NAME sort_Test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND sort ${CMAKE_CURRENT_LIST_DIR})

add_executable(nodeContainer NodeContainer.c ${CMAKE_CURRENT_SOURCE_DIR}/../src/Node.c)
target_include_directories(nodeContainer PRIVATE ${CHECK_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../include ${CMAKE_CURRENT_SOURCE_DIR}/../src)
target_link_libraries(nodeContainer PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib open62541::open62541)
target_link_libraries(nodeContainer PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} NodesetLoaderCoverage open62541::open62541)
add_test(NAME nodeContainer_Test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND nodeContainer ${CMAKE_CURRENT_LIST_DIR})

add_executable(allocator allocator.c ${CMAKE_CURRENT_SOURCE_DIR}/../src/CharAllocator.c)
target_include_directories(allocator PRIVATE ${CHECK_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../src)
target_link_libraries(allocator PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib open62541::open62541)
target_link_libraries(allocator PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} NodesetLoaderCoverage open62541::open62541)
add_test(NAME allocatorTest WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND allocator ${CMAKE_CURRENT_LIST_DIR})

add_executable(parser parser.c)
target_link_libraries(parser PRIVATE NodesetLoader ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib open62541::open62541)
target_link_libraries(parser PRIVATE NodesetLoader ${CHECK_LIBRARIES} ${PTHREAD_LIB} NodesetLoaderCoverage open62541::open62541)
target_include_directories(parser PRIVATE ${CHECK_INCLUDE_DIR})
add_test(NAME parser_Test
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
Expand Down
Loading