-
Notifications
You must be signed in to change notification settings - Fork 146
Building from source
This page will explain how to build the project from source on either Win10 or OS X. If all you want to do is run the service without modifications, you might instead consider downloading pre-built binaries from the Release page.
Don't download the source from the green "Clone or download" button! The zip provided only contains the source from the /src
folder and not the submodules in /thirdparty
. This is a known issue with GitHub (we don't provide the zip file that this button generates). If you don't have a github client installed, get it from: https://desktop.github.com/
git clone --recursive https://github.com/cboulay/PSMoveService.git
cd PSMoveService
Before you get started, think about whether you want to build for 32-bit or 64-bit architecture. SteamVR is 64-bit by default, so if you plan to use the openvr plugin then at least PSMoveClient should be 64-bit. The non-free closed-source CL Eye drivers only work on 32-bit; if you plan to use that then you should build PSMoveService for 32-bit. The below instructions are for 64-bit in MSVC 2015 but can be adapted to 32-bit and other versions of Visual Studio at the appropriate steps. For the majority of steps, the only difference is in choosing the correct CMake generator.
-
CMake
- 3.6.1 works as of this writing.
- Compiler - Visual Studio 2015
- Boost
- From here, get boost_1_61_0-msvc-14.0-64.exe.
- Also get boost_1_61_0-msvc-14.0-32.exe if you plan to make 32-bit builds.
- Install to default
C:\local
(i.e., resulting inC:\local\boost_1_61_0\
) - This path will be referred to BOOST_ROOT later
- Optional: CL Eye Driver or CL Eye SDK
- Please see the table here PSEye-Software-Setup-(Windows)#overview to determine if you need these non-free closed-source drivers.
- Run the InitialSetup_X64.bat Batch Script
- This script will automatically configure and build the dependencies in the thirdparty folder.
- It will ask you for the root install folder of Boost 1.61.
- If you want to do a 32-bit build, run the 32-bit version of the InitialSetup.
- NOTE: This will clear out all previously built intermediates in the /build and /deps folder
- If you would rather do initial setup by hand, then proceed to the next step
- After the initial setup phase, if you add source files or other CMake changes you can run
GenerateProjectFiles_X64.bat
to regenerate the PSMoveService solution.
- protobuf
- cd to thirdparty\protobuf
- mkdir vsprojects & cd vsprojects
- cmake -G "Visual Studio 14 2015 Win64" -Dprotobuf_DEBUG_POSTFIX="" -Dprotobuf_BUILD_TESTS=OFF ../cmake
- Drop the Win64 from the generator argument if building for 32-bit
- Open PSMoveService\thirdparty\protobuf\vsprojects\protobuf.sln
- Select Release|x64 and Build > Rebuild Solution
- Select Debug|x64 and Build > Rebuild Solution
- For 64-bit PSMoveService:
copy Debug\*.* x64\Debug
copy Release\*.* x64\Release
- libusb
- Only necessary for PS3EYEDriver (Required in Mac and in Windows if using 64-bit PSMoveService)
- Open PSMoveService\thirdparty\libusb\msvc\libusb_2015.sln
- For each combination of Release/Debug * Win32/x64, right-click on libusb-1.0 (static) and Build.
- Close this Visual Studio Solution.
- SDL2
- Optional - Only required if you are building the configuration client. Highly recommended.
cd third_party/SDL2
mkdir build & cd build
cmake .. -G "Visual Studio 14 2015 Win64" -DDIRECTX=OFF -DDIRECTX=OFF -DSDL_STATIC=ON -DFORCE_STATIC_VCRT=ON -DEXTRA_CFLAGS="-MT -Z7 -DSDL_MAIN_HANDLED -DWIN32 -DNDEBUG -D_CRT_SECURE_NO_WARNINGS -DHAVE_LIBC -D_USE_MATH_DEFINES
- Open the solution (PSMoveService\thirdparty\SDL2\build\SDL2.sln)
- For each Release/Debug target
- Build the SLD2-static and SDL2main projects (Not the SDL2 project)
- Create Visual Studio project files
cd ../../..
mkdir build && cd build
cmake -G "Visual Studio 14 2015 Win64" -DOpenCV_DIR="C:\OpenCV-3.1.0\build" -DBOOST_ROOT="C:\local\boost_1_61_0" -DBOOST_LIBRARYDIR="C:\local\boost_1_61_0\lib64-msvc-14.0" ..
- Open <path_to_repo>\build\PSMoveService.sln
- Change to "Release" configuration
- Rt-click on the OpenCV External project and build
- This will download OpenCV 3.1 into the /deps folder and compile it
- Rt-click on the PSMoveService solution and build (or do a "Build All..." from the build menu)
- Compiler
- Tested with XCode/clang. gcc may work.
- Homebrew
- I am opting for a system install of dependent libraries where possible, instead of project-specific.
- Install homebrew if you do not already have it.
brew update
- Eigen3
brew install eigen
- OpenCV
brew tap homebrew/science
brew install opencv3 --HEAD --without-test
- Boost
brew install boost
- protobuf
brew install protobuf
- libusb
- Currently I am using brew's libusb (
brew install libusb
), but previously I had to build myself (can't remember why); see below. cd thirdparty/libusb
./autogen.sh
./configure
-
./configure
(yes, a second time) make
- Currently I am using brew's libusb (
- Optional: SDL2
- Optional - Only required if you are building the the configuration tool.
brew install SDL2
mkdir build && cd build
cmake .. -G Xcode
- Launch Xcode
- Open <path_to_repo>\build\PSMoveService.xcodeproj
- Go to "Product" > "Build" or hit -B
Tested with Ubuntu 18.04 AMD64. Not quite ready.
- Build tools
sudo apt-get install build-essential cmake git checkinstall pkg-config autoconf automake libtool
- Third party libraries from apt-get
sudo apt-get install libopencv-dev libsdl2-dev libeigen3-dev libbluetooth-dev libhidapi-dev libusb-1.0
- Third party libraries that must be built locally because we need static libs compiled with -fPIC
- boost:
- cd to a folder with a lot of space
wget -O boost.tar.bz2 "https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"
tar xvfj boost.tar.bz2
cd boost_1_64_0
./bootstrap.sh CXXFLAGS=-fPIC
- TODO: Select only needed modules.
sudo ./b2 cxxflags=-fPIC link=static threading=multi -a install
- protobuf:
cd PSMoveService/thirdparty/protobuf
- Update protobuf:
git fetch && git pull origin master
(or something... sorry I don't remember the exact command) ./autogen.sh
./configure --enable-shared --with-pic
make -j $(($(nproc) + 1))
sudo make install
sudo ldconfig
- boost:
- `cd ~/PSMoveService
mkdir build && cd build
cmake ..
make .