Skip to content

Commit

Permalink
Include external dependencies as system to allow stricter warning checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nsubiron committed Apr 29, 2019
1 parent 424c32d commit 9e4925b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Examples/CppClient/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ build: $(BINDIR)/cpp_client
$(BINDIR)/cpp_client: build_libcarla
$(call log,Compiling C++ Client...)
@mkdir -p $(BINDIR)
@$(CXX) $(CXXFLAGS) -I$(INSTALLDIR)/include -L$(INSTALLDIR)/lib \
@$(CXX) $(CXXFLAGS) -I$(INSTALLDIR)/include -isystem $(INSTALLDIR)/include/system -L$(INSTALLDIR)/lib \
-o $(BINDIR)/cpp_client main.cpp \
-Wl,-Bstatic -lcarla_client -lrpc -lboost_filesystem -Wl,-Bdynamic \
-lpng -ltiff -ljpeg
Expand Down
13 changes: 7 additions & 6 deletions LibCarla/cmake/client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
cmake_minimum_required(VERSION 3.5.1)
project(libcarla-client)

# Install rpclib.
install(DIRECTORY "${RPCLIB_INCLUDE_PATH}/rpc" DESTINATION include)
# Install rpclib (install in system folder to avoid extra warnings).
install(DIRECTORY "${RPCLIB_INCLUDE_PATH}/rpc" DESTINATION include/system)
file(GLOB libcarla_carla_rpclib "${RPCLIB_LIB_PATH}/*.*")
install(FILES ${libcarla_carla_rpclib} DESTINATION lib)

# Install boost headers.
install(DIRECTORY "${BOOST_INCLUDE_PATH}/boost" DESTINATION include)
# Install boost headers (install in system folder to avoid extra warnings).
# @todo Remove boost from public interface of LibCarla.client.
install(DIRECTORY "${BOOST_INCLUDE_PATH}/boost" DESTINATION include/system)
file(GLOB boost_libraries "${BOOST_LIB_PATH}/*")
install(FILES ${boost_libraries} DESTINATION lib)

Expand Down Expand Up @@ -185,7 +186,7 @@ if (LIBCARLA_BUILD_RELEASE)

add_library(carla_client STATIC ${libcarla_sources})

target_include_directories(carla_client PRIVATE
target_include_directories(carla_client SYSTEM PRIVATE
"${BOOST_INCLUDE_PATH}"
"${RPCLIB_INCLUDE_PATH}")

Expand All @@ -206,7 +207,7 @@ if (LIBCARLA_BUILD_DEBUG)

add_library(carla_client_debug STATIC ${libcarla_sources})

target_include_directories(carla_client_debug PRIVATE
target_include_directories(carla_client_debug SYSTEM PRIVATE
"${BOOST_INCLUDE_PATH}"
"${RPCLIB_INCLUDE_PATH}")

Expand Down
4 changes: 2 additions & 2 deletions LibCarla/cmake/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ if (LIBCARLA_BUILD_RELEASE)

add_library(carla_server STATIC ${libcarla_server_sources})

target_include_directories(carla_server PRIVATE
target_include_directories(carla_server SYSTEM PRIVATE
"${BOOST_INCLUDE_PATH}"
"${RPCLIB_INCLUDE_PATH}")

Expand All @@ -144,7 +144,7 @@ if (LIBCARLA_BUILD_DEBUG)

add_library(carla_server_debug STATIC ${libcarla_server_sources})

target_include_directories(carla_server_debug PRIVATE
target_include_directories(carla_server_debug SYSTEM PRIVATE
"${BOOST_INCLUDE_PATH}"
"${RPCLIB_INCLUDE_PATH}")

Expand Down
6 changes: 4 additions & 2 deletions LibCarla/cmake/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ foreach(target ${build_targets})
-DLIBCARLA_ENABLE_PROFILER
-DLIBCARLA_WITH_GTEST)

target_include_directories(${target} PRIVATE
target_include_directories(${target} SYSTEM PRIVATE
"${BOOST_INCLUDE_PATH}"
"${RPCLIB_INCLUDE_PATH}"
"${GTEST_INCLUDE_PATH}"
"${GTEST_INCLUDE_PATH}")

target_include_directories(${target} PRIVATE
"${libcarla_source_path}/test")

if (WIN32)
Expand Down
3 changes: 2 additions & 1 deletion PythonAPI/carla/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def walk(folder, file_filter='*'):
os.path.join(pwd, 'dependencies/lib/libboost_filesystem.a'),
os.path.join(pwd, 'dependencies/lib', pylib)]
extra_compile_args = [
'-fPIC', '-std=c++14', '-Wno-missing-braces',
'-isystem', 'dependencies/include/system',
'-fPIC', '-std=c++14', '-Werror', '-Wall', '-Wextra',
'-DBOOST_ERROR_CODE_HEADER_ONLY', '-DLIBCARLA_WITH_PYTHON_SUPPORT'
]
if 'TRAVIS' in os.environ and os.environ['TRAVIS'] == 'true':
Expand Down
2 changes: 1 addition & 1 deletion Util/BuildTools/Setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ cp ${LIBSTDCPP_TOOLCHAIN_FILE}.gen ${LIBCPP_TOOLCHAIN_FILE}.gen
cat >>${LIBCPP_TOOLCHAIN_FILE}.gen <<EOL
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -stdlib=libc++" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -I${LLVM_INCLUDE}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -isystem ${LLVM_INCLUDE}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti" CACHE STRING "" FORCE)
set(CMAKE_CXX_LINK_FLAGS "\${CMAKE_CXX_LINK_FLAGS} -L${LLVM_LIBPATH}" CACHE STRING "" FORCE)
set(CMAKE_CXX_LINK_FLAGS "\${CMAKE_CXX_LINK_FLAGS} -lc++ -lc++abi" CACHE STRING "" FORCE)
Expand Down

0 comments on commit 9e4925b

Please sign in to comment.