Pārlūkot izejas kodu

Fix: Building and running on macOS

1. CMakeLists.txt was modified to use .so on macOS instead of the default .dylib
2. build.sh was modified to use readlink from GNU coreutils on macOS when creating the id2t-script
Stefan Schmidt 6 gadi atpakaļ
vecāks
revīzija
1b2a300f50
2 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  1. 3 0
      build.sh
  2. 4 0
      code_boost/src/CMakeLists.txt

+ 3 - 0
build.sh

@@ -31,6 +31,9 @@ cd ../../../
 cat >./id2t  <<EOF
 #!/bin/sh
 # Find the executable
+if [ $(uname) == 'Darwin' ]; then
+    alias readlink='greadlink'
+fi
 ID2T_DIR=\$(readlink -f \$0)
 SCRIPT_PATH=\${ID2T_DIR%/*}
 cd \$SCRIPT_PATH

+ 4 - 0
code_boost/src/CMakeLists.txt

@@ -77,6 +77,10 @@ ADD_LIBRARY(pcapreader SHARED ${SOURCE_FILES})
 # Libs pthread and dl are prerequisites of SQLiteCpp
 TARGET_LINK_LIBRARIES(pcapreader ${Boost_LIBRARIES} "${TINS_LIBRARY}" ${PYTHON_LIBRARIES} SQLiteCpp sqlite3 pthread dl)
 
+IF (APPLE)
+  SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
+ENDIF ()
+
 # 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)