Add build instructions for linux, fix some cmake issues

This commit is contained in:
root 2020-11-08 06:54:59 -05:00
parent 1ef6cf53a2
commit b8bd939bd7
2 changed files with 37 additions and 3 deletions

View File

@ -24,15 +24,14 @@ file(GLOB source_files "src/*.cpp" "src/*/*.cpp" "include/*.h" "include/*/*.h" "
add_executable(BeamMP-Server ${source_files})
target_include_directories(BeamMP-Server SYSTEM PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
find_package(Lua 5.3 REQUIRED)
target_include_directories(BeamMP-Server SYSTEM PUBLIC ${LUA_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
if (UNIX)
find_package(Lua 5.3 REQUIRED)
target_link_libraries(BeamMP-Server curl z pthread stdc++fs ${Boost_LINK_DIRS} ${LUA_LIBRARIES})
elseif (WIN32)
include(FindLua)
find_package(CURL CONFIG REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Lua REQUIRED)
target_link_libraries(BeamMP-Server PRIVATE urlmon ws2_32 CURL::libcurl ZLIB::ZLIB ${Boost_LINK_DIRS} ${LUA_LIBRARIES})
endif ()

View File

@ -1 +1,36 @@
# BeamNG-MP-Server
## Unix specific build instructions
1. You need boost >= 1.70.0
Check with your ditro's package manager whether it provides this. If it does, you should use that.
If it doesnt provide it or you want to link it statically (like we do with our releases), then you have to do this:
download the latest boost source code.
Then, go to the downloaded directory and run
```sh
b2 link=static runtime-link=static threading=multi
```
And then either symlink, edit CMakeLists to find it, or simply run
```sh
b2 link=static runtime-link=static threading=multi install
```
(warning: installs boost into your system, you might not want this).
Then on invocation of cmake, ensure that you define `Boost_USE_STATIC_RUNTIME=ON`.
2. Building
Run cmake, and then make.
Example:
```bash
~/src/Server $ cmake -S . -B bin -DCMAKE_BUILD_TYPE=Release
...
~/src/Server $ make -C bin -j 5
```