Clean up CMakeLists.txt and remove Amiga specific locale.h guard
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,6 +10,7 @@
|
|||||||
*.save
|
*.save
|
||||||
*.autosav
|
*.autosav
|
||||||
*.autosave
|
*.autosave
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
/tests/Makefile
|
/tests/Makefile
|
||||||
|
|||||||
@@ -69,17 +69,13 @@ option(DISABLE_JSON_PATCH "Disable JSON patch (RFC6902) support."
|
|||||||
option(NEWLOCALE_NEEDS_FREELOCALE "Work around newlocale bugs in old FreeBSD by calling freelocale" OFF)
|
option(NEWLOCALE_NEEDS_FREELOCALE "Work around newlocale bugs in old FreeBSD by calling freelocale" OFF)
|
||||||
option(BUILD_APPS "Default to building apps" ON)
|
option(BUILD_APPS "Default to building apps" ON)
|
||||||
|
|
||||||
if (UNIX OR MINGW OR CYGWIN OR AMIGA)
|
|
||||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "AmigaOS")
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "AmigaOS")
|
||||||
set(AMIGA ON)
|
set(AMIGA ON)
|
||||||
set(DISABLE_THREAD_LOCAL_STORAGE ON)
|
set(DISABLE_THREAD_LOCAL_STORAGE ON)
|
||||||
set(ENABLE_THREADING OFF)
|
set(ENABLE_THREADING OFF)
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
set(BUILD_APPS OFF)
|
set(BUILD_APPS OFF)
|
||||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
|
set(DISABLE_STATIC_FPIC ON)
|
||||||
if ($ENV{CROSS_PFX} STREQUAL "m68k-amigaos")
|
if ($ENV{CROSS_PFX} STREQUAL "m68k-amigaos")
|
||||||
set(AMIGA_M68K ON)
|
set(AMIGA_M68K ON)
|
||||||
set(BUILD_TESTING OFF)
|
set(BUILD_TESTING OFF)
|
||||||
@@ -105,6 +101,10 @@ else()
|
|||||||
message(STATUS "Building for ${CMAKE_SYSTEM_NAME}")
|
message(STATUS "Building for ${CMAKE_SYSTEM_NAME}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (UNIX OR MINGW OR CYGWIN OR AMIGA)
|
||||||
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
add_definitions(-D JSON_C_DLL)
|
add_definitions(-D JSON_C_DLL)
|
||||||
endif()
|
endif()
|
||||||
@@ -118,7 +118,7 @@ if (MSVC)
|
|||||||
list(APPEND CMAKE_REQUIRED_FLAGS /wd4996)
|
list(APPEND CMAKE_REQUIRED_FLAGS /wd4996)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT DISABLE_STATIC_FPIC AND NOT AMIGA)
|
if (NOT DISABLE_STATIC_FPIC)
|
||||||
# Use '-fPIC'/'-fPIE' option.
|
# Use '-fPIC'/'-fPIE' option.
|
||||||
# This will allow other libraries to statically link in libjson-c.a
|
# This will allow other libraries to statically link in libjson-c.a
|
||||||
# which in turn prevents crashes in downstream apps that may use
|
# which in turn prevents crashes in downstream apps that may use
|
||||||
@@ -143,9 +143,7 @@ check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) # for getrusage
|
|||||||
check_include_file("dlfcn.h" HAVE_DLFCN_H)
|
check_include_file("dlfcn.h" HAVE_DLFCN_H)
|
||||||
check_include_file("endian.h" HAVE_ENDIAN_H)
|
check_include_file("endian.h" HAVE_ENDIAN_H)
|
||||||
check_include_file("limits.h" HAVE_LIMITS_H)
|
check_include_file("limits.h" HAVE_LIMITS_H)
|
||||||
if (NOT AMIGA_M68K)
|
check_include_file("locale.h" HAVE_LOCALE_H)
|
||||||
check_include_file("locale.h" HAVE_LOCALE_H)
|
|
||||||
endif()
|
|
||||||
check_include_file("memory.h" HAVE_MEMORY_H)
|
check_include_file("memory.h" HAVE_MEMORY_H)
|
||||||
|
|
||||||
check_include_file(stdint.h HAVE_STDINT_H)
|
check_include_file(stdint.h HAVE_STDINT_H)
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -282,34 +282,34 @@ Install Docker on your machine if you don't already have it. You can download Do
|
|||||||
### To build for Motorola 68k Amiga:
|
### To build for Motorola 68k Amiga:
|
||||||
|
|
||||||
```
|
```
|
||||||
mkdir json-c-build
|
mkdir build
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v ${PWD}:/work \
|
-v ${PWD}:/work \
|
||||||
-e USER=$( id -u ) -e GROUP=$( id -g ) \
|
-e USER=$( id -u ) -e GROUP=$( id -g ) \
|
||||||
-it sacredbanana/amiga-compiler:m68k-amigaos bash
|
-it sacredbanana/amiga-compiler:m68k-amigaos bash
|
||||||
cd json-c-build
|
cd build
|
||||||
cmake -DM68K_CRT=newlib ..
|
cmake -DM68K_CRT=newlib ..
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
libjson-c.a will get created in the json-c-build directory.
|
libjson-c.a will get created in the build directory.
|
||||||
|
|
||||||
You can change newlib to nix20, nix13 or clib2 if you would like to build the library suited for libnix or clib2 instead. Newlib is default.
|
You can change newlib to nix20, nix13 or clib2 if you would like to build the library suited for libnix or clib2 instead. Newlib is default.
|
||||||
|
|
||||||
### To build for PowerPC Amiga:
|
### To build for PowerPC Amiga:
|
||||||
|
|
||||||
```
|
```
|
||||||
mkdir json-c-build
|
mkdir build
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v ${PWD}:/work \
|
-v ${PWD}:/work \
|
||||||
-e USER=$( id -u ) -e GROUP=$( id -g ) \
|
-e USER=$( id -u ) -e GROUP=$( id -g ) \
|
||||||
-it sacredbanana/amiga-compiler:ppc-amigaos bash
|
-it sacredbanana/amiga-compiler:ppc-amigaos bash
|
||||||
cd json-c-build
|
cd build
|
||||||
cmake ..
|
cmake ..
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
libjson-c.a will get created in the json-c-build directory.
|
libjson-c.a will get created in the build directory.
|
||||||
|
|
||||||
<a name="linking"></a>
|
<a name="linking"></a>
|
||||||
Linking to `libjson-c`
|
Linking to `libjson-c`
|
||||||
|
|||||||
Reference in New Issue
Block a user