ソースを参照

Better build reliability.

Carlos Garcia 6 年 前
コミット
93b7cf0a7d
2 ファイル変更15 行追加8 行削除
  1. 11 4
      build.sh
  2. 4 4
      code_boost/src/CMakeLists.txt

+ 11 - 4
build.sh

@@ -1,24 +1,31 @@
 #!/bin/bash
 
+# Create the Makefile using cmake, from a clean build directory
 cd code_boost/src/build/
+if [ ${PWD##*/} = 'build' ]; then
+    # Only delete everything if we are in a folder called 'build'.
+    rm -rf ./*
+else
+    echo "Error: The 'build' directory was not found."
+    exit
+fi
 cmake ..
 
 if [ -f Makefile ]; then
     make
 else
-    echo "CMake did not finish successfully."
+    echo "Error: 'cmake' did not finish successfully."
     exit
 fi
 
 if [ $? -eq 0 ]; then
     cp libpcapreader.so ../../../code/ID2TLib/
 else
-    echo "Make did not finish successfully."
+    echo "Error: 'make' did not finish successfully."
     exit
 fi
 
 cd ../../../
-#ln -s code/CLI.py id2t.py
 
 # Create the ID2T script
 cat >./id2t  <<EOF
@@ -34,5 +41,5 @@ EOF
 chmod +x ./code/CLI.py
 chmod +x ./id2t
 
-echo -e "\n\nAll is set. ID2T is ready to be used."
+echo -e "\n\nAll is set. ID2T is ready."
 echo -e "\nRun ID2T with the command './id2t'"

+ 4 - 4
code_boost/src/CMakeLists.txt

@@ -41,6 +41,8 @@ ENDIF()
 FIND_PACKAGE(PythonLibs 3.0 REQUIRED)
 IF(PYTHONLIBS_FOUND)
   INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_DIRS}")
+  MESSAGE(STATUS "Python includes found in: " ${PYTHON_INCLUDE_DIRS} )
+  MESSAGE(STATUS "Python libs found in: " ${PYTHON_LIBRARIES} )
 ELSE()
   MESSAGE(FATAL_ERROR "Unable to find Python libraries.")
 ENDIF()
@@ -49,6 +51,7 @@ ENDIF()
 FIND_PACKAGE(Boost 1.54 QUIET)
 IF (Boost_FOUND)
     INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}")
+    MESSAGE(STATUS "Boots includes found in: " ${Boost_INCLUDE_DIRS} )
     SET(Boost_USE_STATIC_LIBS OFF)
     SET(Boost_USE_MULTITHREADED ON)
     SET(Boost_USE_STATIC_RUNTIME OFF)
@@ -72,8 +75,5 @@ SET_target_properties(sqlite3 PROPERTIES POSITION_INDEPENDENT_CODE ON)
 
 ADD_LIBRARY(pcapreader SHARED ${SOURCE_FILES})
 # Libs pthread and dl are prerequisites of SQLiteCpp
-TARGET_LINK_LIBRARIES(pcapreader ${Boost_LIBRARIES} "${TINS_LIBRARY}" SQLiteCpp sqlite3 pthread dl)
+TARGET_LINK_LIBRARIES(pcapreader ${Boost_LIBRARIES} "${TINS_LIBRARY}" ${PYTHON_LIBRARIES} SQLiteCpp sqlite3 pthread dl)
 
-# comment this out to build executable (for development)
-#ADD_EXECUTABLE(cpp-pcapreader ${SOURCE_FILES})
-#TARGET_LINK_LIBRARIES(cpp-pcapreader ${Boost_LIBRARIES} "${TINS_LIBRARY}" SQLiteCpp sqlite3 pthread dl)