Statically link CarlaServer
This commit is contained in:
parent
7352ca01b7
commit
124dd06d40
2
Setup.sh
2
Setup.sh
|
@ -50,7 +50,7 @@ export C_COMPILER=clang-3.9
|
||||||
export COMPILER=clang++-3.9
|
export COMPILER=clang++-3.9
|
||||||
|
|
||||||
cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \
|
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" \
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="../llvm-install" \
|
||||||
../llvm-source
|
../llvm-source
|
||||||
|
|
||||||
|
|
|
@ -86,23 +86,22 @@ public class Carla : ModuleRules
|
||||||
CarlaServerLib = "carlaserver";
|
CarlaServerLib = "carlaserver";
|
||||||
}
|
}
|
||||||
|
|
||||||
ADelegate GetSharedLibName = (string BaseName) => {
|
ADelegate GetLibName = (string BaseName) => {
|
||||||
if (IsWindows(Target))
|
if (IsWindows(Target))
|
||||||
{
|
{
|
||||||
return BaseName + ".dll";
|
return BaseName + ".lib";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "lib" + BaseName + ".so";
|
return "lib" + BaseName + ".a";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Link dependencies.
|
// Link dependencies.
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetSharedLibName("c++")));
|
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("c++abi")));
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetSharedLibName("c++abi")));
|
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("boost_system")));
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetSharedLibName("boost_system")));
|
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("protobuf")));
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetSharedLibName("protobuf")));
|
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName(CarlaServerLib)));
|
||||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetSharedLibName(CarlaServerLib)));
|
|
||||||
|
|
||||||
// Include path.
|
// Include path.
|
||||||
string CarlaServerIncludePath = Path.Combine(CarlaServerInstallPath, "include");
|
string CarlaServerIncludePath = Path.Combine(CarlaServerInstallPath, "include");
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// #define CARLA_WITH_PROFILER
|
#define CARLA_WITH_PROFILER
|
||||||
|
|
||||||
#ifdef CARLA_WITH_PROFILER
|
#ifdef CARLA_WITH_PROFILER
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,6 @@ namespace server {
|
||||||
if (future::wait_and_get(*message, message_value, timeout_t::milliseconds(1))) {
|
if (future::wait_and_get(*message, message_value, timeout_t::milliseconds(1))) {
|
||||||
return _server.Write(message_value, timeout);
|
return _server.Write(message_value, timeout);
|
||||||
}
|
}
|
||||||
log_debug("is valid");
|
|
||||||
}
|
}
|
||||||
return errc::operation_aborted();
|
return errc::operation_aborted();
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ if (UNIX)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
||||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++-3.9)
|
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_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wno-unused-parameter")
|
||||||
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
@ -33,7 +33,8 @@ if (UNIX)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
include_directories("${CARLA_LIBCXX_INSTALL_PATH}/include/c++/v1")
|
include_directories("${CARLA_LIBCXX_INSTALL_PATH}/include/c++/v1")
|
||||||
link_directories("${CARLA_LIBCXX_INSTALL_PATH}/lib")
|
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.
|
# Setup boost.
|
||||||
include_directories("${CARLA_BOOST_INSTALL_PATH}/include")
|
include_directories("${CARLA_BOOST_INSTALL_PATH}/include")
|
||||||
|
@ -50,9 +51,9 @@ if (UNIX)
|
||||||
set(GTest_Static_Libraries "${CARLA_GOOGLETEST_INSTALL_PATH}/lib/libgtest.a")
|
set(GTest_Static_Libraries "${CARLA_GOOGLETEST_INSTALL_PATH}/lib/libgtest.a")
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
${LibCXX_Shared_Libraries}
|
${LibCXX_Static_Libraries}
|
||||||
${Boost_Shared_Libraries}
|
${Boost_Static_Libraries}
|
||||||
${Protobuf_Shared_Libraries}
|
${Protobuf_Static_Libraries}
|
||||||
DESTINATION lib)
|
DESTINATION lib)
|
||||||
|
|
||||||
else (UNIX)
|
else (UNIX)
|
||||||
|
@ -79,7 +80,7 @@ file(GLOB carlaserver_SRC
|
||||||
"${CarlaServer_Path}/source/carla/server/*.pb.h"
|
"${CarlaServer_Path}/source/carla/server/*.pb.h"
|
||||||
"${CarlaServer_Path}/source/carla/server/*.pb.cc")
|
"${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(DIRECTORY "${CarlaServer_Path}/include/carla" DESTINATION include)
|
||||||
install(TARGETS ${CarlaServer_Lib_Target} DESTINATION lib)
|
install(TARGETS ${CarlaServer_Lib_Target} DESTINATION lib)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue