Browse Source

Merge pull request #171 from Nzbuu/vs2010_build

Update configuration for VS2010 and win64
tags/json-c-0.13-20171207
Eric Haszlakiewicz 10 years ago
parent
commit
e4fce5d6ae
12 changed files with 141 additions and 70 deletions
  1. +2
    -0
      .gitignore
  2. +3
    -0
      config.h.in
  3. +21
    -13
      config.h.win32
  4. +75
    -26
      json-c.vcxproj
  5. +15
    -6
      json-c.vcxproj.filters
  6. +2
    -0
      json_config.h.win32
  7. +6
    -15
      json_inttypes.h
  8. +3
    -3
      json_object.c
  9. +2
    -1
      json_tokener.c
  10. +3
    -1
      linkhash.c
  11. +8
    -5
      math_compat.h
  12. +1
    -0
      random_seed.c

+ 2
- 0
.gitignore View File

@@ -49,6 +49,8 @@
/tests/*.trs
/Debug
/Release
/*/Debug
/*/Release
*.lo
*.o
/libjson-c.la


+ 3
- 0
config.h.in View File

@@ -134,6 +134,9 @@
*/
#undef LT_OBJDIR

/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O

/* Name of package */
#undef PACKAGE



+ 21
- 13
config.h.win32 View File

@@ -8,35 +8,43 @@
/* Define to 1 if you have the declaration of `INFINITY', and to 0 if you
don't. */
#if defined(_MSC_VER) && _MSC_VER >= 1800
#define HAVE_DECL_INFINITY 1
#endif
/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't.
*/
#if defined(_MSC_VER) && _MSC_VER >= 1800
#define HAVE_DECL_ISINF 1
#endif
/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.
*/
#if defined(_MSC_VER) && _MSC_VER >= 1800
#define HAVE_DECL_ISNAN 1
#endif
/* Define to 1 if you have the declaration of `nan', and to 0 if you don't. */
#if defined(_MSC_VER) && _MSC_VER >= 1800
#define HAVE_DECL_NAN 1
#endif
/* Define to 1 if you have the declaration of `_finite', and to 0 if you
don't. */
#define HAVE_DECL__FINITE 0
#define HAVE_DECL__FINITE 1
/* Define to 1 if you have the declaration of `_isnan', and to 0 if you don't.
*/
#define HAVE_DECL__ISNAN 0
#define HAVE_DECL__ISNAN 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
#define HAVE_DLFCN_H 1
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
#define HAVE_DOPRNT 1
/* Define to 1 if you have the <endian.h> header file. */
#define HAVE_ENDIAN_H 1
#undef HAVE_ENDIAN_H
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
@@ -58,7 +66,7 @@
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `open' function. */
#undef HAVE_OPEN
#define HAVE_OPEN 1
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
@@ -95,13 +103,13 @@
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strncasecmp' function. */
#define HAVE_STRNCASECMP 1
#undef HAVE_STRNCASECMP
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/cdefs.h> header file. */
#undef HAVE_SYS_CDEFS_H
#define HAVE_SYS_CDEFS_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
@@ -119,21 +127,21 @@
#undef HAVE_VASPRINTF
/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF
#define HAVE_VPRINTF 1
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
#define HAVE_VSNPRINTF 1
/* Define to 1 if you have the `vsyslog' function. */
#undef HAVE_VSYSLOG
/* Public define for json_inttypes.h */
#define JSON_C_HAVE_INTTYPES_H 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Name of package */
#define PACKAGE "json-c"


+ 75
- 26
json-c.vcxproj View File

@@ -1,26 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{04D8CDBE-FB3E-4362-87E6-07DC3C0083B2}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>jsonc</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
@@ -28,60 +46,88 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>12.0.30324.0</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>Debug\</OutDir>
<IntDir>Debug\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>Release\</OutDir>
<IntDir>Release\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<PreBuildEvent>
<Command>copy config.h.win32 config.h
copy json_config.h.win32 json_config.h
</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>copy config.h from Windows template instead of calling configure</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)json-c.lib</OutputFile>
</Lib>
<PreBuildEvent>
<Command>copy config.h.win32 config.h
copy json_config.h.win32 json_config.h
</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>copy config.h from Windows template instead of calling configure</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<PreBuildEvent>
<Command>copy config.h.win32 config.h
copy json_config.h.win32 json_config.h
</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>copy config.h from Windows template instead of calling configure</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)json-c.lib</OutputFile>
</Lib>
<PreBuildEvent>
<Command>copy config.h.win32 config.h
copy json_config.h.win32 json_config.h
</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>copy config.h from Windows template instead of calling configure</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="arraylist.c" />
@@ -91,17 +137,20 @@ copy json_config.h.win32 json_config.h
<ClCompile Include="json_util.c" />
<ClCompile Include="linkhash.c" />
<ClCompile Include="printbuf.c" />
<ClCompile Include="random_seed.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="arraylist.h" />
<ClInclude Include="bits.h" />
<ClInclude Include="debug.h" />
<ClInclude Include="json_inttypes.h" />
<ClInclude Include="json_object.h" />
<ClInclude Include="json_object_private.h" />
<ClInclude Include="json_tokener.h" />
<ClInclude Include="json_util.h" />
<ClInclude Include="linkhash.h" />
<ClInclude Include="math_compat.h" />
<ClInclude Include="printbuf.h" />
<ClInclude Include="random_seed.h" />
</ItemGroup>
<ItemGroup>
<None Include="config.h.win32" />


+ 15
- 6
json-c.vcxproj.filters View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
@@ -14,7 +14,7 @@
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
</Filter>
<Filter Include="Documentation">
<UniqueIdentifier>{d3849076-874e-490e-858c-0871d04d1ecb}</UniqueIdentifier>
<UniqueIdentifier>{8c5a59ed-4639-4361-9b7c-ecdcd09b953c}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
@@ -39,14 +39,14 @@
<ClCompile Include="printbuf.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="random_seed.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="arraylist.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bits.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="debug.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -68,14 +68,23 @@
<ClInclude Include="printbuf.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="json_inttypes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="math_compat.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="random_seed.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Doxyfile">
<Filter>Documentation</Filter>
</None>
<None Include="config.h.win32" />
<None Include="json_config.h.win32" />
<None Include="README-WIN32.html" />
<None Include="README.html" />
<None Include="json_config.h.win32" />
</ItemGroup>
</Project>

+ 2
- 0
json_config.h.win32 View File

@@ -1,3 +1,5 @@

/* Define to 1 if you have the <inttypes.h> header file. */
#if defined(_MSC_VER) && _MSC_VER >= 1800
#define JSON_C_HAVE_INTTYPES_H 1
#endif

+ 6
- 15
json_inttypes.h View File

@@ -4,24 +4,15 @@

#include "json_config.h"

#if defined(_MSC_VER) && _MSC_VER <= 1700

/* Anything less than Visual Studio C++ 10 is missing stdint.h and inttypes.h */
typedef __int32 int32_t;
#define INT32_MIN ((int32_t)_I32_MIN)
#define INT32_MAX ((int32_t)_I32_MAX)
typedef __int64 int64_t;
#define INT64_MIN ((int64_t)_I64_MIN)
#define INT64_MAX ((int64_t)_I64_MAX)
#define PRId64 "I64d"
#define SCNd64 "I64d"
#ifdef JSON_C_HAVE_INTTYPES_H
/* inttypes.h includes stdint.h */
#include <inttypes.h>

#else
#include <stdint.h>

#ifdef JSON_C_HAVE_INTTYPES_H
#include <inttypes.h>
#endif
/* inttypes.h includes stdint.h */
#define PRId64 "I64d"
#define SCNd64 "I64d"

#endif



+ 3
- 3
json_object.c View File

@@ -409,7 +409,7 @@ void json_object_object_add(struct json_object* jso, const char *key,
lh_table_insert(jso->o.c_object, strdup(key), val);
return;
}
existing_value = (void *)existing_entry->v;
existing_value = (json_object *)existing_entry->v;
if (existing_value)
json_object_put(existing_value);
existing_entry->v = val;
@@ -661,8 +661,8 @@ struct json_object* json_object_new_double_s(double d, const char *ds)
int json_object_userdata_to_json_string(struct json_object *jso,
struct printbuf *pb, int level, int flags)
{
int userdata_len = strlen(jso->_userdata);
printbuf_memappend(pb, jso->_userdata, userdata_len);
int userdata_len = strlen((const char *)jso->_userdata);
printbuf_memappend(pb, (const char *)jso->_userdata, userdata_len);
return userdata_len;
}



+ 2
- 1
json_tokener.c View File

@@ -16,6 +16,7 @@
#include "config.h"

#include <math.h>
#include "math_compat.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@@ -353,7 +354,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,

case json_tokener_state_inf: /* aka starts with 'i' */
{
int size_inf;
size_t size_inf;
int is_negative = 0;

printbuf_memappend_fast(tok->pb, &c, 1);


+ 3
- 1
linkhash.c View File

@@ -10,6 +10,8 @@
*
*/

#include "config.h"

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -413,7 +415,7 @@ unsigned long lh_char_hash(const void *k)
#if defined __GNUC__
__sync_val_compare_and_swap(&random_seed, -1, seed);
#elif defined _MSC_VER
InterlockedCompareExchange(&random_seed, seed, -1);
InterlockedCompareExchange((LONG *)&random_seed, seed, -1);
#else
#warning "racy random seed initializtion if used by multiple threads"
random_seed = seed; /* potentially racy */


+ 8
- 5
math_compat.h View File

@@ -1,7 +1,7 @@
#ifndef __math_compat_h
#define __math_compat_h

/* Define isnan and isinf on Windows/MSVC */
/* Define isnan, isinf, infinity and nan on Windows/MSVC */

#ifndef HAVE_DECL_ISNAN
# ifdef HAVE_DECL__ISNAN
@@ -17,12 +17,15 @@
# endif
#endif

#ifndef HAVE_DECL_NAN
#error This platform does not have nan()
#ifndef HAVE_DECL_INFINITY
#include <float.h>
#define INFINITY (DBL_MAX + DBL_MAX)
#define HAVE_DECL_INFINITY
#endif

#ifndef HAVE_DECL_INFINITY
#error This platform does not have INFINITY
#ifndef HAVE_DECL_NAN
#define NAN (INFINITY - INFINITY)
#define HAVE_DECL_NAN
#endif

#endif

+ 1
- 0
random_seed.c View File

@@ -11,6 +11,7 @@

#include <stdio.h>
#include "config.h"
#include "random_seed.h"

#define DEBUG_SEED(s)



Loading…
Cancel
Save