[osrm] 05/13: Add patch to fix build

Christopher Baines cbaines-guest at moszumanska.debian.org
Sat Apr 4 16:04:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

cbaines-guest pushed a commit to branch master
in repository osrm.

commit 166a1a240e56679286d414d20b0d7245cee24b9a
Author: Christopher Baines <mail at cbaines.net>
Date:   Sat Apr 4 15:50:32 2015 +0100

    Add patch to fix build
---
 CMakeLists.txt           |  5 +++-
 cmake/check_stxxl.cmake  | 24 ++++++++++++++++++
 debian/patches/fix-build | 65 ++++++++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series    |  1 +
 4 files changed, 94 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6a40f9..7c5b638 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,7 +172,7 @@ endif()
 
 # Activate C++11
 if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
-  ADD_DEFINITIONS(-std=c++11)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
 endif()
 
 # Configuring other platform dependencies
@@ -261,6 +261,9 @@ target_link_libraries(OSRM ${STXXL_LIBRARY})
 target_link_libraries(osrm-extract ${STXXL_LIBRARY})
 target_link_libraries(osrm-prepare ${STXXL_LIBRARY})
 
+# check if we need to link against libgomp
+include(check_stxxl)
+
 if(MINGW)
   # STXXL needs OpenMP library
   target_link_libraries(osrm-extract gomp)
diff --git a/cmake/check_stxxl.cmake b/cmake/check_stxxl.cmake
new file mode 100644
index 0000000..7f399f0
--- /dev/null
+++ b/cmake/check_stxxl.cmake
@@ -0,0 +1,24 @@
+INCLUDE (CheckCXXSourceCompiles)
+unset(STXXL_WORKS CACHE)
+set (STXXL_CHECK_SRC "#include <stxxl/vector>\n int main() { stxxl::vector<int> vec; return 0;}")
+set (CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
+set (CMAKE_REQUIRED_INCLUDES "${STXXL_INCLUDE_DIR}")
+set (CMAKE_REQUIRED_LIBRARIES "${STXXL_LIBRARY}")
+
+CHECK_CXX_SOURCE_COMPILES("${STXXL_CHECK_SRC}" STXXL_WORKS)
+
+if(STXXL_WORKS)
+  message(STATUS "STXXL can be used without linking against libgomp")
+else()
+  message(STATUS "Linking STXXL failed without libgomp, retrying ..")
+  find_package(OpenMP)
+  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${OpenMP_CXX_FLAGS}")
+  CHECK_CXX_SOURCE_COMPILES("${STXXL_CHECK_SRC}" STXXL_LINKS)
+
+  if (STXXL_LINKS)
+    message(STATUS "STXXL needs to link against OpenMP")
+    target_link_libraries(osrm-extract gomp)
+  else()
+    message(FATAL_ERROR "STXXL failed failed, libgomp missing?")
+  endif()
+endif()
diff --git a/debian/patches/fix-build b/debian/patches/fix-build
new file mode 100644
index 0000000..5d82773
--- /dev/null
+++ b/debian/patches/fix-build
@@ -0,0 +1,65 @@
+Description: fix build issue
+ This patch backports two commits [1] to make OSRM build. The problem is
+ described in this issue [2].
+ .
+ 1: 6a8fbcef5c693aca7421bba3625d13f43e887c95
+    137975c7f330291b4d728d5ef7f049d36d571ed1
+ 2: https://github.com/Project-OSRM/osrm-backend/issues/1361
+ .
+ osrm (4.5.0-1) UNRELEASED; urgency=medium
+ .
+   [ Andreas Tille ]
+   * Initial release (Closes: #701506)
+ .
+   [ Christopher Baines ]
+   * New upstream release.
+Author: Christopher Baines <mail at cbaines.net>
+
+--- osrm-4.5.0.orig/CMakeLists.txt
++++ osrm-4.5.0/CMakeLists.txt
+@@ -172,7 +172,7 @@ endif()
+ 
+ # Activate C++11
+ if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
+-  ADD_DEFINITIONS(-std=c++11)
++  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
+ endif()
+ 
+ # Configuring other platform dependencies
+@@ -261,6 +261,9 @@ target_link_libraries(OSRM ${STXXL_LIBRA
+ target_link_libraries(osrm-extract ${STXXL_LIBRARY})
+ target_link_libraries(osrm-prepare ${STXXL_LIBRARY})
+ 
++# check if we need to link against libgomp
++include(check_stxxl)
++
+ if(MINGW)
+   # STXXL needs OpenMP library
+   target_link_libraries(osrm-extract gomp)
+--- /dev/null
++++ osrm-4.5.0/cmake/check_stxxl.cmake
+@@ -0,0 +1,24 @@
++INCLUDE (CheckCXXSourceCompiles)
++unset(STXXL_WORKS CACHE)
++set (STXXL_CHECK_SRC "#include <stxxl/vector>\n int main() { stxxl::vector<int> vec; return 0;}")
++set (CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
++set (CMAKE_REQUIRED_INCLUDES "${STXXL_INCLUDE_DIR}")
++set (CMAKE_REQUIRED_LIBRARIES "${STXXL_LIBRARY}")
++
++CHECK_CXX_SOURCE_COMPILES("${STXXL_CHECK_SRC}" STXXL_WORKS)
++
++if(STXXL_WORKS)
++  message(STATUS "STXXL can be used without linking against libgomp")
++else()
++  message(STATUS "Linking STXXL failed without libgomp, retrying ..")
++  find_package(OpenMP)
++  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${OpenMP_CXX_FLAGS}")
++  CHECK_CXX_SOURCE_COMPILES("${STXXL_CHECK_SRC}" STXXL_LINKS)
++
++  if (STXXL_LINKS)
++    message(STATUS "STXXL needs to link against OpenMP")
++    target_link_libraries(osrm-extract gomp)
++  else()
++    message(FATAL_ERROR "STXXL failed failed, libgomp missing?")
++  endif()
++endif()
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..7bb87fc
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+fix-build

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osrm.git



More information about the Pkg-grass-devel mailing list