summaryrefslogtreecommitdiff
path: root/src/tool
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool')
-rw-r--r--src/tool/CMakeLists.txt42
-rw-r--r--src/tool/mapcache.c4
2 files changed, 44 insertions, 2 deletions
diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt
new file mode 100644
index 000000000..e45586915
--- /dev/null
+++ b/src/tool/CMakeLists.txt
@@ -0,0 +1,42 @@
+
+#
+# mapcache
+#
+if( WITH_ZLIB )
+message( STATUS "Creating target mapcache" )
+set( COMMON_HEADERS
+ ${COMMON_MINI_HEADERS}
+ "${COMMON_SOURCE_DIR}/grfio.h"
+ "${COMMON_SOURCE_DIR}/utils.h"
+ )
+set( COMMON_SOURCES
+ ${COMMON_MINI_SOURCES}
+ "${COMMON_SOURCE_DIR}/grfio.c"
+ "${COMMON_SOURCE_DIR}/utils.c"
+ )
+set( MAPCACHE_SOURCES
+ "${CMAKE_CURRENT_SOURCE_DIR}/mapcache.c"
+ )
+set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} )
+set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} )
+set( DEFINITIONS ${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS} )
+set( SOURCE_FILES ${COMMON_HEADERS} ${COMMON_SOURCES} ${MAPCACHE_SOURCES} )
+source_group( common FILES ${COMMON_HEADERS} ${COMMON_SOURCES} )
+source_group( mapcache FILES ${MAPCACHE_SOURCES} )
+add_executable( mapcache ${SOURCE_FILES} )
+include_directories( ${INCLUDE_DIRS} )
+target_link_libraries( mapcache ${LIBRARIES} )
+set_target_properties( mapcache PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
+if( WITH_COMPONENT_RUNTIME )
+ cpack_add_component( Runtime_mapcache DESCRIPTION "mapcache generator" DISPLAY_NAME "mapcache" GROUP Runtime )
+ install( TARGETS mapcache
+ DESTINATION "."
+ COMPONENT Runtime_mapcache )
+endif()
+message( STATUS "Creating target mapcache - done" )
+set( HAVE_mapcache ON CACHE BOOL "mapcache target is available" )
+mark_as_advanced( HAVE_mapcache )
+else()
+message( STATUS "Skipping target mapcache (requires ZLIB)" )
+unset( HAVE_mapcache CACHE )
+endif()
diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c
index deec27c4c..f1a7559f1 100644
--- a/src/tool/mapcache.c
+++ b/src/tool/mapcache.c
@@ -98,7 +98,7 @@ int32 GetLong(const unsigned char* buf)
float GetFloat(const unsigned char* buf)
{
uint32 val = GetULong(buf);
- return *((float*)&val);
+ return *((float*)(void*)&val);
}
@@ -171,7 +171,7 @@ void cache_map(char *name, struct map_data *m)
len = (unsigned long)m->xs*(unsigned long)m->ys*2;
write_buf = (unsigned char *)aMalloc(len);
// Compress the cells and get the compressed length
- compress(write_buf, &len, m->cells, m->xs*m->ys);
+ encode_zip(write_buf, &len, m->cells, m->xs*m->ys);
// Fill the map header
strncpy(info.name, name, MAP_NAME_LENGTH);