Skip to content

Commit

Permalink
Merge pull request #27 from mapcode-foundation/dev
Browse files Browse the repository at this point in the history
Release 2.5.0
  • Loading branch information
rijnb authored Nov 1, 2016
2 parents b5c28bf + 6ee3f95 commit f32f39e
Show file tree
Hide file tree
Showing 40 changed files with 41,973 additions and 39,601 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
unittest/gmon.out
unittest/_*.txt

# -----------------------------------------------------------------------------
# Compiled sources
# -----------------------------------------------------------------------------
Expand Down
62 changes: 42 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
# Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -20,34 +20,56 @@ project(mapcode_cpp)
#
# export ASAN_OPTIONS=debug=true:strict_string_checks=1:detect_stack_use_after_return=true:detect_invalid_pointer_pairs=99999:
# detect_container_overflow=true:detect_odr_violation=2:check_initialization_order=true
#
# Compiler directives (for internal use only):
#
# NO_POSIX_THREADS - No multi-threaded unit testing - only effective for unit test.
# NO_FAST_ENCODE - Drop fast encoding support - only for internal use.

set(MAPCODE_OPTIONS "")
set(MAPCODE_WARNING_OPTIONS "-Wall -Werror")
set(MAPCODE_SANITIZER_COMPILER_OPTIONS "-fsanitize=address -fno-common -fno-optimize-sibling-calls -fno-omit-frame-pointer")
set(MAPCODE_SANITIZER_LINKER_OPTIONS "-fsanitize=address")

set(CMAKE_C_FLAGS_DEBUG "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O0 -g -DDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O2 -g -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} -O3 -DNDEBUG")

set(CMAKE_CXX_FLAGS_DEBUG "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O0 -g -DDEBUG -std=c++11")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O2 -g -DNDEBUG -std=c++11")
set(CMAKE_CXX_FLAGS_RELEASE "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} -O3 -DNDEBUG -std=c++11")

set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${MAPCODE_SANITIZER_LINKER_OPTIONS}")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${MAPCODE_SANITIZER_LINKER_OPTIONS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Werror -fsanitize=address -fno-common -fno-optimize-sibling-calls -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address")

set(SOURCE_FILES
mapcodelib/basics.h
mapcodelib/mapcode_alphabets.h
mapcodelib/mapcode_countrynames.h
mapcodelib/mapcode_countrynames_short.h
mapcodelib/mapcode_fast_encode.h
mapcodelib/mapcode_fastalpha.h
mapcodelib/mapcode_territory_alphabets.h
mapcodelib/mapcoder.c
mapcodelib/mapcoder.h
unittest/decode_test.h
unittest/test_territories.c
unittest/unittest.c
utility/mapcode.cpp)
set(SOURCE_FILES_MAPCODELIB
mapcodelib/internal_data.h
mapcodelib/internal_alphabet_recognizer.h
mapcodelib/internal_iso3166_data.h
mapcodelib/internal_territory_alphabets.h
mapcodelib/internal_territory_names_english.h
mapcodelib/internal_territory_names_local.h
mapcodelib/internal_territory_search.h
mapcodelib/mapcode_alphabets.h
mapcodelib/mapcode_legacy.c
mapcodelib/mapcode_legacy.h
mapcodelib/mapcode_territories.h
mapcodelib/mapcoder.c
mapcodelib/mapcoder.h)

set(SOURCE_FILES_UNITTEST
unittest/decode_test.h
unittest/unittest.c)

set(SOURCE_FILES_UTILITY
utility/mapcode.cpp)

add_executable(fullset ${SOURCE_FILES})
add_library(mapcodelib ${SOURCE_FILES_MAPCODELIB})
target_include_directories(mapcodelib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(unittest ${SOURCE_FILES_UNITTEST})
target_link_libraries(unittest LINK_PUBLIC mapcodelib)

add_executable(mapcode ${SOURCE_FILES_UTILITY})
target_link_libraries(mapcode LINK_PUBLIC mapcodelib)
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Original C library created by Pieter Geelen. Work on Java version
of the Mapcode library by Rijn Buve (original port by Matthew Lowden).

Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
43 changes: 33 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

**Latest stable release: https://github.com/mapcode-foundation/mapcode-cpp/releases**

# The C/C++ Library: `mapcodelib/`
## The C/C++ Library: `mapcodelib/`

The directory 'mapcodelib' contains the files:

Expand Down Expand Up @@ -45,7 +45,7 @@ In that case, basics.h will state a version number of the for:
where "xxx" states the geographical limitation.


# A Real-Life Example, The 'mapcode' Codec Tool: `utility/`
## A Real-Life Example, The 'mapcode' Codec Tool: `utility/`

The directory 'utility' contains a Mapcode encoding/decoding utility, as an example
of how to use the library.
Expand All @@ -61,8 +61,8 @@ decode Mapcodes.

This produces the following help text:

MAPCODE (version 2.4.0)
Copyright (C) 2014-2015 Stichting Mapcode Foundation
MAPCODE (version 2.4.1)
Copyright (C) 2014-2016 Stichting Mapcode Foundation

Usage:
./mapcode [-d| --decode] <default-territory> <mapcode> [<mapcode> ...]
Expand Down Expand Up @@ -121,15 +121,38 @@ This produces the following help text:
The result code is 0 when no error occurred, 1 if an input error occurred and 2
if an internal error occurred.

If you use **Microsoft Visual C++**, you may need to add the following defines to your preprocessor
settings:
## Compile Options for Microsoft Visual C++

NO_POSIX_THREADS
_CRT_SECURE_NO_WARNINGS
_CRT_NONSTDC_NO_DEPRECATE
If you use **Microsoft Visual C++**, you may need to add the following compiler directives to your build:

-DNO_POSIX_THREADS
-D_CRT_SECURE_NO_WARNINGS
-D_CRT_NONSTDC_NO_DEPRECATE

# Release Notes
## Reducing the Footprint of the Mapcode Library

The Mapcode C/C++ Library has includes a number of fixed data tables, which increase its footprint.
You may not require all of this data, so we've added some options for you to be able to reduce its
footprint, for example for embedded applications.

## Release Notes

### 2.5.0

* Added support for getting territory names in English and local alphabets.

* Added much improved unit test scripts to run `gprof`, `valgrind`, the CLang address sanitize
and compare the output of the new library with and older version.

### 2.4.1

* Renamed `.h` files to `internal_*.h` unless they are relevant to the interface.

* Turned territories, alphabets and error codes into enums.

* Split off legacy stuff into `mapcode_legacy.h`.

* Added `convertUtf8ToUtf16`, `convertUtf16ToUtf8`, `recognizeAlphabetUtf8`, `recogniseAlphabetUtf16`.

### 2.4.0

Expand Down
Binary file modified docs/mapcode_library_c.docx
Binary file not shown.
Binary file modified docs/mapcode_library_c.pdf
Binary file not shown.
Loading

0 comments on commit f32f39e

Please sign in to comment.