Support for Visual Studio 2019 Community

This commit is contained in:
bubnikv 2019-06-06 11:40:35 +02:00
parent 7a5d3de1c4
commit c9a847a6a6
4 changed files with 30 additions and 6 deletions

View File

@ -16,6 +16,8 @@ my %prereqs = qw(
ExtUtils::MakeMaker 6.80 ExtUtils::MakeMaker 6.80
ExtUtils::ParseXS 3.22 ExtUtils::ParseXS 3.22
ExtUtils::XSpp 0 ExtUtils::XSpp 0
ExtUtils::XSpp::Cmd 0
ExtUtils::CppGuess 0
ExtUtils::Typemaps 0 ExtUtils::Typemaps 0
ExtUtils::Typemaps::Basic 0 ExtUtils::Typemaps::Basic 0
File::Basename 0 File::Basename 0

View File

@ -241,7 +241,9 @@ if(NOT WIN32)
endif() endif()
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS system filesystem thread log locale regex) find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS system filesystem thread log locale regex)
if(Boost_FOUND) if(Boost_FOUND)
# include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) # message("Boost include dir: ${Boost_INCLUDE_DIRS}")
# message("Boost library dirs: ${Boost_LIBRARY_DIRS}")
# message("Boost libraries: ${Boost_LIBRARIES}")
if (APPLE) if (APPLE)
# BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339 # BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339
add_definitions(-DBOOST_ASIO_DISABLE_KQUEUE) add_definitions(-DBOOST_ASIO_DISABLE_KQUEUE)

View File

@ -1,21 +1,34 @@
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
if (MSVC_VERSION EQUAL 1800) if (MSVC_VERSION EQUAL 1800)
# 1800 = VS 12.0 (v120 toolset)
set(DEP_VS_VER "12") set(DEP_VS_VER "12")
set(DEP_BOOST_TOOLSET "msvc-12.0") set(DEP_BOOST_TOOLSET "msvc-12.0")
elseif (MSVC_VERSION EQUAL 1900) elseif (MSVC_VERSION EQUAL 1900)
# 1900 = VS 14.0 (v140 toolset)
set(DEP_VS_VER "14") set(DEP_VS_VER "14")
set(DEP_BOOST_TOOLSET "msvc-14.0") set(DEP_BOOST_TOOLSET "msvc-14.0")
elseif (MSVC_VERSION GREATER 1900) elseif (MSVC_VERSION LESS 1920)
# 1910-1919 = VS 15.0 (v141 toolset)
set(DEP_VS_VER "15") set(DEP_VS_VER "15")
set(DEP_BOOST_TOOLSET "msvc-14.1") set(DEP_BOOST_TOOLSET "msvc-14.1")
elseif (MSVC_VERSION LESS 1930)
# 1920-1929 = VS 16.0 (v142 toolset)
set(DEP_VS_VER "16")
set(DEP_BOOST_TOOLSET "msvc-14.2")
else () else ()
message(FATAL_ERROR "Unsupported MSVC version") message(FATAL_ERROR "Unsupported MSVC version")
endif () endif ()
if (${DEPS_BITS} EQUAL 32) if (${DEPS_BITS} EQUAL 32)
set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER}") set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER}")
set(DEP_PLATFORM "Win32")
else () else ()
set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER} Win64") if (DEP_VS_VER LESS 16)
set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER} Win64")
else ()
set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER}")
endif ()
set(DEP_PLATFORM "x64")
endif () endif ()
@ -28,8 +41,8 @@ endif ()
ExternalProject_Add(dep_boost ExternalProject_Add(dep_boost
EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_ALL 1
URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz" URL "https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.tar.gz"
URL_HASH SHA256=bd0df411efd9a585e5a2212275f8762079fed8842264954675a4fddc46cfcf60 URL_HASH SHA256=882b48708d211a5f48e60b0124cf5863c1534cd544ecd0664bb534a4b5d506e9
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
CONFIGURE_COMMAND bootstrap.bat CONFIGURE_COMMAND bootstrap.bat
BUILD_COMMAND b2.exe BUILD_COMMAND b2.exe
@ -57,6 +70,7 @@ ExternalProject_Add(dep_tbb
URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz" URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz"
URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR "${DEP_MSVC_GEN}"
CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}"
CMAKE_ARGS CMAKE_ARGS
-DCMAKE_DEBUG_POSTFIX=_debug -DCMAKE_DEBUG_POSTFIX=_debug
-DTBB_BUILD_SHARED=OFF -DTBB_BUILD_SHARED=OFF
@ -81,6 +95,7 @@ ExternalProject_Add(dep_gtest
URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz" URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz"
URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR "${DEP_MSVC_GEN}"
CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}"
CMAKE_ARGS CMAKE_ARGS
-DBUILD_GMOCK=OFF -DBUILD_GMOCK=OFF
-Dgtest_force_shared_crt=ON -Dgtest_force_shared_crt=ON
@ -105,6 +120,7 @@ ExternalProject_Add(dep_nlopt
URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz" URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"
URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR "${DEP_MSVC_GEN}"
CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}"
CMAKE_ARGS CMAKE_ARGS
-DBUILD_SHARED_LIBS=OFF -DBUILD_SHARED_LIBS=OFF
-DNLOPT_PYTHON=OFF -DNLOPT_PYTHON=OFF
@ -133,6 +149,7 @@ ExternalProject_Add(dep_zlib
URL "https://zlib.net/zlib-1.2.11.tar.xz" URL "https://zlib.net/zlib-1.2.11.tar.xz"
URL_HASH SHA256=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066 URL_HASH SHA256=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR "${DEP_MSVC_GEN}"
CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}"
CMAKE_ARGS CMAKE_ARGS
-DSKIP_INSTALL_FILES=ON # Prevent installation of man pages et al. -DSKIP_INSTALL_FILES=ON # Prevent installation of man pages et al.
"-DINSTALL_BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}\\fallout" # I found no better way of preventing zlib from creating & installing DLLs :-/ "-DINSTALL_BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}\\fallout" # I found no better way of preventing zlib from creating & installing DLLs :-/

View File

@ -69,7 +69,10 @@ extern "C" {
#undef fwrite #undef fwrite
#undef fclose #undef fclose
#undef sleep #undef sleep
#undef snprintf
#undef strerror
#undef test #undef test
#undef times
#undef accept #undef accept
#undef wait #undef wait