Skip to content

Commit

Permalink
Added auto installer script for uWebSockets on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
HTuennermann committed Mar 23, 2017
1 parent 3e60678 commit a0f467e
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Expand Up @@ -2,14 +2,25 @@ project(PID)

cmake_minimum_required (VERSION 3.5)

add_definitions(-std=c++1y)
add_definitions(-std=c++11)

set(CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}")

set(sources src/PID.cpp src/main.cpp)


if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

include_directories(/usr/local/include)
include_directories(/usr/local/opt/openssl/include)
link_directories(/usr/local/lib)
link_directories(/usr/local/opt/openssl/lib)
link_directories(/usr/local/Cellar/libuv/1.11.0/lib)

endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")


add_executable(pid ${sources})

target_link_libraries(pid z ssl uv uWS)
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -17,6 +17,7 @@ Self-Driving Car Engineer Nanodegree Program
* Windows: recommend using [MinGW](http://www.mingw.org/)
* [uWebSockets](https://github.com/uWebSockets/uWebSockets) == 0.13
* Follow the instructions in the [uWebSockets README](https://github.com/uWebSockets/uWebSockets/blob/master/README.md) to get setup for your platform. You can download the zip of the appropriate version from the [releases page](https://github.com/uWebSockets/uWebSockets/releases).
* If you run OSX and have homebrew installed you can just run the ./install-mac.sh script to install this
* Simulator. You can download these from the [project intro page](https://classroom.udacity.com/nanodegrees/nd013/parts/40f38239-66b6-46ec-ae68-03afd8a601c8/modules/aca605f8-8219-465d-9c5d-ca72c699561d/lessons/e8235395-22dd-4b87-88e0-d108c5e5bbf4/concepts/6a4d8d42-6a04-4aa6-b284-1697c0fd6562) in the classroom.

## Basic Build Instructions
Expand Down
21 changes: 21 additions & 0 deletions cmakepatch.txt
@@ -0,0 +1,21 @@
--- CMakeLists.txt 2017-03-23 20:58:47.000000000 +0900
+++ CMakeListsnew.txt 2017-03-23 20:57:33.000000000 +0900
@@ -32,10 +32,16 @@
target_link_libraries (uWS LINK_PUBLIC ${OPENSSL_CRYPTO_LIBRARY})
target_link_libraries (uWS LINK_PUBLIC ${ZLIB_LIBRARY})

-if (UNIX)
+if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries (uWS LINK_PUBLIC pthread)
install (TARGETS uWS DESTINATION /usr/lib64)
install (FILES src/Extensions.h src/WebSocketProtocol.h src/Networking.h src/WebSocket.h src/Hub.h src/Group.h src/Node.h src/Socket.h src/HTTPSocket.h src/uWS.h src/uUV.h DESTINATION /usr/include/uWS)
-endif (UNIX)
+endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+target_link_libraries (uWS LINK_PUBLIC pthread)
+install (TARGETS uWS DESTINATION /usr/local/lib)
+install (FILES src/Extensions.h src/WebSocketProtocol.h src/Networking.h src/WebSocket.h src/Hub.h src/Group.h src/Node.h src/Socket.h src/HTTPSocket.h src/uWS.h src/uUV.h DESTINATION /usr/local/include/uWS)
+endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

add_subdirectory(examples)
14 changes: 14 additions & 0 deletions install-mac.sh
@@ -0,0 +1,14 @@
brew install openssh libuv cmake
git clone https://github.com/uWebSockets/uWebSockets
cd uWebSockets
git checkout e94b6e1
patch CMakeLists.txt < ../cmakepatch.txt
mkdir build
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
cd build
cmake ..
make
sudo make install
cd ..
cd ..
sudo rm -r uWebSockets
13 changes: 13 additions & 0 deletions install-ubuntu.sh
@@ -0,0 +1,13 @@
sudo apt-get install libuv1-dev
git clone https://github.com/uWebSockets/uWebSockets
cd uWebSockets
git checkout e94b6e1
mkdir build
cd build
cmake ..
make
sudo make install
cd ..
cd ..
sudo ln -s /usr/lib64/libuWS.so /usr/lib/libuWS.so
sudo rm -r uWebSockets

0 comments on commit a0f467e

Please sign in to comment.