summaryrefslogtreecommitdiffstats
path: root/tests/open62541-testserver/CMakeLists.txt
blob: 067d8af19b687e7c304ab337764c0ca4647a8a57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Generated from open62541-testserver.pro.

#####################################################################
## open62541-testserver Binary:
#####################################################################

qt_add_executable(open62541-testserver
    SOURCES
        ../../src/plugins/opcua/open62541/qopen62541utils.cpp
        ../../src/plugins/opcua/open62541/qopen62541valueconverter.cpp
        main.cpp
        testserver.cpp testserver.h
    INCLUDE_DIRECTORIES
        ../../src/plugins/opcua/open62541
    OUTPUT_DIRECTORY # special case
        "${CMAKE_CURRENT_BINARY_DIR}" # special case
    PUBLIC_LIBRARIES
        Qt::Core
        Qt::OpcUaPrivate
)

# special case begin
set_target_properties(open62541-testserver PROPERTIES MACOSX_BUNDLE TRUE)
# special case end

# Resources:
set(certs_resource_files
    "pki/own/certs/open62541-testserver.der"
    "pki/own/private/open62541-testserver.der"
    "pki/trusted/certs/opcuaviewer.der"
    "pki/trusted/certs/tst_security.der"
)

qt_add_resource(open62541-testserver "certs"
    PREFIX
        "/"
    FILES
        ${certs_resource_files}
)


#### Keys ignored in scope 1:.:.:open62541-testserver.pro:<TRUE>:
# DEPENDPATH = "INCLUDEPATH"
# QMAKE_CFLAGS_RELEASE = "--O2"
# QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = "--O2"
# TEMPLATE = "app"

# special case begin
# We need to disable optimizations on MSVC, to circumvent buggy code in the open62541.c file.
# Otherwise the test server fails to launch on Windows MSVC with UA_STATUSCODE_BADOUTOFMEMORY.
# We also disable them on Unixy platforms, to mimic the qmake fix done in QTBUG-75020.
# See QTBUG-85939 for details.
qt_opcua_disable_optimizations_in_current_dir()
# special case end

## Scopes:
#####################################################################

qt_extend_target(open62541-testserver CONDITION QT_FEATURE_open62541 AND NOT QT_FEATURE_system_open62541
    SOURCES
        ../../src/3rdparty/open62541/open62541.h
    ../../src/3rdparty/open62541/open62541.c # special case
    INCLUDE_DIRECTORIES
        ../../src/3rdparty/open62541
)

# special case begin
#qt_extend_target(open62541-testserver CONDITION QT_FEATURE_mbedtls AND QT_FEATURE_open62541 AND NOT QT_FEATURE_system_open62541
#    DEFINES
#        UA_ENABLE_ENCRYPTION
#        UA_ENABLE_ENCRYPTION_MBEDTLS
#    LIBRARIES
#        mbedtls
#)
# special case end

# special case begin
if (QT_FEATURE_open62541_security AND NOT QT_FEATURE_system_open62541)
    find_package(WrapOpenSSL 1.1)
endif()

qt_extend_target(open62541-testserver CONDITION QT_FEATURE_open62541_security AND WrapOpenSSL_FOUND AND QT_FEATURE_open62541 AND NOT QT_FEATURE_system_open62541
    DEFINES
        UA_ENABLE_ENCRYPTION
        UA_ENABLE_ENCRYPTION_OPENSSL
    LIBRARIES
        WrapOpenSSL::WrapOpenSSL
)
# special case end

qt_extend_target(open62541-testserver CONDITION QT_FEATURE_open62541 AND WIN32 AND MSVC AND NOT QT_FEATURE_system_open62541 # special case
    PUBLIC_LIBRARIES
        ws2_32.lib
)

qt_extend_target(open62541-testserver CONDITION (QT_FEATURE_open62541 AND NOT QT_FEATURE_system_open62541) AND (WIN32 AND GCC) # special case
    PUBLIC_LIBRARIES
        ws2_32
)

# special case begin
#qt_extend_target(open62541-testserver CONDITION QT_FEATURE_open62541 AND NOT QT_FEATURE_system_open62541 AND (WINRT OR WIN32 AND MSVC)
#    SOURCES
#        ../../src/3rdparty/open62541/open62541.c
#)
# special case end

# special case begin
if (QT_FEATURE_open62541 AND NOT QT_FEATURE_system_open62541)
    if (NOT (WINRT OR WIN32 AND MSVC)) # special case
        set_source_files_properties(../../src/3rdparty/open62541/open62541.c PROPERTIES
        COMPILE_OPTIONS
            "-Wno-unused-parameter;-Wno-unused-function;-Wno-format;-Wno-format-security;-Wno-strict-aliasing;-Wno-unused-result;-std=c99")
    elseif(WIN32 AND MSVC)
        # CMake uses C11+ by default and the _Static_assert expansion fails during compilation
        set_source_files_properties(../../src/3rdparty/open62541/open62541.c PROPERTIES LANGUAGE CXX)
        set_source_files_properties(../../src/3rdparty/open62541/open62541.c PROPERTIES
        COMPILE_OPTIONS
            "/Zc:strictStrings-;/permissive;/wd2362")
    endif()
endif()
# special case end

#### Keys ignored in scope 10:.:../../src/3rdparty:../../src/3rdparty/open62541.pri:else:
# OPEN62541_CFLAGS = "-Wno-unused-parameter" "-Wno-unused-function" "-Wno-format" "-Wno-strict-aliasing" "-Wno-unused-result" "-std=c99"
# QMAKE_EXTRA_COMPILERS = "open62541_compiler"
# open62541_compiler.commands = "$$QMAKE_CC" "-c" "$(CFLAGS)" "$$OPEN62541_CFLAGS" "$(INCPATH)" "${QMAKE_FILE_IN}" "-o" "${QMAKE_FILE_OUT}"
# open62541_compiler.dependency_type = "TYPE_C"
# open62541_compiler.input = "OPEN62541_SOURCES"
# open62541_compiler.name = "compiling" "${QMAKE_FILE_IN}"
# open62541_compiler.output = "${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${firstQMAKE_EXT_OBJ}"

#### Keys ignored in scope 11:.:../../src/3rdparty:../../src/3rdparty/open62541.pri:silent:
# open62541_compiler.commands = "@echo" "compiling" "${QMAKE_FILE_IN}" "&&"

qt_extend_target(open62541-testserver CONDITION QT_FEATURE_system_open62541 OR NOT QT_FEATURE_open62541
    LIBRARIES
        open62541
)

#### Keys ignored in scope 5:.:.:open62541-testserver.pro:WIN32:
# DESTDIR = "./"