Merge pull request #1076 from alex85k/patch-mingw
Add Mingw support (tune libraries and disable cpuid with #ifdef)
This commit is contained in:
		
						commit
						313a7ed7fa
					
				| @ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| 
 | ||||
| #include <iostream> | ||||
| 
 | ||||
| #if defined(__x86_64__) | ||||
| #if defined(__x86_64__) && !defined(__MINGW64__) | ||||
| #include <cpuid.h> | ||||
| #else | ||||
| #include <boost/crc.hpp> // for boost::crc_32_type | ||||
|  | ||||
| @ -114,6 +114,12 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | ||||
| elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||
|   # using GCC | ||||
|   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -fPIC") | ||||
|   if (WIN32) # using mingw | ||||
|     add_definitions(-DM_PI=3.141592653589793238462643383) # define M_PI | ||||
|     add_definitions(-DWIN32) | ||||
|     SET(OPTIONAL_SOCKET_LIBS ws2_32 wsock32) | ||||
|     SET(OPTIONAL_OMP_LIB gomp) | ||||
|   endif() | ||||
| elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") | ||||
|   # using Intel C++ | ||||
|   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC") | ||||
| @ -174,11 +180,11 @@ include_directories(${Boost_INCLUDE_DIRS}) | ||||
| target_link_libraries(OSRM ${Boost_LIBRARIES} COORDLIB) | ||||
| target_link_libraries(osrm-extract ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB IMPORT) | ||||
| target_link_libraries(osrm-prepare ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB IMPORT) | ||||
| target_link_libraries(osrm-routed ${Boost_LIBRARIES} OSRM FINGERPRINT GITDESCRIPTION) | ||||
| target_link_libraries(osrm-routed ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} OSRM FINGERPRINT GITDESCRIPTION) | ||||
| target_link_libraries(osrm-datastore ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB) | ||||
| 
 | ||||
| find_package(Threads REQUIRED) | ||||
| target_link_libraries(osrm-extract ${CMAKE_THREAD_LIBS_INIT}) | ||||
| target_link_libraries(osrm-extract ${CMAKE_THREAD_LIBS_INIT} ${OPTIONAL_OMP_LIB}) | ||||
| target_link_libraries(osrm-datastore ${CMAKE_THREAD_LIBS_INIT}) | ||||
| target_link_libraries(OSRM ${CMAKE_THREAD_LIBS_INIT}) | ||||
| 
 | ||||
| @ -204,6 +210,11 @@ else() | ||||
|   endif() | ||||
| endif() | ||||
| 
 | ||||
| find_package( Luabind REQUIRED ) | ||||
| include_directories(${LUABIND_INCLUDE_DIR}) | ||||
| target_link_libraries(osrm-extract ${LUABIND_LIBRARY}) | ||||
| target_link_libraries(osrm-prepare ${LUABIND_LIBRARY}) | ||||
| 
 | ||||
| if( LUAJIT_FOUND ) | ||||
|   target_link_libraries(osrm-extract ${LUAJIT_LIBRARIES}) | ||||
|   target_link_libraries(osrm-prepare ${LUAJIT_LIBRARIES}) | ||||
| @ -217,11 +228,6 @@ find_package(LibXml2 REQUIRED) | ||||
| include_directories(${LIBXML2_INCLUDE_DIR}) | ||||
| target_link_libraries(osrm-extract ${LIBXML2_LIBRARIES}) | ||||
| 
 | ||||
| find_package( Luabind REQUIRED ) | ||||
| include_directories(${LUABIND_INCLUDE_DIR}) | ||||
| target_link_libraries(osrm-extract ${LUABIND_LIBRARY}) | ||||
| target_link_libraries(osrm-prepare ${LUABIND_LIBRARY}) | ||||
| 
 | ||||
| find_package( STXXL REQUIRED ) | ||||
| include_directories(${STXXL_INCLUDE_DIR}) | ||||
| target_link_libraries(OSRM ${STXXL_LIBRARY}) | ||||
| @ -259,7 +265,7 @@ if(WITH_TOOLS) | ||||
|       ${GDAL_LIBRARIES} ${Boost_LIBRARIES} FINGERPRINT GITDESCRIPTION COORDLIB) | ||||
|   endif() | ||||
|   add_executable(osrm-cli Tools/simpleclient.cpp) | ||||
|   target_link_libraries(osrm-cli ${Boost_LIBRARIES} OSRM FINGERPRINT GITDESCRIPTION) | ||||
|   target_link_libraries(osrm-cli ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} OSRM FINGERPRINT GITDESCRIPTION) | ||||
|   target_link_libraries(osrm-cli ${TBB_LIBRARIES}) | ||||
|   add_executable(osrm-io-benchmark Tools/io-benchmark.cpp) | ||||
|   target_link_libraries(osrm-io-benchmark ${Boost_LIBRARIES} GITDESCRIPTION) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user