Przeglądaj źródła

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 lat temu
rodzic
commit
1b2a300f50
2 zmienionych plików z 7 dodań i 0 usunięć
  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)