Statically link CarlaServer

This commit is contained in:
nsubiron 2017-08-29 12:16:40 +02:00
parent 7352ca01b7
commit 124dd06d40
5 changed files with 16 additions and 17 deletions

View File

@ -50,7 +50,7 @@ export C_COMPILER=clang-3.9
export COMPILER=clang++-3.9
cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \
-LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF -DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=OFF \
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF -DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=OFF \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="../llvm-install" \
../llvm-source

View File

@ -86,23 +86,22 @@ public class Carla : ModuleRules
CarlaServerLib = "carlaserver";
}
ADelegate GetSharedLibName = (string BaseName) => {
ADelegate GetLibName = (string BaseName) => {
if (IsWindows(Target))
{
return BaseName + ".dll";
return BaseName + ".lib";
}
else
{
return "lib" + BaseName + ".so";
return "lib" + BaseName + ".a";
}
};
// Link dependencies.
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetSharedLibName("c++")));
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetSharedLibName("c++abi")));
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetSharedLibName("boost_system")));
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetSharedLibName("protobuf")));
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetSharedLibName(CarlaServerLib)));
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("c++abi")));
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("boost_system")));
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("protobuf")));
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName(CarlaServerLib)));
// Include path.
string CarlaServerIncludePath = Path.Combine(CarlaServerInstallPath, "include");

View File

@ -2,7 +2,7 @@
#pragma once
// #define CARLA_WITH_PROFILER
#define CARLA_WITH_PROFILER
#ifdef CARLA_WITH_PROFILER

View File

@ -98,7 +98,6 @@ namespace server {
if (future::wait_and_get(*message, message_value, timeout_t::milliseconds(1))) {
return _server.Write(message_value, timeout);
}
log_debug("is valid");
}
return errc::operation_aborted();
};

View File

@ -18,7 +18,7 @@ if (UNIX)
find_package(Threads)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-3.9)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14 -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wno-unused-parameter")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@ -33,7 +33,8 @@ if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
include_directories("${CARLA_LIBCXX_INSTALL_PATH}/include/c++/v1")
link_directories("${CARLA_LIBCXX_INSTALL_PATH}/lib")
file(GLOB LibCXX_Shared_Libraries "${CARLA_LIBCXX_INSTALL_PATH}/lib/libc++*.so*")
file(GLOB LibCXX_Static_Libraries "${CARLA_LIBCXX_INSTALL_PATH}/lib/libc++*.a")
file(GLOB LibCXX_Shared_Libraries "${CARLA_LIBCXX_INSTALL_PATH}/lib/libc++*.so")
# Setup boost.
include_directories("${CARLA_BOOST_INSTALL_PATH}/include")
@ -50,9 +51,9 @@ if (UNIX)
set(GTest_Static_Libraries "${CARLA_GOOGLETEST_INSTALL_PATH}/lib/libgtest.a")
install(FILES
${LibCXX_Shared_Libraries}
${Boost_Shared_Libraries}
${Protobuf_Shared_Libraries}
${LibCXX_Static_Libraries}
${Boost_Static_Libraries}
${Protobuf_Static_Libraries}
DESTINATION lib)
else (UNIX)
@ -79,7 +80,7 @@ file(GLOB carlaserver_SRC
"${CarlaServer_Path}/source/carla/server/*.pb.h"
"${CarlaServer_Path}/source/carla/server/*.pb.cc")
add_library(${CarlaServer_Lib_Target} SHARED ${carlaserver_SRC})
add_library(${CarlaServer_Lib_Target} STATIC ${carlaserver_SRC})
install(DIRECTORY "${CarlaServer_Path}/include/carla" DESTINATION include)
install(TARGETS ${CarlaServer_Lib_Target} DESTINATION lib)