mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 07:44:43 +01:00
Remove replacement unistd.h - only getopt.h and STDOUT_FILENO are used in test.c. Also remove version.bat since it doesn't grab the git information that version.sh does - instead I'll just leave VERSION empty for now when compiling from VS.
This commit is contained in:
parent
e990461f77
commit
91ba6cf2ba
@ -1,60 +0,0 @@
|
||||
/*!
|
||||
This file was taken from
|
||||
https://stackoverflow.com/questions/341817/is-there-a-replacement-for-unistd-h-for-windows-visual-c
|
||||
On: 20/5/2015
|
||||
|
||||
All copyrights belong to their relative holders.
|
||||
*/
|
||||
|
||||
#ifndef _UNISTD_H
|
||||
#define _UNISTD_H 1
|
||||
|
||||
/* This file intended to serve as a drop-in replacement for
|
||||
* unistd.h on Windows
|
||||
* Please add functionality as neeeded
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <io.h>
|
||||
#include <getopt.h> /* getopt at: https://gist.github.com/ashelly/7776712 */
|
||||
#include <process.h> /* for getpid() and the exec..() family */
|
||||
#include <direct.h> /* for _getcwd() and _chdir() */
|
||||
|
||||
#define srandom srand
|
||||
#define random rand
|
||||
|
||||
/* Values for the second argument to access.
|
||||
These may be OR'd together. */
|
||||
#define R_OK 4 /* Test for read permission. */
|
||||
#define W_OK 2 /* Test for write permission. */
|
||||
//#define X_OK 1 /* execute permission - unsupported in windows*/
|
||||
#define F_OK 0 /* Test for existence. */
|
||||
|
||||
#define access _access
|
||||
#define dup2 _dup2
|
||||
#define execve _execve
|
||||
#define ftruncate _chsize
|
||||
#define unlink _unlink
|
||||
#define fileno _fileno
|
||||
#define getcwd _getcwd
|
||||
#define chdir _chdir
|
||||
#define isatty _isatty
|
||||
#define lseek _lseek
|
||||
/* read, write, and close are NOT being #defined here, because while there are file handle specific versions for Windows, they probably don't work for sockets. You need to look at your app and consider whether to call e.g. closesocket(). */
|
||||
|
||||
#define ssize_t int
|
||||
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
/* should be in some equivalent to <sys/types.h> */
|
||||
typedef __int8 int8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
#endif /* unistd.h */
|
15
test/test.c
15
test/test.c
@ -1,10 +1,23 @@
|
||||
#define POSIXLY_CORRECT
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include "../src/vgmstream.h"
|
||||
#include "../src/util.h"
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef STDOUT_FILENO
|
||||
#define STDOUT_FILENO 1
|
||||
#endif
|
||||
|
||||
#ifndef VERSION
|
||||
#ifdef _MSC_VER
|
||||
// To include the git version number / commit in test.exe, compile outside of Visual Studio and make sure git is in the current PATH.
|
||||
#define VERSION ""
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BUFSIZE 4000
|
||||
|
@ -52,7 +52,8 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\version.bat"</Command>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@ -64,7 +65,7 @@
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<ForcedIncludeFiles>$(ProjectDir)..\VERSION.H;%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles>%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>libg719_decode.lib;libg7221_decode.lib;libmpg123-0.lib;libvorbis.lib;at3plusdecoder.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
@ -76,7 +77,8 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\version.bat"</Command>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
@ -88,7 +90,7 @@
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ForcedIncludeFiles>$(ProjectDir)..\VERSION.H;%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles>%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>libg719_decode.lib;libg7221_decode.lib;libmpg123-0.lib;libvorbis.lib;at3plusdecoder.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
24
version.bat
24
version.bat
@ -1,24 +0,0 @@
|
||||
@ECHO OFF
|
||||
GOTO WORK
|
||||
REM GOTO COMMAND ABOVE IS TO SKIP PARSING THIS COMMENT SECTION.
|
||||
REM
|
||||
REM WARNING: DO NOT DELETE THE "EXTRA" NEW LINES AT THE END OF THE FILE.
|
||||
REM (THEY PREVENT THE SCRIPT APPENDING A NEW LINE TO THE OUTPUT.)
|
||||
REM
|
||||
REM Searches for the string "VERSION" in the version.mk
|
||||
REM file in the script's directory, %~dp0 is a reference to
|
||||
REM the script's absolute path on disk, then if found,
|
||||
REM echos "#define VERSION " and the third "token" in the found
|
||||
REM string to a file called VERSION.H in the same directory.
|
||||
REM "Tokens" are the result of taking the string input and breaking
|
||||
REM it apart at each delimiter character. The default delimiter
|
||||
REM is a space character. So as long as the version string is
|
||||
REM something like the following:
|
||||
REM VERSION <ANYTHING HERE> <WHAT IS EXTRACTED>
|
||||
REM the result from this script will be whatever is at
|
||||
REM <WHAT IS EXTRACTED>'s place in the file.
|
||||
REM Ex.
|
||||
REM Line: VERSION = "r2313"
|
||||
REM Result of the script: "r2313"
|
||||
:WORK
|
||||
FOR /F "tokens=3 delims= " %%G IN ('FINDSTR "VERSION" "%~dp0version.mk"') DO ECHO #define VERSION %%G > "%~dp0VERSION.H"
|
Loading…
x
Reference in New Issue
Block a user