aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Yang <paulyang1211@gmail.com>2018-03-15 13:41:40 -0700
committerBo Yang <paulyang1211@gmail.com>2018-03-15 16:07:57 -0700
commitdd6b670203f337bac51588370395f59c6a32df28 (patch)
tree0929393ef00fe166c63a33b55cdf3495d48cc62b
parentb3fb0079d688a16af207ea6d256ae29454a4b65a (diff)
downloadprotobuf-dd6b670203f337bac51588370395f59c6a32df28.tar.gz
protobuf-dd6b670203f337bac51588370395f59c6a32df28.tar.bz2
protobuf-dd6b670203f337bac51588370395f59c6a32df28.zip
Use msvc to compile py2.7 and py3.4 to avoid incompatibility.
-rw-r--r--appveyor.bat20
-rw-r--r--appveyor.yml45
2 files changed, 27 insertions, 38 deletions
diff --git a/appveyor.bat b/appveyor.bat
index f7da865f..dea7ef42 100644
--- a/appveyor.bat
+++ b/appveyor.bat
@@ -10,21 +10,6 @@ REM ======================
mkdir src\.libs
-IF %PYTHON_VERSION%==2.7 GOTO build_core_mingw
-IF %PYTHON_VERSION%==3.4 GOTO build_core_mingw
-IF %PYTHON_VERSION%==3.5 GOTO build_core_msvc
-IF %PYTHON_VERSION%==3.6 GOTO build_core_msvc
-
-:build_core_mingw
-pushd src\.libs
-cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -DZLIB_ROOT=%ZLIB_ROOT% -Dprotobuf_BUILD_TESTS=OFF -D"CMAKE_MAKE_PROGRAM:PATH=%MINGW%/mingw32-make.exe" ../../cmake
-mingw32-make
-dir
-SET PATH=%cd%;%PATH%
-popd
-GOTO build_core_end
-
-:build_core_msvc
mkdir vcprojects
pushd vcprojects
cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -Dprotobuf_BUILD_TESTS=OFF ../cmake
@@ -35,9 +20,6 @@ copy vcprojects\Release\libprotobuf.lib src\.libs\libprotobuf.a
copy vcprojects\Release\libprotobuf-lite.lib src\.libs\libprotobuf-lite.a
SET PATH=%cd%\vcprojects\Release;%PATH%
dir vcprojects\Release
-GOTO build_core_end
-
-:build_core_end
REM ======================
REM Build python library
@@ -58,6 +40,8 @@ REM sed -i '/Wno-sign-compare/a \ \ \ \ extra_compile_args.append(\'-DMS_WIN64\'
REM sed -i 's/\'-DPYTHON_PROTO2_CPP_IMPL_V2\'/\'-DPYTHON_PROTO2_CPP_IMPL_V2\',\'-DMS_WIN64\'/g' setup.py
REM :no_win64_change
+sed -i 's/\ extra_compile_args\ =\ \[\]/\ extra_compile_args\ =\ \[\'\/MT\'\]/g' setup.py
+
REM REM MSVS default is dymanic
REM IF NOT DEFINED vcplatform GOTO msvc_static_build_end
REM sed -i '/Wno-sign-compare/a \ \ \ \ extra_compile_args.append(\'/MT\')' setup.py
diff --git a/appveyor.yml b/appveyor.yml
index 9c185e80..4cbec489 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -8,8 +8,6 @@ environment:
PACKAGE_NAME: protobuf
BUILD_COMMIT: v3.5.2
BUILD_VERSION: 3.5.2
- MINGW_32: C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin
- MINGW_64: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin
BUILD_DLL: OFF
UNICODE: ON
PB_TEST_DEP: "six==1.9"
@@ -63,9 +61,19 @@ install:
- python -m pip install -U pip
- pip install wheel
- # # Fix MSVC builds for 64-bit Python. See:
- # # http://stackoverflow.com/questions/32091593/cannot-install-windows-sdk-7-1-on-windows-10
- # - echo "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64/vcvars64.bat"
+ # Fix MSVC builds for 64-bit Python. See:
+ # http://stackoverflow.com/questions/32091593/cannot-install-windows-sdk-7-1-on-windows-10
+ - echo "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64/vcvars64.bat"
+
+ # Fix MSVC builds for 64-bit Python2.7. See:
+ # https://help.appveyor.com/discussions/kb/38-visual-studio-2008-64-bit-builds
+ - curl -L -o vs2008_patch.zip https://github.com/menpo/condaci/raw/master/vs2008_patch.zip
+ - 7z x vs2008_patch.zip -ovs2008_patch
+ - cd vs2008_patch
+ - CALL setup_x64.bat
+ - dir "C:\Program Files (x86)\"
+ - copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat"
+ - cd ..
# Check that we have the expected version and architecture for Python
- python --version
@@ -82,6 +90,18 @@ install:
- del /Q zlib-src.zip
before_build:
+ - if %PYTHON%==C:\Python27 set generator=Visual Studio 9 2008
+ - if %PYTHON%==C:\Python27 set vcplatform=Win32
+
+ - if %PYTHON%==C:\Python27-x64 set generator=Visual Studio 9 2008 Win64
+ - if %PYTHON%==C:\Python27-x64 set vcplatform=x64
+
+ - if %PYTHON%==C:\Python34 set generator=Visual Studio 10 2010
+ - if %PYTHON%==C:\Python34 set vcplatform=Win32
+
+ - if %PYTHON%==C:\Python34-x64 set generator=Visual Studio 10 2010 Win64
+ - if %PYTHON%==C:\Python34-x64 set vcplatform=x64
+
- if %PYTHON%==C:\Python35 set generator=Visual Studio 14
- if %PYTHON%==C:\Python35 set vcplatform=Win32
@@ -94,21 +114,6 @@ before_build:
- if %PYTHON%==C:\Python36-x64 set generator=Visual Studio 14 Win64
- if %PYTHON%==C:\Python36-x64 set vcplatform=x64
- - if %PYTHON%==C:\Python27 set MINGW=%MINGW_32%
- - if %PYTHON%==C:\Python27-x64 set MINGW=%MINGW_64%
- - if %PYTHON%==C:\Python34 set MINGW=%MINGW_32%
- - if %PYTHON%==C:\Python34-x64 set MINGW=%MINGW_64%
-
- - if %PYTHON_VERSION%==2.7 set generator=MSYS Makefiles
- - if %PYTHON_VERSION%==2.7 set PATH=%MINGW%;%PATH%
- - if %PYTHON_VERSION%==2.7 echo [build] > %PYTHON%\Lib\distutils\distutils.cfg
- - if %PYTHON_VERSION%==2.7 echo.compiler = mingw32 >> %PYTHON%\Lib\distutils\distutils.cfg
-
- - if %PYTHON_VERSION%==3.4 set generator=MSYS Makefiles
- - if %PYTHON_VERSION%==3.4 set PATH=%MINGW%;%PATH%
- - if %PYTHON_VERSION%==3.4 echo [build] > %PYTHON%\Lib\distutils\distutils.cfg
- - if %PYTHON_VERSION%==3.4 echo.compiler = mingw32 >> %PYTHON%\Lib\distutils\distutils.cfg
-
build_script:
- CALL appveyor.bat