Merge pull request #64 from Vproject/mingw

Add MinGW platform makefile and related source changes
This commit is contained in:
Ethan Hugg 2013-12-26 09:39:09 -08:00
commit adc90d6f14
14 changed files with 36 additions and 29 deletions

View File

@ -1,4 +1,4 @@
UNAME=$(shell uname | tr A-Z a-z)
UNAME=$(shell uname | tr A-Z a-z | tr -d \\-[:digit:].)
LIBPREFIX=lib
LIBSUFFIX=a
CP=cp
@ -35,7 +35,7 @@ endif
CFLAGS += -DNO_DYNAMIC_VP -DHAVE_CACHE_LINE_ALIGN
LDFLAGS +=
ASMFLAGS += -DNO_DYNAMIC_VP -DNOPREFIX
ASMFLAGS += -DNO_DYNAMIC_VP
#### No user-serviceable parts below this line

View File

@ -2,4 +2,4 @@ USE_ASM = No # We don't have ASM working on Mac yet
ASM = nasm
CFLAGS += -Werror -fPIC
LDFLAGS += -lpthread
ASMFLAGS += -f macho --prefix _
ASMFLAGS += -f macho --prefix _ -DNOPREFIX

View File

@ -1,5 +1,5 @@
ASM = nasm
CFLAGS += -fPIC
LDFLAGS += -lpthread
ASMFLAGS += -f elf
ASMFLAGS += -f elf -DNOPREFIX

View File

@ -1,5 +1,5 @@
ASM = nasm
CFLAGS += -Werror -fPIC -DLINUX -D__NO_CTYPE
LDFLAGS += -lpthread
ASMFLAGS += -f elf
ASMFLAGS += -f elf -DNOPREFIX

View File

@ -0,0 +1,5 @@
ASM = nasm
CFLAGS += -DWIN32 -D__NO_CTYPE
LDFLAGS +=
ASMFLAGS += -f win -DPREFIX

View File

@ -37,7 +37,7 @@
* 08/18/2008 Created
*
*****************************************************************************/
#if !defined(_WIN32)
#if !defined(_WIN32) || !defined(_MSC_VER)
#include <string.h>
#include <stdio.h>
#endif

View File

@ -48,7 +48,7 @@ inline uint32_t EndianFix (uint32_t uiX) {
}
#else //WORDS_BIGENDIAN
#ifdef WIN32
#if defined(WIN32) && defined(_MSC_VER)
inline uint32_t EndianFix (uint32_t uiX) {
__asm {
mov eax, uiX

View File

@ -708,7 +708,7 @@ static int32_t CavlcGetLevelVal (int32_t iLevel[16], SReadBitsCache* pBitsCache,
for (; i < uiTotalCoeff; i++) {
if (pBitsCache->uiRemainBits <= 16) SHIFT_BUFFER (pBitsCache);
#if defined(WIN32) && !defined(WIN64)
#if defined(WIN32) && !defined(WIN64) && defined(_MSC_VER)
uiCache32Bit = pBitsCache->uiCache32Bit;
WELS_GET_PREFIX_BITS (uiCache32Bit, iPrefixBits);
#else
@ -811,7 +811,7 @@ static int32_t CavlcGetRunBefore (int32_t iRun[16], SReadBitsCache* pBitsCache,
iRun[i] = pVlcTable->kpZeroTable[6][uiValue][0];
} else {
if (pBitsCache->uiRemainBits < 16) SHIFT_BUFFER (pBitsCache);
#if defined(WIN32) && !defined(WIN64)
#if defined(WIN32) && !defined(WIN64) && defined(_MSC_VER)
uiCache32Bit = pBitsCache->uiCache32Bit;
WELS_GET_PREFIX_BITS (uiCache32Bit, iPrefixBits);
#else
@ -1345,4 +1345,4 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
return 0;
}
} // namespace WelsDec
} // namespace WelsDec

View File

@ -46,10 +46,16 @@
#include <windows.h>
#include <sys/types.h>
#include <sys/timeb.h>
#ifndef _MSC_VER
#include <sys/time.h>
#ifndef HAVE_STRNLEN
#define strnlen(a,b) strlen(a)
#endif //!HAVE_STRNLEN
#endif //!_MSC_VER
#else
#include <sys/time.h>
#include <sys/timeb.h>
#endif
#endif //_WIN32
#include "utils.h"
#include "macros.h"
@ -79,7 +85,7 @@ void_t WelsLog (void_t* pPtr, int32_t iLevel, const char* kpFmt, ...) {
}
#if defined(_WIN32)
#if defined(_WIN32) && defined(_MSC_VER)
#if defined(_MSC_VER) && (_MSC_VER>=1500)
@ -275,4 +281,4 @@ int32_t WelsFflush (WelsFileHandle* pFp) {
return fflush (pFp);
}
} // namespace WelsDec
} // namespace WelsDec

View File

@ -375,9 +375,7 @@ static __inline int wels_strnlen_s (const char* dest, int dmax) {
#endif//(WIN32 && _MSC_VER && _MSC_VER<1500) || __GNUC__
#if defined(WIN32)
#ifdef _MSC_VER
#if defined(WIN32) && defined(_MSC_VER)
#if _MSC_VER >= 1500 // VS2008
#define SNPRINTF _snprintf_s
#define LOCALTIME localtime_s
@ -397,7 +395,6 @@ static __inline int wels_strnlen_s (const char* dest, int dmax) {
#define VSPRINTF vsprintf
#define FOPEN fopen
#endif//_MSC_VER >= 1500
#endif//_MSC_VER
#else//__GNUC__

View File

@ -273,7 +273,7 @@ return x;
#else
#if defined(WIN32) && !defined(WIN64)
#if defined(WIN32) && !defined(WIN64) && defined(_MSC_VER)
static inline uint32_t ENDIAN_FIX (uint32_t x) {
__asm {
mov eax, x

View File

@ -41,7 +41,7 @@
#if defined(MT_ENABLED)
#include <assert.h>
#ifdef __GNUC__
#if defined(__GNUC__) && !defined(_WIN32)
#include <semaphore.h>
#ifndef SEM_NAME_MAX
// length of semaphore name should be system constrained at least on mac 10.7
@ -441,7 +441,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
iIdx = 0;
while (iIdx < iThreadNum) {
#ifdef __GNUC__ // for posix threading
#if defined(__GNUC__) && !defined(_WIN32) // for posix threading
str_t name[SEM_NAME_MAX] = {0};
int32_t used_len = 0;
WELS_THREAD_ERROR_CODE err = 0;
@ -852,7 +852,7 @@ int32_t WriteSliceBs (sWelsEncCtx* pCtx, uint8_t* pSliceBsBuf, const int32_t iSl
}
#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE)
#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(_WIN32)
WELS_THREAD_ROUTINE_TYPE UpdateMbListThreadProc (void* arg) {
SSliceThreadPrivateData* pPrivateData = (SSliceThreadPrivateData*)arg;
sWelsEncCtx* pEncPEncCtx = NULL;
@ -1243,7 +1243,7 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) {
// due to WelsMultipleEventsWaitSingleBlocking implememtation can not work well
// in case waiting pUpdateMbListEvent and pReadySliceCodingEvent events at the same time
#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE)
#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(_WIN32)
WelsThreadCreate (&pCtx->pSliceThreading->pUpdateMbListThrdHandles[iIdx], UpdateMbListThreadProc,
&pCtx->pSliceThreading->pThreadPEncCtx[iIdx], 0);
#endif//__GNUC__

View File

@ -46,6 +46,9 @@
#include <windows.h>
#include <sys/types.h>
#include <sys/timeb.h>
#ifndef _MSC_VER
#include <sys/time.h>
#endif
#else
#include <sys/time.h>
#endif
@ -147,23 +150,20 @@ void WelsLogDefault (void* pCtx, const int32_t kiLevel, const str_t* kpFmtStr, v
if (pEncCtx) {
time_t l_time;
#if defined(_WIN32)
#if defined(_MSC_VER)
#if defined(_WIN32) && defined(_MSC_VER)
#if _MSC_VER >= 1500
struct tm t_now;
#else//VC6
struct tm* t_now;
#endif//_MSC_VER >= 1500
#endif//_MSC_VER
#else//__GNUC__
struct tm* t_now;
#endif//WIN32
#if defined( _WIN32 )
#if defined( _WIN32 ) && defined(_MSC_VER)
struct _timeb tb;
time (&l_time);
#ifdef _MSC_VER
#if _MSC_VER >= 1500
LOCALTIME (&t_now, &l_time);
#else
@ -172,7 +172,6 @@ void WelsLogDefault (void* pCtx, const int32_t kiLevel, const str_t* kpFmtStr, v
return;
}
#endif//_MSC_VER >= 1500
#endif//_MSC_VER
FTIME (&tb);
#elif defined( __GNUC__ )
struct timeval tv;

View File

@ -52,7 +52,7 @@
WELSVP_NAMESPACE_BEGIN
#if defined(_WIN32) || defined(_WIN32) || defined(_MSC_VER)
#if ( defined(_WIN32) || defined(_WIN32) ) && defined(_MSC_VER)
typedef char int8_t ;
typedef unsigned char uint8_t ;