install_name_tool tweaks to the library to make it automatically run properly from...
authorJarvis <jarvis@Janis-MacBook-Air.local>
Tue, 11 Feb 2020 17:44:33 +0000 (19:44 +0200)
committerJarvis <jarvis@Janis-MacBook-Air.local>
Tue, 11 Feb 2020 17:44:33 +0000 (19:44 +0200)
Common/C++/SmartAPI/smartapi.pro

index 04726d0cba2547332b4f511807899460f604be8a..7d8081482be71cc8822afc5309f9e5cd9fe3fab3 100644 (file)
@@ -9,6 +9,10 @@ QT += core network
 TARGET = smartapi
 TEMPLATE = lib
 
+message("Building Smart API")
+
+LIBS_PATH = "/Users/jarvis/workspace/Jarvis_Lib/Jarvis_1.0"
+
 # Uncomment this to enable MQTT support with Eclipse Paho
 # Note that you need to fill in the location of compiled
 # Paho libraries and headers in smartapipahomqtt.pro
@@ -30,25 +34,37 @@ LIBS += -lraptor2
 LIBS += -lrasqal
 LIBS += -lssl -lcrypto
 
-INCLUDEPATH += "/usr/include/redland/"
-INCLUDEPATH += "/usr/include/raptor2/"
-INCLUDEPATH += "/usr/include/rasqal/"
+INCLUDEPATH += $${LIBS_PATH}/redland/include
+INCLUDEPATH += $${LIBS_PATH}/raptor/include
+INCLUDEPATH += $${LIBS_PATH}/rasqal/include
+INCLUDEPATH += $${LIBS_PATH}/openssl/openssl1.1/include/
 
 macx {
-       INCLUDEPATH += "/Users/jarvis/workspace/Jarvis_Lib/Jarvis_1.0/redland/include"
-       INCLUDEPATH += "/Users/jarvis/workspace/Jarvis_Lib/Jarvis_1.0/raptor/include"
-       INCLUDEPATH += "/Users/jarvis/workspace/Jarvis_Lib/Jarvis_1.0/rasqal/include"
-       LIBS += -L/usr/local/lib
+        message("Building for macOS")
+        RESULT_PATH = "lib/libsmartapi.1.0.0.dylib"
+        
+        LIBS += -L$${LIBS_PATH}/redland/lib/osx64
+        LIBS += -L$${LIBS_PATH}/raptor/lib/osx64
+        LIBS += -L$${LIBS_PATH}/rasqal/lib/osx64
+        LIBS += -L$${LIBS_PATH}/openssl/openssl1.1/lib/osx64
 
-       # use openssl installed with brew instead of default
-       # openssl which is missing several necessary features
-       INCLUDEPATH += "/usr/local/homebrew/opt/openssl/include/"
-       LIBS += -L/usr/local/homebrew/opt/openssl/lib
+        # This should not be needed, QMake is smart enough to add it
+        #QMAKE_FLAGS_RPATH =
+        #QMAKE_LFLAGS = -Wl,-rpath,../Frameworks
+
+        QMAKE_POST_LINK += install_name_tool -change /usr/local/lib/librdf.0.dylib @executable_path/../Frameworks/librdf.0.dylib $${RESULT_PATH} \
+                && install_name_tool -change /usr/local/lib/libraptor2.0.dylib @executable_path/../Frameworks/libraptor2.0.dylib $${RESULT_PATH} \
+                && install_name_tool -change /usr/local/lib/librasqal.3.dylib @executable_path/../Frameworks/librasqal.3.dylib $${RESULT_PATH} \
+                && install_name_tool -change /usr/local/opt/openssl/lib/libssl.1.0.0.dylib @executable_path/../Frameworks/libssl.1.0.0.dylib $${RESULT_PATH} \
+                && install_name_tool -change /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib @executable_path/../Frameworks/libcrypto.1.0.0.dylib $${RESULT_PATH}
 }
-win32 {
-       INCLUDEPATH += "C:/msys64/mingw64/include/redland"
-       INCLUDEPATH += "C:/msys64/mingw64/include/raptor2"
-       INCLUDEPATH += "C:/msys64/mingw64/include/rasqal"
+win64 {
+        message("Building for Windows")
+
+        LIBS += -L$${LIBS_PATH}/redland/lib/win64
+        LIBS += -L$${LIBS_PATH}/raptor/lib/win64
+        LIBS += -L$${LIBS_PATH}/rasqal/lib/win64
+        LIBS += -L$${LIBS_PATH}/openssl/openssl1.1/lib/win64
 }
 
 contains(DEFINES, WITH_PAHO) {