Re-organized project directory structure.

This commit is contained in:
LoRd_MuldeR 2016-12-22 01:40:16 +01:00
parent ff109e6e01
commit fd037051ee
5 changed files with 36 additions and 24 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -720,6 +720,8 @@ void CMainWindow::received(const quint32 &command, const QString &message)
// PRIVATE FUNCTIONS // PRIVATE FUNCTIONS
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#define HAVE_SSE2(X) ((X).features & MUtils::CPUFetaures::FLAG_SSE2)
static bool VALIDATE_MEDIAINFO(QFile *const handle, const char *const expected_checksum) static bool VALIDATE_MEDIAINFO(QFile *const handle, const char *const expected_checksum)
{ {
if(!handle->reset()) if(!handle->reset())
@ -748,11 +750,12 @@ static bool VALIDATE_MEDIAINFO(QFile *const handle, const char *const expected_c
QString CMainWindow::getMediaInfoPath(void) QString CMainWindow::getMediaInfoPath(void)
{ {
//Detect arch //Detect arch
const bool have_x64 = MUtils::CPUFetaures::detect().x64; const MUtils::CPUFetaures::cpu_info_t cpu_features = MUtils::CPUFetaures::detect();
const QString arch = have_x64 ? QLatin1String("x64-sse2") : QLatin1String("x86-i686"); const QString arch = cpu_features.x64 ? QLatin1String("x64-sse2") : (HAVE_SSE2(cpu_features) ? QLatin1String("x86-sse2") : QLatin1String("x86-i686"));
const char *const checksum = cpu_features.x64 ? g_mixp_checksum_x64 : (HAVE_SSE2(cpu_features) ? g_mixp_checksum_sse : g_mixp_checksum_gen);
//Setup resource //Setup resource
QResource mediaInfoRes(QString(":/res/MediaInfo.%1.exe").arg(arch)); QResource mediaInfoRes(QString(":/res/bin/MediaInfo.%1.exe").arg(arch));
if((!mediaInfoRes.isValid()) || (!mediaInfoRes.data())) if((!mediaInfoRes.isValid()) || (!mediaInfoRes.data()))
{ {
qFatal("MediaInfo resource could not be initialized!"); qFatal("MediaInfo resource could not be initialized!");
@ -762,7 +765,7 @@ QString CMainWindow::getMediaInfoPath(void)
//Validate file content, if already extracted //Validate file content, if already extracted
if(!m_mediaInfoHandle.isNull()) if(!m_mediaInfoHandle.isNull())
{ {
if(VALIDATE_MEDIAINFO(m_mediaInfoHandle.data(), (have_x64 ? g_mixp_checksum_x64 : g_mixp_checksum_x86))) if(VALIDATE_MEDIAINFO(m_mediaInfoHandle.data(), checksum))
{ {
return m_mediaInfoHandle->fileName(); return m_mediaInfoHandle->fileName();
} }
@ -771,7 +774,10 @@ QString CMainWindow::getMediaInfoPath(void)
//Extract MediaInfo binary now! //Extract MediaInfo binary now!
qDebug("MediaInfo binary not existing yet, going to extract now...\n"); qDebug("MediaInfo binary not existing yet, going to extract now...\n");
m_mediaInfoHandle.reset(new QFile(QString("%1/MediaInfo_%2.%3.exe").arg(m_tempFolder, QString().sprintf("%04x", qrand() % 0xFFFF), arch))); const QString filePath = MUtils::make_unique_file(m_tempFolder, "MediaInfo", arch + QLatin1String(".exe"));
if (!filePath.isEmpty())
{
m_mediaInfoHandle.reset(new QFile(filePath));
if (m_mediaInfoHandle->open(QIODevice::ReadWrite | QIODevice::Truncate)) if (m_mediaInfoHandle->open(QIODevice::ReadWrite | QIODevice::Truncate))
{ {
if (m_mediaInfoHandle->write(reinterpret_cast<const char*>(mediaInfoRes.data()), mediaInfoRes.size()) == mediaInfoRes.size()) if (m_mediaInfoHandle->write(reinterpret_cast<const char*>(mediaInfoRes.data()), mediaInfoRes.size()) == mediaInfoRes.size())
@ -794,11 +800,16 @@ QString CMainWindow::getMediaInfoPath(void)
{ {
qWarning("Failed to open MediaInfo binary for writing!\n"); qWarning("Failed to open MediaInfo binary for writing!\n");
} }
}
else
{
qWarning("Failed to gemerate MediaInfo outout path!\n");
}
//Validate file content, after it has been extracted //Validate file content, after it has been extracted
if(!m_mediaInfoHandle.isNull()) if(!m_mediaInfoHandle.isNull())
{ {
if(VALIDATE_MEDIAINFO(m_mediaInfoHandle.data(), (have_x64 ? g_mixp_checksum_x64 : g_mixp_checksum_x86))) if(VALIDATE_MEDIAINFO(m_mediaInfoHandle.data(), checksum))
{ {
return m_mediaInfoHandle->fileName(); return m_mediaInfoHandle->fileName();
} }

View File

@ -3,14 +3,11 @@ REM ///////////////////////////////////////////////////////////////////////////
REM // Set Paths REM // Set Paths
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
set "QTVC_PATH=C:\Qt\4.8.7"
set "UPX3_PATH=C:\Program Files (x86)\UPX"
REM ############################################### REM ###############################################
REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! # REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
REM ############################################### REM ###############################################
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
REM // Setup environment REM // Setup environment
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
@ -34,7 +31,11 @@ if not exist "%VCINSTALLDIR%\bin\cl.exe" (
goto BuildError goto BuildError
) )
if not exist "%QTDIR%\bin\moc.exe" ( if not exist "%QTDIR%\bin\moc.exe" (
echo Qt meta compiler not found. Please check your QTVC_PATH var! echo Qt meta compiler not found. Please check your QTDIR var!
goto BuildError
)
if not exist "%QTDIR%\include\QtCore\qglobal.h" (
echo %%QTDIR%% header files not found. Please check your QTDIR var!
goto BuildError goto BuildError
) )
@ -43,11 +44,11 @@ REM // Get current date and time (in ISO format)
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
set "ISO_DATE=" set "ISO_DATE="
set "ISO_TIME=" set "ISO_TIME="
if not exist "%~dp0\etc\date.exe" BuildError if not exist "%~dp0\..\Prerequisites\GnuWin32\date.exe" BuildError
for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISODATE:%%Y-%%m-%%d') do ( for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\..\Prerequisites\GnuWin32\date.exe" +ISODATE:%%Y-%%m-%%d') do (
if "%%a"=="ISODATE" set "ISO_DATE=%%b" if "%%a"=="ISODATE" set "ISO_DATE=%%b"
) )
for /F "tokens=1,2,3,4 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISOTIME:%%T') do ( for /F "tokens=1,2,3,4 delims=:" %%a in ('"%~dp0\..\Prerequisites\GnuWin32\date.exe" +ISOTIME:%%T') do (
if "%%a"=="ISOTIME" set "ISO_TIME=%%b:%%c:%%d" if "%%a"=="ISOTIME" set "ISO_TIME=%%b:%%c:%%d"
) )
if "%ISO_DATE%"=="" goto BuildError if "%ISO_DATE%"=="" goto BuildError
@ -83,7 +84,7 @@ copy "%~dp0\doc\*.svg" "%PACK_PATH%"
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
REM // Compress REM // Compress
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
"%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.exe" "%~dp0\..\Prerequisites\UPX\upx.exe" --best "%PACK_PATH%\*.exe"
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
REM // Attributes REM // Attributes
@ -127,7 +128,7 @@ REM ///////////////////////////////////////////////////////////////////////////
REM // Build the package REM // Build the package
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
pushd "%PACK_PATH% pushd "%PACK_PATH%
"%~dp0\etc\zip.exe" -9 -r -z "%~dp0\out\%OUT_NAME%.zip" "*.*" < "%~dp0\out\%OUT_NAME%.txt" "%~dp0\..\Prerequisites\GnuWin32\zip.exe" -9 -r -z "%~dp0\out\%OUT_NAME%.zip" "*.*" < "%~dp0\out\%OUT_NAME%.txt"
popd popd
rmdir /Q /S "%PACK_PATH%" rmdir /Q /S "%PACK_PATH%"
attrib +R "%~dp0\out\%OUT_NAME%.zip" attrib +R "%~dp0\out\%OUT_NAME%.zip"