Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 32-bit Windows and consume Pthreads from NuGet #614

Merged
merged 39 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a6b7acd
Win32bit (#2)
lewk2 Mar 14, 2019
a68b007
-CMakeLists now uses glob to for pthread via nuget
lewk2 Mar 18, 2019
ceebc73
-move away from packages.config to script
lewk2 Mar 18, 2019
55a7475
-fix nuget install step
lewk2 Mar 18, 2019
dcc0b53
-remove packages.config
lewk2 Mar 18, 2019
fb2d133
-stupid appveyor variable fix
lewk2 Mar 18, 2019
ad23fa7
-libeay32.dll is now marked as delay load for win32 builds
lewk2 Mar 20, 2019
2cb7c77
-fix appveyor detection for build number version setting
lewk2 Mar 21, 2019
cd9775c
-fix hangover from local testing with appveyor build number
lewk2 Mar 21, 2019
201dc70
-trying out idea to get build and project files into subdir
lewk2 Mar 26, 2019
c938c3e
-use semicolon to separate build commands on one line in powershell
lewk2 Mar 26, 2019
fc1a916
Revert "-use semicolon to separate build commands on one line in powe…
lewk2 Mar 26, 2019
3e65632
Revert "-trying out idea to get build and project files into subdir"
lewk2 Mar 26, 2019
330d372
-dramatically reduced .gitignore to just block VS Code and Nuget loca…
lewk2 Mar 26, 2019
78b7ba0
-attempt to fix travis build
lewk2 Sep 3, 2019
b0c36c9
-merge v1.3.4 from upstream
lewk2 Sep 3, 2019
51808a4
Merge branch 'Win_Build_Option' into Branch_v1.3.2
lewk2 Sep 3, 2019
1239a0b
-attempt to use SRT_VERSION var for Appveyor
lewk2 Sep 3, 2019
27e1e1e
-fix env var read in appveyor
lewk2 Sep 3, 2019
3bf4673
-more guessing about appveyor var usage
lewk2 Sep 3, 2019
42e87c2
-move to use Update-AppveyorBuild PS command
lewk2 Sep 3, 2019
f3edeae
-changing order of build step application
lewk2 Sep 3, 2019
261dc82
-give up being clever with appveyor build for now
lewk2 Sep 3, 2019
af2d62a
-add support for VS2013 back
lewk2 Sep 3, 2019
dd6efe1
-update readme to reference pthread nuget usage
lewk2 Sep 3, 2019
ba0d617
-vs2013 is v12
lewk2 Sep 3, 2019
015a520
-merge latest changes from master
lewishub Sep 9, 2019
0423b24
-loosen GLOB for pthreads for 2013/2015 packages
lewishub Sep 9, 2019
757733e
-found and fixed variable typo
lewishub Sep 9, 2019
77a5dd7
Merge branch 'master' into Branch_v1.3.2
lewishub Oct 8, 2019
3717df1
-removed excessive msg about not finding appveyor
lewishub Oct 8, 2019
0c4939c
-remove 'rem'd' lines from gather-package
lewishub Oct 8, 2019
12e3f4c
-remove dedicated win32 MAF
lewishub Oct 8, 2019
31259b1
-remove changes to readme to back to master
lewishub Oct 8, 2019
a08f28d
-remove DLL metadata resources
lewishub Oct 8, 2019
fe035a5
-hanging } symbol in cmakelist
lewishub Oct 8, 2019
333caed
-hanging build version metadata trimmed
lewishub Oct 8, 2019
de74d32
-extra newline to filelist.maf at end
lewishub Oct 8, 2019
86c3b81
Revert version number from appveyor
lewk2 Oct 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
init:
# -ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# -ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

configuration:
- Release
- Debug
Expand All @@ -11,31 +11,34 @@ image:

platform:
- x64
- x86

build_script:
# build pthread
- git clone https://github.com/GerHobbelt/pthread-win32.git C:/pthread-src
- ps: "if ( $Env:APPVEYOR_BUILD_WORKER_IMAGE -eq 'Visual Studio 2013' ) { $VS_VERSION='2013' } else { $VS_VERSION='2015' }"
- ps: "msbuild C:/pthread-src/pthread.${VS_VERSION}.sln /p:Configuration=$Env:CONFIGURATION /p:Platform=x64"
- ps: mkdir C:/pthread-win32
- ps: mkdir C:/pthread-win32/include
- ps: mkdir C:/pthread-win32/lib
- ps: cp C:/pthread-src/*.h C:/pthread-win32/include
- ps: cp C:/pthread-src/bin/x64_MSVC${VS_VERSION}.${Env:CONFIGURATION}/pthread_lib.lib C:/pthread-win32/lib
# prep shared variables
- ps: if ( $Env:PLATFORM -eq 'x86' ) { $DEVENV_PLATFORM = 'Win32' } else { $DEVENV_PLATFORM = 'x64' }
- ps: if ( $Env:PLATFORM -eq 'x86' ) { $FOLDER_PLATFORM = 'win32' } else { $FOLDER_PLATFORM = 'win64' }
- ps: if ( $Env:APPVEYOR_BUILD_WORKER_IMAGE -eq 'Visual Studio 2013' ) { $VS_VERSION='2013' } else { $VS_VERSION='2015' }
lewk2 marked this conversation as resolved.
Show resolved Hide resolved
- ps: $env:VS_VERSION = $VS_VERSION
# get pthreads
- ps: nuget install cinegy.pthreads-$FOLDER_PLATFORM-$VS_VERSION -version 2.9.1.24
# build SRT
- ps: if ( $VS_VERSION -eq "2013" ) { $CMAKE_GENERATOR = "Visual Studio 12 2013 Win64" } else { $CMAKE_GENERATOR = "Visual Studio 14 2015 Win64" }
- ps: if ( $VS_VERSION -eq "2013" ) { $ENABLE_UNITTESTS = "OFF" } else { $ENABLE_UNITTESTS = "ON" }
- ps: if ( $VS_VERSION -eq '2013' -and $Env:PLATFORM -eq 'x86' ) { $CMAKE_GENERATOR = 'Visual Studio 12 2013' }
- ps: if ( $VS_VERSION -eq '2013' -and $Env:PLATFORM -eq 'x64' ) { $CMAKE_GENERATOR = 'Visual Studio 12 2013 Win64' }
- ps: if ( $VS_VERSION -eq '2015' -and $Env:PLATFORM -eq 'x86' ) { $CMAKE_GENERATOR = 'Visual Studio 14 2015' }
- ps: if ( $VS_VERSION -eq '2015' -and $Env:PLATFORM -eq 'x64' ) { $CMAKE_GENERATOR = 'Visual Studio 14 2015 Win64' }
- ps: if ( $VS_VERSION -eq '2015' ) { $ENABLE_UNITTESTS = 'ON' } else { $ENABLE_UNITTESTS = 'OFF' }
lewk2 marked this conversation as resolved.
Show resolved Hide resolved
- ps: cmake . -G"$CMAKE_GENERATOR" -DCMAKE_BUILD_TYPE=$Env:CONFIGURATION -DENABLE_UNITTESTS="$ENABLE_UNITTESTS"
- ps: msbuild SRT.sln /p:Configuration=$Env:CONFIGURATION /p:Platform=x64

- ps: Update-AppveyorBuild -Version "1.0.0-$Env:APPVEYOR_BUILD_NUMBER"
- ps: msbuild SRT.sln /p:Configuration=$Env:CONFIGURATION /p:Platform=$DEVENV_PLATFORM

test_script:
- ps: if ( $VS_VERSION -ne "2013" ) { ctest --extra-verbose -C $Env:CONFIGURATION }
- ps: if ( $VS_VERSION -eq '2015' ) { ctest --extra-verbose -C $Env:CONFIGURATION }

after_build:
- cmd: >-
scripts/gather-package.bat
7z a SRT-%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%-%APPVEYOR_BUILD_VERSION%.zip %APPVEYOR_BUILD_FOLDER%\package\*
appveyor PushArtifact SRT-%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%-%APPVEYOR_BUILD_VERSION%.zip
7z a SRT-%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%-Win%PLATFORM%-%VS_VERSION%-%APPVEYOR_BUILD_VERSION%.zip %APPVEYOR_BUILD_FOLDER%\package\*
appveyor PushArtifact SRT-%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%-Win%PLATFORM%-%VS_VERSION%-%APPVEYOR_BUILD_VERSION%.zip

on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
24 changes: 20 additions & 4 deletions CMakeLists.txt
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ set (haicrypt_libspec VIRTUAL)
set (srtpack_libspec_common)
if (srt_libspec_shared)
list(APPEND srtpack_libspec_common ${TARGET_srt}_shared)

endif()
if (srt_libspec_static)
list(APPEND srtpack_libspec_common ${TARGET_srt}_static)
Expand Down Expand Up @@ -463,15 +464,29 @@ elseif (WIN32 AND NOT MINGW)
find_package(pthreads QUIET)

if (NOT PTHREAD_INCLUDE_DIR OR NOT PTHREAD_LIBRARY)
# find pthread
find_path(PTHREAD_INCLUDE_DIR pthread.h HINTS C:/pthread-win32/include)
#search package folders with GLOB to add as extra hint for headers
file(GLOB PTHREAD_PACKAGE_INCLUDE_HINT ./packages/cinegy.pthreads-win*/sources)
if (PTHREAD_PACKAGE_INCLUDE_HINT)
message(STATUS "PTHREAD_PACKAGE_INCLUDE_HINT value: ${PTHREAD_PACKAGE_INCLUDE_HINT}")
endif()

# find pthread header
find_path(PTHREAD_INCLUDE_DIR pthread.h HINTS C:/pthread-win32/include ${PTHREAD_PACKAGE_INCLUDE_HINT})

if (PTHREAD_INCLUDE_DIR)
message(STATUS "Pthread include dir: ${PTHREAD_INCLUDE_DIR}")
else()
message(FATAL_ERROR "Failed to find pthread.h. Specify PTHREAD_INCLUDE_DIR.")
endif()

find_library(PTHREAD_LIBRARY NAMES pthread pthread_dll pthread_lib HINTS C:/pthread-win32/lib C:/pthread-win64/lib)

#search package folders with GLOB to add as extra hint for libs
file(GLOB PTHREAD_PACKAGE_LIB_HINT ./packages/cinegy.pthreads-win*/runtimes/win-*/native/release)
if (PTHREAD_PACKAGE_LIB_HINT)
message(STATUS "PTHREAD_PACKAGE_LIB_HINT value: ${PTHREAD_PACKAGE_LIB_HINT}")
endif()

#find pthread library
find_library(PTHREAD_LIBRARY NAMES pthread pthread_dll pthread_lib HINTS C:/pthread-win32/lib C:/pthread-win64/lib ${PTHREAD_PACKAGE_LIB_HINT})
if (PTHREAD_LIBRARY)
message(STATUS "Pthread library: ${PTHREAD_LIBRARY}")
else()
Expand Down Expand Up @@ -551,6 +566,7 @@ MafReadDir(srtcore filelist.maf

# Auto generated version file and add it to the HEADERS_srt list.
configure_file("srtcore/version.h.in" "version.h" @ONLY)

list(INSERT HEADERS_srt 0 "${CMAKE_CURRENT_BINARY_DIR}/version.h")
include_directories("${CMAKE_CURRENT_BINARY_DIR}")

Expand Down
11 changes: 11 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<configuration>
<config>
<add key="dependencyVersion" value="Highest" />
<add key="globalPackagesFolder" value="c:\packages" />
<add key="repositoryPath" value="packages" />
</config>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<!--<add key="Local Source" value="D:\Data\Dev\LocalNuget" />-->
</packageSources>
</configuration>
rndi marked this conversation as resolved.
Show resolved Hide resolved
21 changes: 15 additions & 6 deletions scripts/gather-package.bat
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
rem Create empty directories for package bundle
@echo off

IF "%PLATFORM%"=="x86" (
SET FOLDER_PLATFORM="32"
) ELSE IF "%PLATFORM%"=="x64" (
SET FOLDER_PLATFORM="64"
) ELSE (
echo "Platform %PLATFORM% is not supported"
exit 1
)

md %APPVEYOR_BUILD_FOLDER%\package
md %APPVEYOR_BUILD_FOLDER%\package\include
md %APPVEYOR_BUILD_FOLDER%\package\include\win
md %APPVEYOR_BUILD_FOLDER%\package\bin
md %APPVEYOR_BUILD_FOLDER%\package\lib
md %APPVEYOR_BUILD_FOLDER%\package\pthread-win32
md %APPVEYOR_BUILD_FOLDER%\package\openssl-win64
md %APPVEYOR_BUILD_FOLDER%\package\openssl-win%FOLDER_PLATFORM%

rem Gather SRT includes, binaries and libs
copy %APPVEYOR_BUILD_FOLDER%\version.h %APPVEYOR_BUILD_FOLDER%\package\include\
Expand All @@ -18,9 +26,10 @@ copy %APPVEYOR_BUILD_FOLDER%\common\win\*.h %APPVEYOR_BUILD_FOLDER%\package\incl
copy %APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\*.exe %APPVEYOR_BUILD_FOLDER%\package\bin\
copy %APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\*.dll %APPVEYOR_BUILD_FOLDER%\package\bin\
copy %APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\*.lib %APPVEYOR_BUILD_FOLDER%\package\lib\
copy %APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\*.lib %APPVEYOR_BUILD_FOLDER%\package\lib\
IF "%CONFIGURATION%"=="Debug" (
copy %APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\*.pdb %APPVEYOR_BUILD_FOLDER%\package\bin\
)

rem gather 3rd party elements
(robocopy c:\openssl-win64\ %APPVEYOR_BUILD_FOLDER%\package\openssl-win64 /s /e /np) ^& IF %ERRORLEVEL% GTR 1 exit %ERRORLEVEL%
(robocopy c:\pthread-win32\ %APPVEYOR_BUILD_FOLDER%\package\pthread-win32 /s /e /np) ^& IF %ERRORLEVEL% GTR 1 exit %ERRORLEVEL%
lewk2 marked this conversation as resolved.
Show resolved Hide resolved
rem gather 3rd party openssl elements
(robocopy c:\openssl-win%FOLDER_PLATFORM%\ %APPVEYOR_BUILD_FOLDER%\package\openssl-win%FOLDER_PLATFORM% /s /e /np) ^& IF %ERRORLEVEL% GTR 1 exit %ERRORLEVEL%
exit 0