Add CMake build system.

This commit is contained in:
Micah Snyder 2019-06-09 01:24:10 -04:00
parent ad723d6558
commit e264a7f7c4
12 changed files with 702 additions and 4 deletions

22
.gitignore vendored
View File

@ -27,3 +27,25 @@ manual.*
missing
tests/*.rb2
tests/*.tst
# cmake
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
install_manifest.txt
CTestTestfile.cmake
build.ninja
rules.ninja
.ninja_deps
.ninja_log
lib*.dylib
lib*.so
lib*.so.*
lib*.a
# example build directories
build
builddir
# vscode config directory
.vscode

View File

@ -41,6 +41,20 @@ stages:
paths:
- 'meson-log.txt'
.cmake_test:
stage: test
script:
- mkdir builddir && cd builddir
- cmake ..
- cmake --build . --config Release
- make check
after_script:
- cp builddir/CMakeFiles/CMakeOutput.log .
- rm -rf builddir
artifacts:
paths:
- 'CMakeOutput.log'
debian:testing:
extends: '.meson_test'
image: $AMD64_DEBIAN_TESTING
@ -55,6 +69,23 @@ ubuntu:bionic:autotools:
- apt update -y
- apt install -y gcc make automake libtool
ubuntu:bionic:cmake:
extends: '.cmake_test'
image: $AMD64_UBUNTU_BIONIC
before_script:
- apt update -y
- apt install -y gcc make python3-pip xmltex xsltproc
- version=3.14
- build=5
- mkdir ~/temp
- cd ~/temp
- wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
- tar -xzvf cmake-$version.$build.tar.gz
- cd cmake-$version.$build/
- ./bootstrap --prefix=/usr
- make -j4
- make install
ubuntu:bionic:meson:
extends: '.meson_test'
image: $AMD64_UBUNTU_BIONIC

364
CMakeLists.txt Normal file
View File

@ -0,0 +1,364 @@
cmake_minimum_required(VERSION 3.12)
project(bzip2
VERSION 1.0.7
DESCRIPTION "This Bzip2/libbz2 a program and library for lossless block-sorting data compression.")
# See versioning rule:
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
set(LT_CURRENT 1)
set(LT_REVISION 6)
set(LT_AGE 0)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
include(Version)
math(EXPR LT_SOVERSION "${LT_CURRENT} - ${LT_AGE}")
set(LT_VERSION "${LT_SOVERSION}.${LT_AGE}.${LT_REVISION}")
set(PACKAGE_VERSION "${PROJECT_VERSION}")
HexVersion(PACKAGE_VERSION_NUM ${PROJECT_VERSION_MAJOR} ${PROJECT_VERSION_MINOR} ${PROJECT_VERSION_PATCH})
set(ENABLE_APP_DEFAULT ON)
set(ENABLE_EXAMPLES_DEFAULT OFF)
set(ENABLE_DOCS_DEFAULT OFF)
include(CMakeOptions.txt)
if(ENABLE_LIB_ONLY AND (ENABLE_APP OR ENABLE_EXAMPLES))
# Remember when disabled options are disabled for later diagnostics.
set(ENABLE_LIB_ONLY_DISABLED_OTHERS 1)
else()
set(ENABLE_LIB_ONLY_DISABLED_OTHERS 0)
endif()
if(ENABLE_LIB_ONLY)
set(ENABLE_APP OFF)
set(ENABLE_EXAMPLES OFF)
endif()
# Do not disable assertions based on CMAKE_BUILD_TYPE.
foreach(_build_type "Release" "MinSizeRel" "RelWithDebInfo")
foreach(_lang C CXX)
string(TOUPPER "CMAKE_${_lang}_FLAGS_${_build_type}" _var)
string(REGEX REPLACE "(^|)[/-]D *NDEBUG($|)" " " ${_var} "${${_var}}")
endforeach()
endforeach()
# Support the latest c++ standard available.
include(ExtractValidFlags)
foreach(_cxx1x_flag -std=c++14 -std=c++11)
extract_valid_cxx_flags(_cxx1x_flag_supported ${_cxx1x_flag})
if(_cxx1x_flag_supported)
set(CXX1XCXXFLAGS ${_cxx1x_flag})
break()
endif()
endforeach()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the build type" FORCE)
# Include "None" as option to disable any additional (optimization) flags,
# relying on just CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (which are empty by
# default). These strings are presented in cmake-gui.
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"None" "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
include(GNUInstallDirs)
# For test scripts and documentation
find_package(Python3)
# Always use '-fPIC'/'-fPIE' option.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Checks for header files.
include(CheckIncludeFile)
check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
check_include_file("fcntl.h" HAVE_FCNTL_H)
check_include_file("inttypes.h" HAVE_INTTYPES_H)
check_include_file("limits.h" HAVE_LIMITS_H)
check_include_file("netdb.h" HAVE_NETDB_H)
check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
check_include_file("pwd.h" HAVE_PWD_H)
check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H)
check_include_file("sys/time.h" HAVE_SYS_TIME_H)
check_include_file("syslog.h" HAVE_SYSLOG_H)
check_include_file("time.h" HAVE_TIME_H)
check_include_file("unistd.h" HAVE_UNISTD_H)
include(CheckTypeSize)
# Checks for typedefs, structures, and compiler characteristics.
# AC_TYPE_SIZE_T
check_type_size("ssize_t" SIZEOF_SSIZE_T)
if(SIZEOF_SSIZE_T STREQUAL "")
# ssize_t is a signed type in POSIX storing at least -1.
# Set it to "int" to match the behavior of AC_TYPE_SSIZE_T (autotools).
set(ssize_t int)
endif()
include(CheckStructHasMember)
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_STRUCT_TM_TM_GMTOFF)
# Check size of pointer to decide we need 8 bytes alignment adjustment.
check_type_size("int *" SIZEOF_INT_P)
check_type_size("time_t" SIZEOF_TIME_T)
# Checks for library functions.
include(CheckFunctionExists)
check_function_exists(_Exit HAVE__EXIT)
check_function_exists(accept4 HAVE_ACCEPT4)
check_function_exists(mkostemp HAVE_MKOSTEMP)
include(CheckSymbolExists)
# XXX does this correctly detect initgroups (un)availability on cygwin?
check_symbol_exists(initgroups grp.h HAVE_DECL_INITGROUPS)
if(NOT HAVE_DECL_INITGROUPS AND HAVE_UNISTD_H)
# FreeBSD declares initgroups() in unistd.h
check_symbol_exists(initgroups unistd.h HAVE_DECL_INITGROUPS2)
if(HAVE_DECL_INITGROUPS2)
set(HAVE_DECL_INITGROUPS 1)
endif()
endif()
set(WARNCFLAGS)
set(WARNCXXFLAGS)
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
if(ENABLE_WERROR)
set(WARNCFLAGS /WX)
set(WARNCXXFLAGS /WX)
endif()
else()
if(ENABLE_WERROR)
extract_valid_c_flags(WARNCFLAGS -Werror)
extract_valid_c_flags(WARNCXXFLAGS -Werror)
endif()
# For C compiler
extract_valid_c_flags(WARNCFLAGS
-Wall
-Wextra
-Wmissing-prototypes
-Wstrict-prototypes
-Wmissing-declarations
-Wpointer-arith
-Wdeclaration-after-statement
-Wformat-security
-Wwrite-strings
-Wshadow
-Winline
-Wnested-externs
-Wfloat-equal
-Wundef
-Wendif-labels
-Wempty-body
-Wcast-align
-Wclobbered
-Wvla
-Wpragmas
-Wunreachable-code
-Waddress
-Wattributes
-Wdiv-by-zero
# -Wshorten-64-to-32 # May be missing from GCC
-Wconversion
# -Wextended-offsetof # May be missing from GCC
-Wformat-nonliteral
# -Wlanguage-extension-token # May be missing from GCC
-Wmissing-field-initializers
-Wmissing-noreturn
# -Wmissing-variable-declarations # May be missing from GCC
# -Wpadded # Not used because we cannot change public structs
-Wsign-conversion
# -Wswitch-enum # Not used because this basically disallows default case
# -Wunreachable-code-break # May be missing from GCC
-Wunused-macros
-Wunused-parameter
-Wredundant-decls
# -Wheader-guard # Only work with Clang for the moment
-Wno-format-nonliteral # This is required because we pass format string as "const char*.
)
# For C++ compiler
extract_valid_cxx_flags(WARNCXXFLAGS
-Wall
-Wformat-security
)
endif()
if(ENABLE_DEBUG)
set(DEBUGBUILD 1)
endif()
#add_definitions(-DHAVE_CONFIG_H)
#configure_file(cmakeconfig.h.in config.h)
# autotools-compatible names
# Sphinx expects relative paths in the .rst files. Use the fact that the files
# below are all one directory level deep.
file(RELATIVE_PATH top_srcdir "${CMAKE_CURRENT_BINARY_DIR}/dir" "${CMAKE_CURRENT_SOURCE_DIR}")
file(RELATIVE_PATH top_builddir "${CMAKE_CURRENT_BINARY_DIR}/dir" "${CMAKE_CURRENT_BINARY_DIR}")
set(abs_top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
set(abs_top_builddir "${CMAKE_CURRENT_BINARY_DIR}")
# bzip2.pc (pkg-config file)
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
set(bindir "${CMAKE_INSTALL_FULL_BINDIR}")
set(sbindir "${CMAKE_INSTALL_FULL_SBINDIR}")
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
set(VERSION "${PACKAGE_VERSION}")
configure_file(
bzip2.pc.in
${CMAKE_CURRENT_BINARY_DIR}/bzip2.pc
@ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/bzip2.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
#
# The build targets.
# In a larger project, the following would be in subdirectories and
# These targets would be included with `add_subdirectory()`
#
set(BZ2_SOURCES
"blocksort.c"
"huffman.c"
"crctable.c"
"randtable.c"
"compress.c"
"decompress.c"
"bzlib.c")
# The bz2 OBJECT-library, required for bzip2, bzip2recover.
add_library(bz2_ObjLib OBJECT)
target_sources(bz2_ObjLib
PRIVATE ${BZ2_SOURCES}
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/bzlib_private.h"
INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/bzlib.h")
# Windows resource file
set(BZ2_RES "")
if(WIN32)
configure_file(
version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY)
set(BZ2_RES ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()
if(ENABLE_SHARED_LIB)
# The libbz2 shared library.
add_library(bz2 SHARED ${BZ2_RES})
target_sources(bz2
PRIVATE ${BZ2_SOURCES}
"${CMAKE_CURRENT_SOURCE_DIR}/libbz2.def"
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/bzlib_private.h"
INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/bzlib.h")
set_target_properties(bz2 PROPERTIES
COMPILE_FLAGS "${WARNCFLAGS}"
VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION})
install(TARGETS bz2 DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(FILES bzlib.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
endif()
if(ENABLE_STATIC_LIB)
# The libbz2 static library.
add_library(bz2_static STATIC)
target_sources(bz2_static
PRIVATE ${BZ2_SOURCES}
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/bzlib_private.h"
INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/bzlib.h")
set_target_properties(bz2_static PROPERTIES
COMPILE_FLAGS "${WARNCFLAGS}"
VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
ARCHIVE_OUTPUT_NAME bz2)
target_compile_definitions(bz2_static PUBLIC "-DBZ2_STATICLIB")
install(TARGETS bz2_static DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(FILES bzlib.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
endif()
if(ENABLE_APP)
# The bzip2 executable.
add_executable(bzip2)
target_sources(bzip2
PRIVATE "bzip2.c")
target_link_libraries(bzip2
PRIVATE bz2_ObjLib)
install(TARGETS bzip2 DESTINATION "${CMAKE_INSTALL_BINDIR}")
# The bzip2 executable.
add_executable(bzip2recover)
target_sources(bzip2recover
PRIVATE "bzip2recover.c")
target_link_libraries(bzip2recover
PRIVATE bz2_ObjLib)
install(TARGETS bzip2recover DESTINATION "${CMAKE_INSTALL_BINDIR}")
if(ENABLE_EXAMPLES)
if(ENABLE_SHARED_LIB)
# The dlltest executable.
add_executable(dlltest)
target_sources(dlltest
PRIVATE "dlltest.c")
target_link_libraries(dlltest bz2)
install(TARGETS dlltest DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
endif()
endif()
if(Python3_FOUND)
enable_testing()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
add_subdirectory(tests)
endif()
add_subdirectory(man)
set(DOCGEN_EXECS xsltproc perl xmllint egrep pdfxmltex pdftops)
if(ENABLE_DOCS)
foreach(EXEC IN LISTS DOCGEN_EXECS)
find_program(${EXEC}_EXEC ${EXEC})
if(NOT ${EXEC}_EXEC)
message(WARNING "Missing '${EXEC}', required to generate docs!")
set(MISSING_GENERATOR TRUE)
endif()
endforeach()
if(MISSING_GENERATOR)
message(FATAL_ERROR "Unable to generate docs.")
endif()
add_subdirectory(docs)
endif()
# The Summary Info.
string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type)
message(STATUS "Summary of build options:
Package version: ${VERSION}
Library version: ${LT_CURRENT}:${LT_REVISION}:${LT_AGE}
Install prefix: ${CMAKE_INSTALL_PREFIX}
Target system: ${CMAKE_SYSTEM_NAME}
Compiler:
Build type: ${CMAKE_BUILD_TYPE}
C compiler: ${CMAKE_C_COMPILER}
C++ compiler: ${CMAKE_CXX_COMPILER}
CFLAGS: ${CMAKE_C_FLAGS_${_build_type}} ${CMAKE_C_FLAGS}
WARNCFLAGS: ${WARNCFLAGS}
CXXFLAGS: ${CMAKE_CXX_FLAGS_${_build_type}} ${CMAKE_CXX_FLAGS}
CXX1XCXXFLAGS: ${CXX1XCXXFLAGS}
WARNCXXFLAGS: ${WARNCXXFLAGS}
Test:
Python: ${Python3_FOUND} (${Python3_VERSION}, ${Python3_EXECUTABLE})
Docs:
Build docs: ${ENABLE_DOCS}
Features:
Applications: ${ENABLE_APP}
Examples: ${ENABLE_EXAMPLES}
")
if(ENABLE_LIB_ONLY_DISABLED_OTHERS)
message("Only the library will be built. To build other components "
"(such as applications and examples), set ENABLE_LIB_ONLY=OFF.")
endif()

20
CMakeOptions.txt Normal file
View File

@ -0,0 +1,20 @@
# Features that can be enabled for cmake (see CMakeLists.txt)
option(ENABLE_WERROR "Turn on compile time warnings")
option(ENABLE_DEBUG "Turn on debug output")
option(ENABLE_APP "Build applications (bzip2, and bzip2recover)"
${ENABLE_APP_DEFAULT})
option(ENABLE_DOCS "Generate documentation"
${ENABLE_DOCS_DEFAULT})
option(ENABLE_EXAMPLES "Build examples"
${ENABLE_EXAMPLES_DEFAULT})
option(ENABLE_LIB_ONLY "Build libbz2 only. This is a short hand for -DENABLE_APP=0 -DENABLE_EXAMPLES=0")
option(ENABLE_STATIC_LIB "Build libbz2 in static mode also")
option(ENABLE_SHARED_LIB "Build libbz2 as a shared library" ON)

View File

@ -62,13 +62,62 @@ The [Meson] build system is the preferred way of building Bzip2. You
can use these commands to build Bzip2 in a certain `builddir`
directory.
```
```sh
meson --prefix /usr builddir
ninja -C builddir
meson test -C builddir --print-errorlogs
ninja -C builddir install
```
### Build instructions for Unix & Windows (CMake)
Bzip2 can be compiled with the [CMake] build system.
You can use these commands to build Bzip2 in a certain `build` directory.
#### Basic Release build
```sh
mkdir build && cd build
cmake ..
cmake --build . --config Release
```
#### Basic Debug build
```sh
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE="Debug"
cmake --build . --config Debug
```
#### Build and install to a specific install location (prefix)
```sh
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/install ..
cmake --build . --target install --config Release
```
#### Build with example application (dlltest)
```sh
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/install .. -DENABLE_EXAMPLES=ON
cmake --build . --target install --config Release
```
#### Build and run tests
- `-V`: Verbose
- `-C`: Required for Windows builds
```sh
mkdir build && cd build
cmake ..
cmake --build . --config Release
ctest -C Release -V
```
### Build instructions for Unix (Autotools)
If you are compiling a tarball:

View File

@ -0,0 +1,31 @@
# Convenience function that checks the availability of certain
# C or C++ compiler flags and returns valid ones as a string.
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
function(extract_valid_c_flags varname)
set(valid_flags)
foreach(flag IN LISTS ARGN)
string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" flag_var ${flag})
set(flag_var "C_FLAG_${flag_var}")
check_c_compiler_flag("${flag}" "${flag_var}")
if(${flag_var})
set(valid_flags "${valid_flags} ${flag}")
endif()
endforeach()
set(${varname} "${valid_flags}" PARENT_SCOPE)
endfunction()
function(extract_valid_cxx_flags varname)
set(valid_flags)
foreach(flag IN LISTS ARGN)
string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" flag_var ${flag})
set(flag_var "CXX_FLAG_${flag_var}")
check_cxx_compiler_flag("${flag}" "${flag_var}")
if(${flag_var})
set(valid_flags "${valid_flags} ${flag}")
endif()
endforeach()
set(${varname} "${valid_flags}" PARENT_SCOPE)
endfunction()

40
cmake/FindCUnit.cmake Normal file
View File

@ -0,0 +1,40 @@
# - Try to find cunit
# Once done this will define
# CUNIT_FOUND - System has cunit
# CUNIT_INCLUDE_DIRS - The cunit include directories
# CUNIT_LIBRARIES - The libraries needed to use cunit
find_package(PkgConfig QUIET)
pkg_check_modules(PC_CUNIT QUIET cunit)
find_path(CUNIT_INCLUDE_DIR
NAMES CUnit/CUnit.h
HINTS ${PC_CUNIT_INCLUDE_DIRS}
)
find_library(CUNIT_LIBRARY
NAMES cunit
HINTS ${PC_CUNIT_LIBRARY_DIRS}
)
if(CUNIT_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+CU_VERSION[ \t]+\"([^\"]+)\".*")
file(STRINGS "${CUNIT_INCLUDE_DIR}/CUnit/CUnit.h"
CUNIT_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1"
CUNIT_VERSION "${CUNIT_VERSION}")
unset(_version_regex)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set CUNIT_FOUND to TRUE
# if all listed variables are TRUE and the requested version matches.
find_package_handle_standard_args(CUnit REQUIRED_VARS
CUNIT_LIBRARY CUNIT_INCLUDE_DIR
VERSION_VAR CUNIT_VERSION)
if(CUNIT_FOUND)
set(CUNIT_LIBRARIES ${CUNIT_LIBRARY})
set(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR})
endif()
mark_as_advanced(CUNIT_INCLUDE_DIR CUNIT_LIBRARY)

11
cmake/Version.cmake Normal file
View File

@ -0,0 +1,11 @@
# Converts a version such as 1.2.255 to 0x0102ff
function(HexVersion version_hex_var major minor patch)
math(EXPR version_dec "${major} * 256 * 256 + ${minor} * 256 + ${patch}")
set(version_hex "0x")
foreach(i RANGE 5 0 -1)
math(EXPR num "(${version_dec} >> (4 * ${i})) & 15")
string(SUBSTRING "0123456789abcdef" ${num} 1 num_hex)
set(version_hex "${version_hex}${num_hex}")
endforeach()
set(${version_hex_var} "${version_hex}" PARENT_SCOPE)
endfunction()

21
docs/CMakeLists.txt Normal file
View File

@ -0,0 +1,21 @@
set(DOC_TYPES pdf ps html)
find_program(PROG_SH sh)
if(NOT PROG_SH)
message(FATAL_ERROR "Generator not found!")
endif()
foreach(t IN LISTS DOC_TYPES)
add_custom_command(
OUTPUT
manual.${t}
COMMAND
${PROG_SH} xmlproc.sh -${t} manual.${t}
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/manual.${t}
DESTINATION
${CMAKE_INSTALL_PREFIX}/docs)
endforeach()

8
man/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
set(MAN_FILES bzip2.1 bzgrep.1 bzdiff.1 bzmore.1)
foreach(m IN LISTS MAN_FILES)
install(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/${m}
DESTINATION
${CMAKE_INSTALL_PREFIX}/man/man1)
endforeach()

47
tests/CMakeLists.txt Normal file
View File

@ -0,0 +1,47 @@
set(sample1 -1 sample1.ref sample1.bz2)
set(sample2 -1 sample2.ref sample2.bz2)
set(sample3 -1 sample3.ref sample3.bz2)
if(WIN32)
set(BZIP2_EXE "$<CONFIG>/bzip2.exe")
else()
set(BZIP2_EXE bzip2)
endif()
foreach(TEST
"${sample1}"
"${sample2}"
"${sample3}"
)
list(GET TEST 0 block_size)
list(GET TEST 1 file_name)
list(GET TEST 2 zip_name)
add_test(NAME "compress_${file_name}"
COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/runtest.py
--mode compress
${CMAKE_BINARY_DIR}/${BZIP2_EXE}
${block_size}
${CMAKE_CURRENT_SOURCE_DIR}/${file_name}
${CMAKE_CURRENT_SOURCE_DIR}/${zip_name}
)
endforeach()
foreach(TEST
"${sample1}"
"${sample2}"
"${sample3}"
)
list(GET TEST 0 block_size)
list(GET TEST 1 file_name)
add_test(NAME "decompress_${file_name}"
COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/runtest.py
--mode decompress
${CMAKE_BINARY_DIR}/${BZIP2_EXE}
${block_size}
${CMAKE_CURRENT_SOURCE_DIR}/${file_name}
)
endforeach()

54
version.rc.in Normal file
View File

@ -0,0 +1,54 @@
#include <winver.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION @PROJECT_VERSION_MAJOR@, @PROJECT_VERSION_MINOR@, @PROJECT_VERSION_PATCH@, 0
PRODUCTVERSION @PROJECT_VERSION_MAJOR@, @PROJECT_VERSION_MINOR@, @PROJECT_VERSION_PATCH@, 0
FILEFLAGSMASK 0x3fL
FILEOS VOS__WINDOWS32
#if defined(LIBBZ2)
FILETYPE VFT_DLL
#else
FILETYPE VFT_APP
#endif
FILESUBTYPE 0x0L
#ifdef _DEBUG
#define VER_STR "@PROJECT_VERSION@.0 (MSVC debug)"
#define DBG "d"
FILEFLAGS 0x1L
#else
#define VER_STR "@PROJECT_VERSION@.0 (MSVC release)"
#define DBG ""
FILEFLAGS 0x0L
#endif
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
// VALUE "Comments", ""
VALUE "CompanyName", "bzip2, http://www.bzip.org/"
VALUE "FileDescription", "bzip2"
VALUE "FileVersion", "1.0.6"
#if defined(LIBBZ2)
VALUE "InternalName", "libbz2"
VALUE "OriginalFilename", "libbz2.dll"
#elif defined(BZIP2)
VALUE "InternalName", "bzip2"
VALUE "OriginalFilename", "bzip2.exe"
#elif defined(BZIP2RECOVER)
VALUE "InternalName", "bzip2recover"
VALUE "OriginalFilename", "bzip2recover.exe"
#endif
VALUE "LegalCopyright", "Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>. All rights reserved."
VALUE "LegalTrademarks", ""
VALUE "ProductName", "bzip2"
VALUE "ProductVersion", "1.0.6"
// VALUE "SpecialBuild", ""
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 0x4b0
END
END