Skip to content

Commit

Permalink
Merge pull request assimp#1954 from assimp/make_tools
Browse files Browse the repository at this point in the history
Make tools
  • Loading branch information
kimkulling authored Jun 6, 2018
2 parents 29e269f + e07aeda commit cd0fe21
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 53 deletions.
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ install:
- 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%"
- set PATH=%PATH%;"C:\\Program Files (x86)\\Inno Setup 5"
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/5/7/b/57b2947c-7221-4f33-b35e-2fc78cb10df4/vc_redist.x64.exe -OutFile .\packaging\windows-innosetup\vc_redist.x64.exe
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/1/d/8/1d8137db-b5bb-4925-8c5d-927424a2e4de/vc_redist.x86.exe -OutFile .\packaging\windows-innosetup\vc_redist.x86.exe

cache:
- code\assimp.dir\%CONFIGURATION%
Expand All @@ -50,6 +53,7 @@ build:
project: Assimp.sln

after_build:
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" iscc packaging\windows-innosetup\script.iss
- 7z a assimp.7z bin\%CONFIGURATION%\* lib\%CONFIGURATION%\*

test_script:
Expand Down
29 changes: 12 additions & 17 deletions code/ObjFileImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,41 +76,36 @@ using namespace std;

// ------------------------------------------------------------------------------------------------
// Default constructor
ObjFileImporter::ObjFileImporter() :
m_Buffer(),
m_pRootObject( NULL ),
m_strAbsPath( "" )
{
ObjFileImporter::ObjFileImporter()
: m_Buffer()
, m_pRootObject( nullptr )
, m_strAbsPath( "" ) {
DefaultIOSystem io;
m_strAbsPath = io.getOsSeparator();
}

// ------------------------------------------------------------------------------------------------
// Destructor.
ObjFileImporter::~ObjFileImporter()
{
ObjFileImporter::~ObjFileImporter() {
delete m_pRootObject;
m_pRootObject = NULL;
m_pRootObject = nullptr;
}

// ------------------------------------------------------------------------------------------------
// Returns true, if file is an obj file.
bool ObjFileImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler , bool checkSig ) const
{
if(!checkSig) //Check File Extension
{
bool ObjFileImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler , bool checkSig ) const {
if(!checkSig) {
//Check File Extension
return SimpleExtensionCheck(pFile,"obj");
}
else //Check file Header
{
} else {
// Check file Header
static const char *pTokens[] = { "mtllib", "usemtl", "v ", "vt ", "vn ", "o ", "g ", "s ", "f " };
return BaseImporter::SearchFileHeaderForToken(pIOHandler, pFile, pTokens, 9 );
}
}

// ------------------------------------------------------------------------------------------------
const aiImporterDesc* ObjFileImporter::GetInfo () const
{
const aiImporterDesc* ObjFileImporter::GetInfo () const {
return &desc;
}

Expand Down
62 changes: 26 additions & 36 deletions packaging/windows-innosetup/script.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[Setup]
AppName=Open Asset Import Library - SDK
AppVerName=Open Asset Import Library - SDK (v3.3.1)
AppVerName=Open Asset Import Library - SDK (v4.1.0)
DefaultDirName={pf}\Assimp
DefaultGroupName=Assimp
UninstallDisplayIcon={app}\bin\x86\assimp.exe
Expand All @@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico
WizardImageFile=compiler:WizModernImage-IS.BMP
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
LicenseFile=License.rtf
OutputBaseFileName=assimp-sdk-3.3.1-setup
VersionInfoVersion=3.3.1.0
VersionInfoTextVersion=3.3.1
OutputBaseFileName=assimp-sdk-4.1.0-setup
VersionInfoVersion=4.1.0.0
VersionInfoTextVersion=4.1.0
VersionInfoCompany=Assimp Development Team
ArchitecturesInstallIn64BitMode=x64

Expand All @@ -30,20 +30,19 @@ Name: "help"; Description: "Help Files"; Types: full compact
Name: "samples"; Description: "Samples"; Types: full
Name: "test"; Description: "Test Models (BSD-licensed)"; Types: full
Name: "test_nonbsd"; Description: "Test Models (other (free) licenses)"; Types: full
Name: "pyassimp"; Description: "Python Bindings"; Types: full
Name: "dassimp"; Description: "D Bindings"; Types: full
Name: "assimp_net"; Description: "C#/.NET Bindings"; Types: full
;Name: "pyassimp"; Description: "Python Bindings"; Types: full
;Name: "dassimp"; Description: "D Bindings"; Types: full
;Name: "assimp_net"; Description: "C#/.NET Bindings"; Types: full

[Run]
Filename: "{app}\stub\vc_redist.x86.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2015 redistributable package (32 Bit)"; Check: not IsWin64
Filename: "{app}\stub\vc_redist.x64.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2015 redistributable package (64 Bit)"; Check: IsWin64
;Filename: "{app}\stub\vc_redist.x86.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2017 redistributable package (32 Bit)"; Check: not IsWin64
Filename: "{app}\stub\vc_redist.x64.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2017 redistributable package (64 Bit)"; Check: IsWin64

[Files]

Source: "readme_installer.txt"; DestDir: "{app}"; Flags: isreadme

; Installer stub
Source: "vc_redist.x86.exe"; DestDir: "{app}\stub\"; Check: not IsWin64
;Source: "vc_redist.x86.exe"; DestDir: "{app}\stub\"; Check: not IsWin64
Source: "vc_redist.x64.exe"; DestDir: "{app}\stub\"; Check: IsWin64

; Common stuff
Expand All @@ -55,27 +54,27 @@ Source: "WEB"; DestDir: "{app}"
Source: "..\..\scripts\*"; DestDir: "{app}\scripts"; Flags: recursesubdirs

; x86 binaries
Source: "..\..\bin\release\x86\assimp-vc140-mt.dll"; DestDir: "{app}\bin\x86"
Source: "..\..\bin\release\x86\assimp_viewer.exe"; DestDir: "{app}\bin\x86"; Components: tools
Source: "D3DCompiler_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
Source: "D3DX9_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
Source: "..\..\bin\release\x86\assimp.exe"; DestDir: "{app}\bin\x86"; Components: tools
;Source: "..\..\bin\release\x86\assimp-vc140-mt.dll"; DestDir: "{app}\bin\x86"
;Source: "..\..\bin\release\x86\assimp_viewer.exe"; DestDir: "{app}\bin\x86"; Components: tools
;Source: "C:\Windows\SysWOW64\D3DCompiler_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
;Source: "C:\Windows\SysWOW64\D3DX9_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
;Source: "..\..\bin\release\x86\assimp.exe"; DestDir: "{app}\bin\x86"; Components: tools

; x64 binaries
Source: "..\..\bin\release\x64\assimp-vc140-mt.dll"; DestDir: "{app}\bin\x64"
Source: "..\..\bin\release\x64\assimp_viewer.exe"; DestDir: "{app}\bin\x64"; Components: tools
Source: "D3DCompiler_42_x64.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DCompiler_42.dll"; Components: tools
Source: "D3DX9_42_x64.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DX9_42.dll"; Components: tools
Source: "..\..\bin\release\x64\assimp.exe"; DestDir: "{app}\bin\x64"; Components: tools
Source: "..\..\bin\release\assimp-vc140-mt.dll"; DestDir: "{app}\bin\x64"
Source: "..\..\bin\release\assimp_viewer.exe"; DestDir: "{app}\bin\x64"; Components: tools
Source: "C:\Windows\SysWOW64\D3DCompiler_42.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DCompiler_42.dll"; Components: tools
Source: "C:\Windows\SysWOW64\D3DX9_42.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DX9_42.dll"; Components: tools
Source: "..\..\bin\release\assimp.exe"; DestDir: "{app}\bin\x64"; Components: tools

; Documentation
Source: "..\..\doc\AssimpDoc_Html\AssimpDoc.chm"; DestDir: "{app}\doc"; Components: help
Source: "..\..\doc\AssimpCmdDoc_Html\AssimpCmdDoc.chm"; DestDir: "{app}\doc"; Components: help
Source: "..\..\doc\datastructure.xml"; DestDir: "{app}\doc"; Components: help
;Source: "..\..\doc\AssimpDoc_Html\AssimpDoc.chm"; DestDir: "{app}\doc"; Components: help
;Source: "..\..\doc\AssimpCmdDoc_Html\AssimpCmdDoc.chm"; DestDir: "{app}\doc"; Components: help
;Source: "..\..\doc\datastructure.xml"; DestDir: "{app}\doc"; Components: help

; Import libraries
Source: "..\..\lib\release\x86\assimp.lib"; DestDir: "{app}\lib\x86"
Source: "..\..\lib\release\x64\assimp.lib"; DestDir: "{app}\lib\x64"
;Source: "..\..\lib\release\x86\assimp.lib"; DestDir: "{app}\lib\x86"
Source: "..\..\lib\release\assimp-vc140-mt.lib"; DestDir: "{app}\lib\x64"

; Samples
Source: "..\..\samples\*"; DestDir: "{app}\samples"; Flags: recursesubdirs; Components: samples
Expand All @@ -84,7 +83,7 @@ Source: "..\..\samples\*"; DestDir: "{app}\samples"; Flags: recursesubdirs; Comp
Source: "..\..\include\*"; DestDir: "{app}\include"; Flags: recursesubdirs

; dAssimp
Source: "..\..\port\dAssimp\*"; DestDir: "{app}\port\D"; Flags: recursesubdirs; Components: dassimp
;Source: "..\..\port\dAssimp\*"; DestDir: "{app}\port\D"; Flags: recursesubdirs; Components: dassimp

; Assimp.NET
;Source: "..\..\port\Assimp.NET\*"; DestDir: "{app}\port\C#"; Flags: recursesubdirs; Components: assimp_net
Expand All @@ -97,15 +96,6 @@ Source: "..\..\port\dAssimp\*"; DestDir: "{app}\port\D"; Flags: recursesubdirs;
;Source: "..\..\test\regression\*"; DestDir: "{app}\test\regression"; Flags: recursesubdirs; Components: test
;Source: "..\..\test\models-nonbsd\*"; DestDir: "{app}\test\models-nonbsd"; Flags: recursesubdirs; Components: test_nonbsd

; Source Code & Workspaces
;Source: "..\..\code\*"; Excludes: "*.o"; DestDir: "{app}\code"; Flags: recursesubdirs; Components: wsource
;Source: "..\..\workspaces\vc8\*.sln"; DestDir: "{app}\workspaces\vc8"; Components: wsource and vc8
;Source: "..\..\workspaces\vc8\*.vcproj"; DestDir: "{app}\workspaces\vc8"; Components: wsource and vc8
;Source: "..\..\workspaces\vc9\*.sln"; DestDir: "{app}\workspaces\vc9"; Components: wsource and vc9
;Source: "..\..\workspaces\vc9\*.vcproj"; DestDir: "{app}\workspaces\vc9"; Components: wsource and vc9

; Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme

[Icons]
Name: "{group}\Assimp Manual"; Filename: "{app}\doc\AssimpDoc.chm" ; Components: help
Name: "{group}\Assimp Command Line Manual"; Filename: "{app}\doc\AssimpCmdDoc.chm"; Components: help
Expand Down
57 changes: 57 additions & 0 deletions tools/make/build_env_win32.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@echo off
set "initialdir=%cd%"
goto:main

:exitsucc
cd /d "%initialdir%"
set initialdir=

set MSBUILD_15="C:\Program Files (x86)\Microsoft Visual Studio\2018\Professional\MSBuild\15.0\Bin\msbuild.exe"
set MSBUILD_14="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe"

if not "%VS150%"=="" set MSBUILD_15="%VS150%\MSBuild\15.0\Bin\msbuild.exe"

if /i %VS_VERSION%==2017 (
set MS_BUILD_EXE=%MSBUILD_15%
set PLATFORM_VER=v141
) else (
set MS_BUILD_EXE=%MSBUILD_14%
set PLATFORM_VER=v140
)

set MSBUILD=%MS_BUILD_EXE%

exit /b 0

:main
if not defined PLATFORM set "PLATFORM=x64"

::my work here is done?

set PATH_VSWHERE=C:\Program Files (x86)\Microsoft Visual Studio\Installer\
REM set PATH_STUDIO="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\"

for /f "usebackq tokens=*" %%i in (`"%PATH_VSWHERE%vswhere" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i
)

IF EXIST "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" set VS150=%InstallDir%\

set "CMAKE_GENERATOR=Visual Studio 15 2017 Win64"
if not "%VS150%"=="" call "%VS150%\VC\Auxiliary\Build\vcvarsall.bat" %PLATFORM% && echo found VS 2o17 && set PLATFORM_VER=v141 && set VS_VERSION=2017 && goto:exitsucc

set "CMAKE_GENERATOR=Visual Studio 14 2015 Win64"
if defined VS140COMNTOOLS call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o15 && set PLATFORM_VER=v140 && set VS_VERSION=2015 && goto:exitsucc

if defined VS130COMNTOOLS echo call ghostbusters... found lost VS version

set "CMAKE_GENERATOR=Visual Studio 12 2013 Win64"
if defined VS120COMNTOOLS call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o13 && set PLATFORM_VER=v120 && set VS_VERSION=2013 && goto:exitsucc

set "CMAKE_GENERATOR=Visual Studio 11 2012 Win64"
if defined VS110COMNTOOLS call "%VS110COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o12 && set PLATFORM_VER=v110 && set VS_VERSION=2012 && goto:exitsucc

set "CMAKE_GENERATOR=Visual Studio 10 2010 Win64"
if defined VS100COMNTOOLS call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o1o && set PLATFORM_VER=v100 && set VS_VERSION=2010 && goto:exitsucc

goto:exitsucc
18 changes: 18 additions & 0 deletions tools/make/make_all_win32_x64.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
rem @echo off
setlocal
call build_env_win32.bat

set BUILD_CONFIG=release
set PLATFORM_CONFIG=x64
set MAX_CPU_CONFIG=4

set CONFIG_PARAMETER=/p:Configuration="%BUILD_CONFIG%"
set PLATFORM_PARAMETER=/p:Platform="%PLATFORM_CONFIG%"
set CPU_PARAMETER=/maxcpucount:%MAX_CPU_CONFIG%
set PLATFORM_TOOLSET=/p:PlatformToolset=%PLATFORM_VER%

pushd ..\..\
cmake CMakeLists.txt -G "Visual Studio 15 2017 Win64"
%MSBUILD% assimp.sln %CONFIG_PARAMETER% %PLATFORM_PARAMETER% %CPU_PARAMETER% %PLATFORM_TOOLSET%
popd
endlocal

0 comments on commit cd0fe21

Please sign in to comment.