Skip to content

Commit

Permalink
Pass through CXX flags to OGRE vendor build (#381)
Browse files Browse the repository at this point in the history
* Pass through CXX flags

Signed-off-by: Emerson Knapp <[email protected]>

* fixup

Signed-off-by: William Woodall <[email protected]>

* re-add removed libc++ flag, because OSX build always needs it

Signed-off-by: Emerson Knapp <[email protected]>
  • Loading branch information
emersonknapp authored and nuclearsandwich committed Mar 22, 2019
1 parent b5227d7 commit 3344a8e
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions rviz_ogre_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@ endif()

macro(build_freetype)
set(extra_cmake_args)
set(FREETYPE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

if(WIN32)
list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=/w")
list(APPEND FREETYPE_CXX_FLAGS "/w")
list(APPEND extra_cmake_args "-DCMAKE_C_FLAGS=/w")
endif()

if(DEFINED CMAKE_TOOLCHAIN_FILE)
list(APPEND extra_cmake_args "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
else()
list(APPEND extra_cmake_args "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
list(APPEND extra_cmake_args "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
endif()
list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=${FREETYPE_CXX_FLAGS}")

include(ExternalProject)
ExternalProject_Add(freetype-2.8.1
Expand All @@ -55,15 +60,20 @@ endmacro()

macro(build_zlib)
set(extra_cmake_args)
set(ZLIB_CXX_FLAGS ${CMAKE_CXX_FLAGS})

if(WIN32)
list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=/w")
list(APPEND ZLIB_CXX_FLAGS "/w")
list(APPEND extra_cmake_args "-DCMAKE_C_FLAGS=/w")
endif()

if(DEFINED CMAKE_TOOLCHAIN_FILE)
list(APPEND extra_cmake_args "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
else()
list(APPEND extra_cmake_args "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
list(APPEND extra_cmake_args "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
endif()
list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=${ZLIB_CXX_FLAGS}")

include(ExternalProject)
ExternalProject_Add(zlib-1.2.11
Expand All @@ -88,22 +98,26 @@ endmacro()

macro(build_ogre)
set(extra_cmake_args)
set(OGRE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

if(DEFINED CMAKE_BUILD_TYPE)
list(APPEND extra_cmake_args -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()

if(WIN32)
list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=/w /EHsc")
list(APPEND OGRE_CXX_FLAGS "/w /EHsc")
list(APPEND extra_cmake_args "-DCMAKE_C_FLAGS=/w /EHsc")
elseif(APPLE)
list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=-std=c++14 -stdlib=libc++ -w")
list(APPEND OGRE_CXX_FLAGS "-std=c++14 -stdlib=libc++ -w")
list(APPEND extra_cmake_args "-DCMAKE_OSX_ARCHITECTURES='x86_64'")
else()
list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=-std=c++14 -w")
list(APPEND OGRE_CXX_FLAGS "-std=c++14 -w")
list(APPEND extra_cmake_args "-DCMAKE_C_FLAGS=-w")
endif()
list(APPEND extra_cmake_args "-DOGRE_BUILD_RENDERSYSTEM_GL:BOOL=TRUE")
list(APPEND extra_cmake_args "-DOGRE_BUILD_RENDERSYSTEM_D3D11:BOOL=OFF")
list(APPEND extra_cmake_args "-DOGRE_BUILD_RENDERSYSTEM_D3D9:BOOL=OFF")
list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=${OGRE_CXX_FLAGS}")

# Uncomment this line to enable the GL3PLUS render engine
# list(APPEND extra_cmake_args "-DOGRE_BUILD_RENDERSYSTEM_GL3PLUS:BOOL=TRUE")
Expand All @@ -130,6 +144,9 @@ macro(build_ogre)

if(DEFINED CMAKE_TOOLCHAIN_FILE)
list(APPEND extra_cmake_args "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
else()
list(APPEND extra_cmake_args "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
list(APPEND extra_cmake_args "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
endif()

include(ExternalProject)
Expand Down

0 comments on commit 3344a8e

Please sign in to comment.