Browse Source

add systemdef.pri and linuxsystemtest.sh

yuchuli 3 years ago
parent
commit
557a56151a
5 changed files with 53 additions and 19 deletions
  1. 8 1
      include/common.pri
  2. 2 2
      include/ivprotobuf.pri
  3. 38 0
      include/linuxsystemtest.sh
  4. 5 0
      include/systemdef.pri
  5. 0 16
      include/ubuntucommon.sh

+ 8 - 1
include/common.pri

@@ -1,6 +1,13 @@
 
-system("./ivversion.sh ")
+unix:system("./ivversion.sh ")
 
+DEFINES += RUNSYSTEMTEST
+
+if(contains(DEFINES,RUNSYSTEMTEST)){
+unix:system("./linuxsystemtest.sh ")
+}
+
+include(systemdef.pri)
 
 INCLUDEPATH += $$PWD/../include/
 LIBS += -L$$PWD/../bin/ -lxmlparam -lmodulecomm  -livlog -livfault -livexit -livbacktrace -livchart

+ 2 - 2
include/ivprotobuf.pri

@@ -1,8 +1,8 @@
 
-message($$QMAKE_HOST.version_string)
+#message($$QMAKE_HOST.version_string)
 
 ##if 16.04, compile protobuf 3.13 and make install. and use static lib.
-contains($$QMAKE_HOST.version_string,16.04){
+if(contains(DEFINES,SYSTEM_UBUNTU1604)){
     unix:LIBS += -L/home/yuchuli/soft/protobuf/cmake/build
     message("ubuntu 16.04")
 }

+ 38 - 0
include/linuxsystemtest.sh

@@ -0,0 +1,38 @@
+systemname=`uname -a`
+#echo $systemname
+
+OSDEFINFO=$(echo "DEFINES += SYSTEM_UBUNTU1804")
+
+ubuntu1804="18.04."
+ubuntu1604="16.04."
+resultos=$(echo $systemname | grep "Ubuntu")
+if [ "$resultos" != "" ]
+then
+  result=$(echo $systemname | grep "${ubuntu1804}")
+  if [ "$result" != "" ]
+  then
+#      echo "ubuntu 18.04"
+      OSDEFINFO=$(echo "DEFINES += SYSTEM_UBUNTU1804")
+  fi
+
+  result=$(echo $systemname | grep "${ubuntu1604}")
+  if [ "$result" != "" ]
+  then
+#      echo "ubuntu 16.04"
+      OSDEFINFO=$(echo "DEFINES += SYSTEM_UBUNTU1604")
+  fi
+fi
+
+
+
+if [ -f "systemdef.pri" ]; then
+#  echo "file exist."
+  OLDOSDEFINFO=$(sed -n '/DEFINES += SYSTEM/p' systemdef.pri)
+#  echo "old:"$OLDOSDEFINFO
+  if [ ! "$OSDEFINFO"x = "$OLDOSDEFINFO"x ]; then
+	echo "replace DEFINES in systemdef.pri"
+	sed -i "s/^.*DEFINES += SYSTEM.*$/DEFINES += SYSTEM_UBUNTU1804/" systemdef.pri 
+  fi
+else
+  echo "systemdef.pri not exist."
+fi

+ 5 - 0
include/systemdef.pri

@@ -0,0 +1,5 @@
+
+DEFINES += SYSTEM_UBUNTU1804
+
+
+

+ 0 - 16
include/ubuntucommon.sh

@@ -1,16 +0,0 @@
-systemname=`uname -a`
-echo $systemname
-
-ubuntu1804="18.04."
-ubuntu1604="16.04."
-result=$(echo $systemname | grep "${ubuntu1804}")
-if [[ "$result" != "" ]]
-then
-    echo "ubuntu 18.04"
-fi
-
-result=$(echo $systemname | grep "${ubuntu1604}")
-if [[ "$result" != "" ]]
-then
-    echo "ubuntu 16.04"
-fi