소스 검색

Merge pull request #1479 from jaredmulconry/appveyor

AppVeyor cleanup and Addition of VS 2017 and running Tests
Kim Kulling 8 년 전
부모
커밋
114c48bbcf
6개의 변경된 파일229개의 추가작업 그리고 63개의 파일을 삭제
  1. 43 22
      appveyor.yml
  2. 4 4
      code/LogAux.h
  3. 1 1
      code/PretransformVertices.cpp
  4. 4 0
      scripts/AppVeyor/cacheglobs.txt
  5. 177 0
      scripts/AppVeyor/mtime_cache
  6. 0 36
      scripts/appveyor/compiler_setup.bat

+ 43 - 22
appveyor.yml

@@ -10,33 +10,54 @@ branches:
   only:
     - master
 
+matrix:
+  fast_finish: true
+    
+image:
+  - Visual Studio 2013
+  - Visual Studio 2015
+  - Visual Studio 2017
+    
 platform:
-    - x86
-    - x64
-
-configuration:
-  - 14 2015
-  - 12 2013
-  #- MinGW
-  #- 10 2010 # only works for x86
-
-init:
-- if "%platform%" EQU "x64" ( for %%a in (2008 2010 MinGW) do ( if "%Configuration%"=="%%a" (echo "Skipping unsupported configuration" && exit /b 1 ) ) )
+  - Win32
+  - x64
+  
+configuration: Release
 
 install:
-# Make compiler command line tools available
-- call c:\projects\assimp\scripts\appveyor\compiler_setup.bat
-
-build_script:
-- cd c:\projects\assimp
-- if "%platform%" equ "x64" (cmake CMakeLists.txt -DASSIMP_WERROR=ON -G "Visual Studio %Configuration% Win64")
-- if "%platform%" equ "x86" (cmake CMakeLists.txt -DASSIMP_WERROR=ON -G "Visual Studio %Configuration%")
-- if "%platform%" equ "x64" (msbuild /m /p:Configuration=Release /p:Platform="x64" Assimp.sln)
-- if "%platform%" equ "x86" (msbuild /m /p:Configuration=Release /p:Platform="Win32" Assimp.sln)
-
+  - set PATH=C:\Ruby24-x64\bin;%PATH%
+  - set CMAKE_DEFINES -DASSIMP_WERROR=ON
+  - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" set CMAKE_GENERATOR_NAME=Visual Studio 12 2013
+  - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015
+  - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" set CMAKE_GENERATOR_NAME=Visual Studio 15 2017
+  - if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=%CMAKE_GENERATOR_NAME% Win64
+  - cmake %CMAKE_DEFINES% -G "%CMAKE_GENERATOR_NAME%"
+  
+cache:
+  - code\assimp.dir\%CONFIGURATION%
+  - contrib\zlib\zlibstatic.dir\%CONFIGURATION%
+  - contrib\zlib\zlib.dir\%CONFIGURATION%
+  - tools\assimp_cmd\assimp_cmd.dir\%CONFIGURATION%
+  - tools\assimp_view\assimp_viewer.dir\%CONFIGURATION%
+  - test\unit.dir\%CONFIGURATION%
+  - bin\.mtime_cache
+  
+before_build:
+  - ruby scripts\AppVeyor\mtime_cache -g scripts\AppVeyor\cacheglobs.txt -c bin\.mtime_cache\cache.json
+  
+build:
+  parallel: true
+  project: Assimp.sln
+  
 after_build:
-  - 7z a assimp.7z c:\projects\assimp\bin\release\* c:\projects\assimp\lib\release\*
+  - 7z a assimp.7z bin\%CONFIGURATION%\* lib\%CONFIGURATION%\*
+
+test_script:
+  - cmd: bin\%CONFIGURATION%\unit.exe --gtest_output=xml:testout.xml
 
+on_finish:
+  - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\testout.xml))
+  
 artifacts:
   - path: assimp.7z
     name: assimp_lib

+ 4 - 4
code/LogAux.h

@@ -66,28 +66,28 @@ public:
     // ------------------------------------------------------------------------------------------------
     static void LogWarn(const Formatter::format& message)   {
         if (!DefaultLogger::isNullLogger()) {
-            DefaultLogger::get()->warn(Prefix() +(std::string)message);
+            DefaultLogger::get()->warn(Prefix()+(std::string)message);
         }
     }
 
     // ------------------------------------------------------------------------------------------------
     static void LogError(const Formatter::format& message)  {
         if (!DefaultLogger::isNullLogger()) {
-            DefaultLogger::get()->error(Prefix() +(std::string)message);
+            DefaultLogger::get()->error(Prefix()+(std::string)message);
         }
     }
 
     // ------------------------------------------------------------------------------------------------
     static void LogInfo(const Formatter::format& message)   {
         if (!DefaultLogger::isNullLogger()) {
-            DefaultLogger::get()->info(Prefix() +(std::string)message);
+            DefaultLogger::get()->info(Prefix()+(std::string)message);
         }
     }
 
     // ------------------------------------------------------------------------------------------------
     static void LogDebug(const Formatter::format& message)  {
         if (!DefaultLogger::isNullLogger()) {
-            DefaultLogger::get()->debug(Prefix() +(std::string)message);
+            DefaultLogger::get()->debug(Prefix()+(std::string)message);
         }
     }
 

+ 1 - 1
code/PretransformVertices.cpp

@@ -104,7 +104,7 @@ unsigned int PretransformVertices::CountNodes( aiNode* pcNode )
 
 // ------------------------------------------------------------------------------------------------
 // Get a bitwise combination identifying the vertex format of a mesh
-unsigned int PretransformVertices::GetMeshVFormat(aiMesh* pcMesh)
+unsigned int PretransformVertices::GetMeshVFormat( aiMesh* pcMesh )
 {
     // the vertex format is stored in aiMesh::mBones for later retrieval.
     // there isn't a good reason to compute it a few hundred times

+ 4 - 0
scripts/AppVeyor/cacheglobs.txt

@@ -0,0 +1,4 @@
+code/*.{%{cpp}}
+contrib/**/*.{%{cpp}}
+include/**/*.{%{cpp}}
+test/**/*.{%{cpp}}

+ 177 - 0
scripts/AppVeyor/mtime_cache

@@ -0,0 +1,177 @@
+#!/usr/bin/env ruby
+
+#
+# mtime_cache
+# Copyright (c) 2016 Borislav Stanimirov
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+
+require 'digest/md5'
+require 'json'
+require 'fileutils'
+
+VERSION = "1.0.2"
+
+VERSION_TEXT = "mtime_cache v#{VERSION}"
+
+USAGE = <<ENDUSAGE
+
+Usage:
+    mtime_cache [<globs>] [-g globfile] [-d] [-q|V] [-c cache]
+ENDUSAGE
+
+HELP = <<ENDHELP
+
+    Traverse through globbed files, making a json cache based on their mtime.
+    If a cache exists, changes the mtime of existing unchanged (based on MD5
+    hash) files to the one in the cache.
+
+    Options:
+
+    globs           Ruby-compatible glob strings (ex some/path/**/*.java)
+                    A extension pattern is allowd in the form %{pattern}
+                    (ex some/path/*.{%{pattern1},%{pattern2}})
+                    The globs support the following patterns:
+                     %{cpp} - common C++ extensions
+
+    -g, --globfile  A file with list of globs to perform (one per line)
+
+    -?, -h, --help  Show this help message.
+    -v, --version   Show the version number (#{VERSION})
+    -q, --quiet     Don't log anything to stdout
+    -V, --verbose   Show extra logging
+    -d, --dryrun    Don't change any files on the filesystem
+    -c, --cache     Specify the cache file for input and output.
+                    [Default is .mtime_cache.json]
+
+ENDHELP
+
+param_arg = nil
+ARGS = { :cache => '.mtime_cache.json', :globs => [] }
+
+ARGV.each do |arg|
+  case arg
+    when '-g', '--globfile'   then param_arg = :globfile
+    when '-h', '-?', '--help' then ARGS[:help] = true
+    when '-v', '--version'    then ARGS[:ver] = true
+    when '-q', '--quiet'      then ARGS[:quiet] = true
+    when '-V', '--verbose'    then ARGS[:verbose] = true
+    when '-d', '--dryrun'     then ARGS[:dry] = true
+    when '-c', '--cache'      then param_arg = :cache
+    else
+      if param_arg
+        ARGS[param_arg] = arg
+        param_arg = nil
+      else
+        ARGS[:globs] << arg
+      end
+  end
+end
+
+def log(text, level = 0)
+  return if ARGS[:quiet]
+  return if level > 0 && !ARGS[:verbose]
+  puts text
+end
+
+if ARGS[:ver] || ARGS[:help]
+  log VERSION_TEXT
+  exit if ARGS[:ver]
+  log USAGE
+  log HELP
+  exit
+end
+
+if ARGS[:globs].empty? && !ARGS[:globfile]
+  log 'Error: Missing globs'
+  log USAGE
+  exit 1
+end
+
+EXTENSION_PATTERNS = {
+  :cpp => "c,cc,cpp,cxx,h,hpp,hxx,inl,ipp,inc,ixx"
+}
+
+cache_file = ARGS[:cache]
+
+cache = {}
+
+if File.file?(cache_file)
+  log "Found #{cache_file}"
+  cache = JSON.parse(File.read(cache_file))
+  log "Read #{cache.length} entries"
+else
+  log "#{cache_file} not found. A new one will be created"
+end
+
+globs = ARGS[:globs].map { |g| g % EXTENSION_PATTERNS }
+
+globfile = ARGS[:globfile]
+if globfile
+  File.open(globfile, 'r').each_line do |line|
+    line.strip!
+    next if line.empty?
+    globs << line % EXTENSION_PATTERNS
+  end
+end
+
+if globs.empty?
+  log 'Error: No globs in globfile'
+  log USAGE
+  exit 1
+end
+
+files = {}
+num_changed = 0
+
+globs.each do |glob|
+  Dir[glob].each do |file|
+    next if !File.file?(file)
+
+    mtime = File.mtime(file).to_i
+    hash = Digest::MD5.hexdigest(File.read(file))
+
+    cached = cache[file]
+
+    if cached && cached['hash'] == hash && cached['mtime'] < mtime
+      mtime = cached['mtime']
+
+      log "mtime_cache: changing mtime of #{file} to #{mtime}", 1
+
+      File.utime(File.atime(file), Time.at(mtime), file) if !ARGS[:dry]
+      num_changed += 1
+    else
+      log "mtime_cache: NOT changing mtime of #{file}", 1
+    end
+
+    files[file] = { 'mtime' => mtime, 'hash' => hash }
+  end
+end
+
+log "Changed mtime of #{num_changed} of #{files.length} files"
+log "Writing #{cache_file}"
+
+if !ARGS[:dry]
+  dirname = File.dirname(cache_file)
+  unless File.directory?(dirname)
+    FileUtils.mkdir_p(dirname)
+  end
+  File.open(cache_file, 'w').write(JSON.pretty_generate(files))
+end

+ 0 - 36
scripts/appveyor/compiler_setup.bat

@@ -1,36 +0,0 @@
-rem @echo off
-
-:: Now we declare a scope
-Setlocal EnableDelayedExpansion EnableExtensions
-
-if not defined Configuration set Configuration=14 2015
-
-if "%Configuration%"=="MinGW" ( goto :mingw )
-
-set arch=x86
-
-if "%platform%" EQU "x64" ( set arch=x86_amd64 )
-
-if "%Configuration%"=="14 2015" (
-	set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
-)
-
-if "%Configuration%"=="12 2013" (
-	set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
-)
-
-if "%Configuration%"=="11 2012" (
-	set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
-)
-
-if "%Configuration%"=="10 2010" (
-	set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
-)
-
-:: Visual Studio detected
-endlocal & call %SET_VS_ENV% %arch%
-goto :eof
-
-:: MinGW detected
-:mingw
-endlocal & set PATH=c:\mingw\bin;%PATH%