From f692103c818ee562bedda2958cf56f6c2e80ecc8 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Thu, 28 Aug 2014 12:47:57 +0200 Subject: [PATCH] fix build on windows by linking against the right libs --- CMakeLists.txt | 3 +++ appveyor.yml | 2 +- typedefs.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b38347a7f..feea68e66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,6 +156,9 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_definitions(-DNOMINMAX) # avoid min and max macros that can break compilation add_definitions(-D_USE_MATH_DEFINES) # define M_PI add_definitions(-D_WIN32_WINNT=0x0501) + add_definitions(-DXML_STATIC) + find_library(ws2_32_LIBRARY_PATH ws2_32) + target_link_libraries(osrm-extract wsock32 ws2_32) endif() # Activate C++11 diff --git a/appveyor.yml b/appveyor.yml index 319c5c218..e86068ff2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -38,7 +38,7 @@ build_script: - SET P=c:/projects/osrm - set TBB_INSTALL_DIR=%P%/tbb - set TBB_ARCH_PLATFORM=intel64/vc12 - - cmake .. -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=%Configuration% -DEXPAT_INCLUDE_DIR=%P%/libs/include -DEXPAT_LIBRARY=%P%/libs/lib -DBZIP2_INCLUDE_DIR=%P%/libs/include -DBZIP2_LIBRARIES=%P%/libs/lib/libbz2.lib -DCMAKE_INSTALL_PREFIX=%P%/libs -DBOOST_ROOT=%P%/boost_min -DBoost_USE_STATIC_LIBS=ON -T CTP_Nov2013 + - cmake .. -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=%Configuration% -DXML_STATIC -DEXPAT_INCLUDE_DIR=%P%/libs/include -DEXPAT_LIBRARY=%P%/libs/lib/libexpat.lib -DBZIP2_INCLUDE_DIR=%P%/libs/include -DBZIP2_LIBRARIES=%P%/libs/lib/libbz2.lib -DCMAKE_INSTALL_PREFIX=%P%/libs -DBOOST_ROOT=%P%/boost_min -DBoost_USE_STATIC_LIBS=ON -T CTP_Nov2013 - msbuild /clp:Verbosity=minimal /nologo OSRM.sln - msbuild /clp:Verbosity=minimal /nologo tests.vcxproj - cd %Configuration% diff --git a/typedefs.h b/typedefs.h index e45a6e8c9..d1b0a53a8 100644 --- a/typedefs.h +++ b/typedefs.h @@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Necessary workaround for Windows as VS doesn't implement C99 #ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN #ifndef M_PI #define M_PI 3.14159265358979323846 #endif