Ver a proveniência

- added CMAKE as default build system

- added stuff to allow crosscompiling to windows again
tags/v0.1.1-beta
Andreas Romeyke há 4 anos
ascendente
cometimento
e497598d3d
5 ficheiros alterados com 107 adições e 1 eliminações
  1. +15
    -0
      README.compile
  2. +69
    -0
      src/CMakeLists.txt
  3. +2
    -1
      src/checkit_tiff.c
  4. +12
    -0
      src/helper/check_print.c
  5. +9
    -0
      src/toolchain-mingw32.cmake

+ 15
- 0
README.compile Ver ficheiro

@@ -0,0 +1,15 @@
# You need an installed cmake
########################################################
# compiling under linux
########################################################
mkdir build
cd build
cmake ../src/
make
########################################################
# alternatively for windows crosscompiling using mingw
########################################################
#mkdir build
#cd build
#cmake -DCMAKE_TOOLCHAIN_FILE=../src/toolchain-mingw32.cmake -DTIFF_LIBRARY=~/Downloads/tiff-4.0.6/libtiff/.libs/libtiff.a -DTIFF_INCLUDE_DIR=~/Downloads/tiff-4.0.6/libtiff/ -DPCRE_LIBRARY=~/Downloads/pcre-8.37/.libs/libpcre.a -DPCRE_INCLUDE_DIR=~/Downloads/pcre-8.37/ ../src/
#make

+ 69
- 0
src/CMakeLists.txt Ver ficheiro

@@ -0,0 +1,69 @@
cmake_minimum_required (VERSION 2.6)
project (checkit_tiff)
include_directories("${PROJECT_SOURCE_DIR}/headers")

file( GLOB checkit_tiff_SOURCES
"${PROJECT_SOURCE_DIR}/tagrules/*.c"
"${PROJECT_SOURCE_DIR}/ifdrules/*.c"
"${PROJECT_SOURCE_DIR}/helper/*.c"
"${PROJECT_SOURCE_DIR}/parser/*parser.c"
)
#
# Make a version file containing the current version from git.
#
execute_process( COMMAND git rev-list HEAD --count OUTPUT_VARIABLE REPO_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE )
execute_process( COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE BUILD_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process( COMMAND git rev-parse HEAD OUTPUT_VARIABLE BUILD_REV_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process( COMMAND git describe --long --tags --dirty --always OUTPUT_VARIABLE BUILD_REV_ID_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
add_definitions(-DVERSION="${BUILD_BRANCH}")
add_definitions(-DREPO_REVISION="${REPO_REVISION}")

if(WIN32)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
SET(BUILD_SHARED_LIBRARIES OFF)
SET(CMAKE_EXE_LINKER_FLAGS "-static")
add_definitions(-DPCRE_STATIC)
add_definitions(-D_POSIX_C_SOURCE=200809L)
# FIXME: needed for MingW only
add_definitions(-D_GNU_SOURCE=1)
endif(WIN32)

add_executable(checkit_tiff checkit_tiff.c ${checkit_tiff_SOURCES})

## libtiff 4
find_package(TIFF REQUIRED)
if(TIFF_FOUND)
# Confirm required API is available
#INCLUDE(CheckFunctionExists)
SET(CMAKE_REQUIRED_LIBRARIES ${TIFF_LIBRARIES})
#CHECK_FUNCTION_EXISTS(TIFFOpen HAVE_TIFFOPEN)
#IF(NOT HAVE_TIFFOPEN)
# SET(TIFF_FOUND) # ReSET to NOT found for TIFF library
# MESSAGE(FATAL_ERROR "Failed to link with libtiff - TIFFOpen function not found")
#ENDIF()

# CHECK_FUNCTION_EXISTS(TIFFMergeFieldInfo HAVE_TIFFMERGEFIELDINFO)
#IF(NOT HAVE_TIFFMERGEFIELDINFO)
# SET(TIFF_FOUND) # ReSET to NOT found for TIFF library
# MESSAGE(FATAL_ERROR "Failed to link with libtiff - TIFFMergeFieldInfo function not found. libtiff 3.6.0 Beta or later required. Please upgrade or use an older version of libgeotiff")
#ENDIF()
INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
ADD_DEFINITIONS(-DHAVE_TIFF=1)
else(TIFF_FOUND)
MESSAGE(FATAL_ERROR "No TIFF library found, add $TIFF_INCLUDE_DIR manually")
endif(TIFF_FOUND)

#libpcre
#find_package(LIBPCRE REQUIRED)
FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h)
FIND_LIBRARY(PCRE_LIBRARY NAMES pcre)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR)
if (PCRE_FOUND)
SET(PCRE_LIBRARIES ${PCRE_LIBRARY})
SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR})
endif(PCRE_FOUND)


TARGET_LINK_LIBRARIES(checkit_tiff ${TIFF_LIBRARIES} ${PCRE_LIBRARIES})

+ 2
- 1
src/checkit_tiff.c Ver ficheiro

@@ -22,7 +22,8 @@
#include <sys/stat.h>
#include <sys/types.h>
#else
#include <sys\stat.h>
/* #include <sys\stat.h> */
#include <sys/stat.h>
#endif

#define FLAGGED 1


+ 12
- 0
src/helper/check_print.c Ver ficheiro

@@ -12,6 +12,18 @@
#include "check.h"
#include "check_helper.h"

#ifdef WIN32
static inline char *strndup(const char *s, size_t n)
{
char *result;
size_t len = strlen (s);
if (n < len) len = n;
result = (char *) malloc (len + 1);
if (!result) return 0;
result[len] = '\0';
return (char *) strncpy (result, s, len);
}
#endif

ret_t tif_fails(const char* fail_message) {
ret_t res;


+ 9
- 0
src/toolchain-mingw32.cmake Ver ficheiro

@@ -0,0 +1,9 @@
set (CMAKE_SYSTEM_NAME Windows)
set (CMAKE_C_COMPILER i686-w64-mingw32-gcc)
set (CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
set (CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# call cmake:
# cmake -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake SRCPATH

Carregando…
Cancelar
Guardar