Skip to content

Commit d31d635

Browse files
committed
Clean up CMakeLists.txt and remove Amiga specific locale.h guard
1 parent 743ebf5 commit d31d635

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*.save
1111
*.autosav
1212
*.autosave
13+
.DS_Store
1314

1415
# Tests
1516
/tests/Makefile

CMakeLists.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,13 @@ option(DISABLE_JSON_PATCH "Disable JSON patch (RFC6902) support."
6969
option(NEWLOCALE_NEEDS_FREELOCALE "Work around newlocale bugs in old FreeBSD by calling freelocale" OFF)
7070
option(BUILD_APPS "Default to building apps" ON)
7171

72-
if (UNIX OR MINGW OR CYGWIN OR AMIGA)
73-
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
74-
endif()
75-
7672
if (${CMAKE_SYSTEM_NAME} STREQUAL "AmigaOS")
7773
set(AMIGA ON)
7874
set(DISABLE_THREAD_LOCAL_STORAGE ON)
7975
set(ENABLE_THREADING OFF)
8076
set(BUILD_SHARED_LIBS OFF)
8177
set(BUILD_APPS OFF)
82-
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
78+
set(DISABLE_STATIC_FPIC ON)
8379
if ($ENV{CROSS_PFX} STREQUAL "m68k-amigaos")
8480
set(AMIGA_M68K ON)
8581
set(BUILD_TESTING OFF)
@@ -105,6 +101,10 @@ else()
105101
message(STATUS "Building for ${CMAKE_SYSTEM_NAME}")
106102
endif()
107103

104+
if (UNIX OR MINGW OR CYGWIN OR AMIGA)
105+
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
106+
endif()
107+
108108
if (BUILD_SHARED_LIBS)
109109
add_definitions(-D JSON_C_DLL)
110110
endif()
@@ -118,7 +118,7 @@ if (MSVC)
118118
list(APPEND CMAKE_REQUIRED_FLAGS /wd4996)
119119
endif()
120120

121-
if (NOT DISABLE_STATIC_FPIC AND NOT AMIGA)
121+
if (NOT DISABLE_STATIC_FPIC)
122122
# Use '-fPIC'/'-fPIE' option.
123123
# This will allow other libraries to statically link in libjson-c.a
124124
# 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
143143
check_include_file("dlfcn.h" HAVE_DLFCN_H)
144144
check_include_file("endian.h" HAVE_ENDIAN_H)
145145
check_include_file("limits.h" HAVE_LIMITS_H)
146-
if (NOT AMIGA_M68K)
147-
check_include_file("locale.h" HAVE_LOCALE_H)
148-
endif()
146+
check_include_file("locale.h" HAVE_LOCALE_H)
149147
check_include_file("memory.h" HAVE_MEMORY_H)
150148

151149
check_include_file(stdint.h HAVE_STDINT_H)

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,34 +282,34 @@ Install Docker on your machine if you don't already have it. You can download Do
282282
### To build for Motorola 68k Amiga:
283283

284284
```
285-
mkdir json-c-build
285+
mkdir build
286286
docker run --rm \
287287
-v ${PWD}:/work \
288288
-e USER=$( id -u ) -e GROUP=$( id -g ) \
289289
-it sacredbanana/amiga-compiler:m68k-amigaos bash
290-
cd json-c-build
290+
cd build
291291
cmake -DM68K_CRT=newlib ..
292292
make
293293
```
294294

295-
libjson-c.a will get created in the json-c-build directory.
295+
libjson-c.a will get created in the build directory.
296296

297297
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.
298298

299299
### To build for PowerPC Amiga:
300300

301301
```
302-
mkdir json-c-build
302+
mkdir build
303303
docker run --rm \
304304
-v ${PWD}:/work \
305305
-e USER=$( id -u ) -e GROUP=$( id -g ) \
306306
-it sacredbanana/amiga-compiler:ppc-amigaos bash
307-
cd json-c-build
307+
cd build
308308
cmake ..
309309
make
310310
```
311311

312-
libjson-c.a will get created in the json-c-build directory.
312+
libjson-c.a will get created in the build directory.
313313

314314
<a name="linking"></a>
315315
Linking to `libjson-c`

0 commit comments

Comments
 (0)