diff --git a/.appveyor.yml b/.appveyor.yml index 56e4f29ca..01d05d47a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -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 @@ -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' } + - 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' } - 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')) diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index 27993477a..b87d59d93 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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() @@ -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}") diff --git a/nuget.config b/nuget.config new file mode 100644 index 000000000..9178fe083 --- /dev/null +++ b/nuget.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/scripts/gather-package.bat b/scripts/gather-package.bat index 2c66706f8..e56a7bf3e 100644 --- a/scripts/gather-package.bat +++ b/scripts/gather-package.bat @@ -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\ @@ -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% +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