mqtt/client.py
changeset 4001 5e0660d394e3
parent 3991 28354ba489b9
child 4005 482452574fb4
--- a/mqtt/client.py	Wed Jul 24 15:14:02 2024 +0200
+++ b/mqtt/client.py	Thu Aug 01 12:09:28 2024 +0200
@@ -122,12 +122,20 @@
 #include "iec_types_all.h"
 #include "beremiz.h"
 """
+        config = self.GetConfig()
         c_code += self.modeldata.GenerateC(c_path, locstr, self.GetConfig())
 
         with open(c_path, 'w') as c_file:
             c_file.write(c_code)
 
-        LDFLAGS = [' "' + os.path.join(PahoMqttCLibraryPath, "libpaho-mqtt3cs.a") + '"', '-lssl', '-lcrypto']
+        if config["AuthType"] == "x509":
+            static_lib = "libpaho-mqtt3cs.a"
+            libs = ['-lssl', '-lcrypto']
+        else:
+            static_lib = "libpaho-mqtt3c.a"
+            libs = []
+
+        LDFLAGS = [' "' + os.path.join(PahoMqttCLibraryPath, static_lib) + '"'] + libs
 
         CFLAGS = ' '.join(['-I"' + path + '"' for path in PahoMqttCIncludePaths])