Browse Source

- updated info/target for static compiled binaries

tags/v0.6.0^2
Andreas Romeyke 3 months ago
parent
commit
4f8142e702
2 changed files with 17 additions and 8 deletions
  1. +2
    -2
      README.compile
  2. +15
    -6
      src/CMakeLists.txt

+ 2
- 2
README.compile View File

@@ -5,7 +5,7 @@
########################################################
mkdir build
cd build
cmake ../src/ -DCMAKE_C_FLAGS="-W -Wall -Wextra -ansi -pedantic -O3 -Wno-unused-function -fstack-check -fstack-protector-strong -Wformat -Werror=format-security"
cmake ../src/ -DCMAKE_C_FLAGS="-W -Wall -Wextra -ansi -pedantic -O3 -flto -Wno-unused-function -fstack-check -fstack-protector-strong -Wformat -Werror=format-security"
make
###
# if you want to allow preferred CMM type "LINO", you should use the cmake-call
@@ -45,7 +45,7 @@ make
# example STATIC options
########################################################
#
# cmake ../src/ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc" -DCMAKE_FIND_LIBRARY_SUFFIXES=".a" -DPCRE_LIBRARY=/usr/lib/x86_64-linux-gnu/libpcre.a
# cmake ../src/ -DSTATIC=1 -DCMAKE_C_FLAGS="-O3 -s -flto -Wno-unused-function -fstack-check -fstack-protector-strong -Wformat -Werror=format-security"
#
########################################################
# example CLANG-TIDY


+ 15
- 6
src/CMakeLists.txt View File

@@ -7,7 +7,7 @@ include (CheckFunctionExists)
include(CheckIPOSupported)


file( GLOB checkit_tiff_SOURCES
file( GLOB checkit_tiff_SOURCES
"${PROJECT_SOURCE_DIR}/tagrules/*.c"
"${PROJECT_SOURCE_DIR}/ifdrules/*.c"
"${PROJECT_SOURCE_DIR}/messages/*.c"
@@ -45,6 +45,7 @@ else()
message(STATUS "IPO / LTO unsupported: <${LTO_CHECK_ERROR}>")
endif()


# add default CFLAGS
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong -Wformat -Werror=format-security")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -fPIE")
@@ -71,6 +72,12 @@ if(WIN32)
# FIXME: needed for MingW only
add_definitions(-D_GNU_SOURCE=1)
endif(WIN32)
if(STATIC)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
SET(BUILD_SHARED_LIBRARIES OFF)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
add_definitions(-DPCRE_STATIC)
endif(STATIC)

add_executable(checkit_tiff checkit_tiff.c ${checkit_tiff_SOURCES})
add_executable(checkit_check_config checkit_check_config.c ${checkit_tiff_SOURCES})
@@ -78,6 +85,7 @@ add_executable(checkit_tiff_risk checkit_tiff_risk.c ${checkit_tiff_risk_SOURCES
set(CMAKE_EXTRA_INCLUDE_FILES tiff.h)



#libpcre
#find_package(LIBPCRE REQUIRED)
FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h)
@@ -86,6 +94,9 @@ INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR)
if (PCRE_FOUND)
SET(PCRE_LIBRARIES ${PCRE_LIBRARY})
if (STATIC)
SET(PCRE_LIBRARIES ${PCRE_LIBRARIES} -lpthread)
endif(STATIC)
SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR})
else(PCRE_FOUND)
@@ -101,7 +112,6 @@ IF(_HAVE_MMAP AND _HAVE_MUNMAP)
ENDIF()



TARGET_LINK_LIBRARIES(checkit_tiff ${PCRE_LIBRARIES})
TARGET_LINK_LIBRARIES(checkit_check_config ${PCRE_LIBRARIES})
TARGET_LINK_LIBRARIES(checkit_tiff_risk)
@@ -110,10 +120,10 @@ install( TARGETS checkit_tiff
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
)
install(DIRECTORY
install(DIRECTORY
../example_configs
../tiffs_should_fail
../tiffs_should_pass
../tiffs_should_pass
DESTINATION share/checkit_tiff/
)

@@ -121,10 +131,9 @@ file( GLOB README_FILES "../README*" "../FAQ" "../LICENSE" "../TODO" "../BUGS")
install(FILES ${README_FILES} DESTINATION share/checkit_tiff/)

INCLUDE(FindPerl)
if (PERL_FOUND)
if (PERL_FOUND)
enable_testing()
SET(T_DIR ${PROJECT_SOURCE_DIR}/../t )

add_test(NAME grammar COMMAND ${PERL_EXECUTABLE} -I ${T_DIR} test_grammar.t WORKING_DIRECTORY ${T_DIR} )
add_test(NAME config COMMAND ${PERL_EXECUTABLE} -I ${T_DIR} test_config_examples.t WORKING_DIRECTORY ${T_DIR} )
add_test(NAME validfiles COMMAND ${PERL_EXECUTABLE} -I ${T_DIR} test_should_pass.t WORKING_DIRECTORY ${T_DIR} )


Loading…
Cancel
Save