1
- # Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
1
+ # Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
2
2
#
3
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
4
# you may not use this file except in compliance with the License.
@@ -20,34 +20,56 @@ project(mapcode_cpp)
20
20
#
21
21
# export ASAN_OPTIONS=debug=true:strict_string_checks=1:detect_stack_use_after_return=true:detect_invalid_pointer_pairs=99999:
22
22
# detect_container_overflow=true:detect_odr_violation=2:check_initialization_order=true
23
+ #
24
+ # Compiler directives (for internal use only):
25
+ #
26
+ # NO_POSIX_THREADS - No multi-threaded unit testing - only effective for unit test.
27
+ # NO_FAST_ENCODE - Drop fast encoding support - only for internal use.
28
+
29
+ set (MAPCODE_OPTIONS "" )
30
+ set (MAPCODE_WARNING_OPTIONS "-Wall -Werror" )
31
+ set (MAPCODE_SANITIZER_COMPILER_OPTIONS "-fsanitize=address -fno-common -fno-optimize-sibling-calls -fno-omit-frame-pointer" )
32
+ set (MAPCODE_SANITIZER_LINKER_OPTIONS "-fsanitize=address" )
33
+
34
+ set (CMAKE_C_FLAGS_DEBUG "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O0 -g -DDEBUG" )
35
+ set (CMAKE_C_FLAGS_RELWITHDEBINFO "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O2 -g -DNDEBUG" )
36
+ set (CMAKE_C_FLAGS_RELEASE "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} -O3 -DNDEBUG" )
37
+
38
+ set (CMAKE_CXX_FLAGS_DEBUG "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O0 -g -DDEBUG -std=c++11" )
39
+ set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O2 -g -DNDEBUG -std=c++11" )
40
+ set (CMAKE_CXX_FLAGS_RELEASE "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} -O3 -DNDEBUG -std=c++11" )
41
+
42
+ set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${MAPCODE_SANITIZER_LINKER_OPTIONS} " )
43
+ set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${MAPCODE_SANITIZER_LINKER_OPTIONS} " )
44
+ set (CMAKE_EXE_LINKER_FLAGS_RELEASE "" )
23
45
24
- set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Werror -fsanitize=address -fno-common -fno-optimize-sibling-calls -fno-omit-frame-pointer" )
25
- set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11" )
26
- set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address" )
27
-
28
- set (SOURCE_FILES
29
- mapcodelib/basics.h
30
- mapcodelib/mapcode_alphabets.h
31
- mapcodelib/mapcode_countrynames.h
32
- mapcodelib/mapcode_countrynames_short.h
33
- mapcodelib/mapcode_fast_encode.h
34
- mapcodelib/mapcode_fastalpha.h
35
- mapcodelib/mapcode_territory_alphabets.h
36
- mapcodelib/mapcoder.c
37
- mapcodelib/mapcoder.h
38
- unittest/decode_test.h
39
- unittest/test_territories.c
40
- unittest/unittest.c
41
- utility/mapcode.cpp )
46
+ set (SOURCE_FILES_MAPCODELIB
47
+ mapcodelib/internal_data.h
48
+ mapcodelib/internal_alphabet_recognizer.h
49
+ mapcodelib/internal_iso3166_data.h
50
+ mapcodelib/internal_territory_alphabets.h
51
+ mapcodelib/internal_territory_names_english.h
52
+ mapcodelib/internal_territory_names_local.h
53
+ mapcodelib/internal_territory_search.h
54
+ mapcodelib/mapcode_alphabets.h
55
+ mapcodelib/mapcode_legacy.c
56
+ mapcodelib/mapcode_legacy.h
57
+ mapcodelib/mapcode_territories.h
58
+ mapcodelib/mapcoder.c
59
+ mapcodelib/mapcoder.h )
42
60
43
61
set (SOURCE_FILES_UNITTEST
62
+ unittest/decode_test.h
44
63
unittest/unittest.c )
45
64
46
65
set (SOURCE_FILES_UTILITY
47
66
utility/mapcode.cpp )
48
67
49
- add_executable (fullset ${SOURCE_FILES} )
68
+ add_library (mapcodelib ${SOURCE_FILES_MAPCODELIB} )
69
+ target_include_directories (mapcodelib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
50
70
51
71
add_executable (unittest ${SOURCE_FILES_UNITTEST} )
72
+ target_link_libraries (unittest LINK_PUBLIC mapcodelib )
52
73
53
74
add_executable (mapcode ${SOURCE_FILES_UTILITY} )
75
+ target_link_libraries (mapcode LINK_PUBLIC mapcodelib )
0 commit comments