Compare commits

..

No commits in common. "hunter" and "xy" have entirely different histories.
hunter ... xy

3 changed files with 26 additions and 68 deletions

View File

@ -1,9 +1,6 @@
# Copyright (c) 2015, Ruslan Baratov
# All rights reserved.
cmake_minimum_required(VERSION 3.0)
project(BZip2
project(bzip2
VERSION 1.0.6
LANGUAGES C
)
@ -21,7 +18,7 @@ if (MSVC)
if (NOT DEFINED MSVCVER)
math(EXPR MSVCVER "(${MSVC_VERSION} / 10) - 60")
endif()
# add the runtiume version and target architecture into the DLL name per MS
# guidelines
set(MSVC_SHARED_SUFFIX_BASE "-${PROJECT_VERSION_MAJOR}-vc${MSVCVER}-mt-${ARCH}")
@ -55,14 +52,17 @@ set(bzip2_html
manual.html
)
if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
set(CMAKE_DEBUG_POSTFIX "d")
if(MSVC)
add_definitions(-D_FILE_OFFSET_BITS=64)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
# set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL")
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
# set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
# set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
# set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
set(VER_PRODUCTNAME_STR "bzip2 - a freely available, patent free, high-quality data compressor.")
set(VER_LEGALCOPYRIGHT_STR "copyright (C) 1996-2010 Julian R Seward")
@ -77,17 +77,17 @@ if(MSVC)
${CMAKE_SOURCE_DIR}/version.rc.cmakein
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY
)
)
set(bzip2_DLLSRCS
${CMAKE_SOURCE_DIR}/libbz2.def
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
)
endif(MSVC)
add_library(${local_lib_name} ${bzip2_lib_SRCS} ${bzip2_lib_HDRS} ${bzip2_DLLSRCS})
set_target_properties(${local_lib_name} PROPERTIES
add_library(${local_lib_name} SHARED ${bzip2_lib_SRCS} ${bzip2_lib_HDRS} ${bzip2_DLLSRCS})
set_target_properties(${local_lib_name} PROPERTIES
SOVERSION ${PROJECT_VERSION}
VERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION_MAJOR}
PUBLIC_HEADER bzlib.h
)
@ -105,6 +105,13 @@ target_link_libraries(bzip2_bin bz2)
set_target_properties(bzip2_bin PROPERTIES OUTPUT_NAME bzip2)
install(TARGETS bz2 bzip2recover bzip2_bin
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include
)
file(GLOB man1 ${bzip2_SOURCE_DIR}/*.1)
@ -120,7 +127,7 @@ if (BUILD_TESTING)
enable_testing()
add_executable(spew spewG)
add_test(NAME compress_block_size_1
COMMAND ${CMAKE_COMMAND}
-DTEST_PROG=$<TARGET_FILE:bzip2_bin>
@ -186,54 +193,10 @@ add_test(NAME decompress_block_size_3
-DSOURCEDIR=${CMAKE_CURRENT_SOURCE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/runtest.cmake
)
endif()
####
# Installation (https://github.com/forexample/package-example)
set(config_install_dir "lib/cmake/${PROJECT_NAME}")
set(include_install_dir "include")
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(targets_export_name "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")
include(CMakePackageConfigHelpers)
# Note: PROJECT_VERSION is used as a VERSION
write_basic_package_version_file(
"${version_config}" COMPATIBILITY SameMajorVersion
)
# Note: variable 'targets_export_name' used
configure_file("cmake/Config.cmake.in" "${project_config}" @ONLY)
set(targets_to_install bz2)
if(NOT IOS)
list(APPEND targets_to_install bzip2recover bzip2_bin)
endif()
install(
TARGETS ${targets_to_install}
EXPORT "${targets_export_name}"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
RUNTIME DESTINATION "bin"
INCLUDES DESTINATION "${include_install_dir}"
PUBLIC_HEADER DESTINATION "${include_install_dir}"
)
install(
FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}"
)
install(
EXPORT "${targets_export_name}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)
# echo EXPORTS > bzip2.def
# nm bzip2.dll | grep ' T _' | sed 's/.* T _//' >> bzip2.def
# pexports bzip2.dll > bzip2.def
# lib /def:bzip2.def /machine:x86

View File

@ -76,10 +76,6 @@ typedef
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
# include <windows.h>
# ifdef small
/* windows.h define small to char */
# undef small
# endif
# include <io.h>
# include <sys/utime.h>
# define fdopen _fdopen

View File

@ -1 +0,0 @@
include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")