<commit_before>cmake_minimum_required(VERSION 2.6)
project(smartcardpp)

# Custom cmake modules
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")

include(InstallSettings)

set(SMARTCARDPP_VERSION "0.1.0")

if(UNIX)
    find_package(LibDL)
    find_package(PCSCLite REQUIRED)
endif(UNIX)

include_directories(
    ${CMAKE_CURRENT_BINARY_DIR}
    ${LIBDL_INCLUDE_DIR}
    ${PCSCLITE_INCLUDE_DIR}
)

if(MSVC AND USE_STATIC_RUNTIME)
    message(STATUS "Building with static MSVC runtime")
    foreach(flag_var
            CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
            CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
        if(${flag_var} MATCHES "/MD")
            string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
        endif(${flag_var} MATCHES "/MD")
    endforeach(flag_var)
endif(MSVC AND USE_STATIC_RUNTIME)

set(smartcard_SRCS
    CardBase.cpp
    CTAPIManager.cpp
    DynamicLibrary.cpp
    locked_allocator.cpp
    PCSCManager.cpp
    SCError.cpp
    SmartCardManager.cpp
    types.cpp
)

set(esteid_SRCS
    esteid/EstEidCard.cpp
    esteid/EstEidCardMaintainer.cpp
)

set(sim_SRCS sim/SIMCard.cpp)

# Public headers which get installed into smartcardpp/ directory
set(smartcard_HDRS
    CardBase.h
    common.h
    CTAPIManager.h
    DynamicLibrary.h
    helperMacro.h
    internal-pcsc22.h
    locked_allocator.h
    ManagerInterface.h
    PCSCManager.h
    PinString.h
    SCError.h
    smartcardpp.h
    SmartCardManager.h
    types.h
)

# Public headers which get installed into smartcardpp/esteid/ directory
set(esteid_HDRS
    esteid/EstEidCard.h
    esteid/EstEidCardMaintainer.h
)

# Public headers which get installed into smartcardpp/sim/ directory
set(sim_HDRS sim/SIMCard.h)

set(GENERATED_HEADERS "")
macro(stage_smartcard_headers HEADERS)
    foreach(H ${HEADERS})
        set(SRC "${CMAKE_CURRENT_SOURCE_DIR}/${H}")
        set(DST "${CMAKE_CURRENT_BINARY_DIR}/smartcardpp/${H}")

        add_custom_command(
            OUTPUT ${DST}
            COMMAND ${CMAKE_COMMAND} -E copy ${SRC} ${DST}
            DEPENDS ${SRC}
        )

        set(GENERATED_HEADERS ${GENERATED_HEADERS} ${DST})
    endforeach(H)
endmacro(stage_smartcard_headers)

stage_smartcard_headers("${smartcard_HDRS}")
stage_smartcard_headers("${esteid_HDRS}")
stage_smartcard_headers("${sim_HDRS}")

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/smartcardpp DESTINATION ${INCLUDE_INSTALL_DIR})

if(WIN32)
    set(LIB_TYPE STATIC)
else(WIN32)
    set(LIB_TYPE SHARED)
endif(WIN32)

add_library(smartcardpp ${LIB_TYPE}
    ${GENERATED_HEADERS}
    ${smartcard_SRCS}<commit_msg>smartcardpp: use static version on mac<commit_after>cmake_minimum_required(VERSION 2.6)
project(smartcardpp)

# Custom cmake modules
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")

include(InstallSettings)

set(SMARTCARDPP_VERSION "0.1.0")

if(UNIX)
    find_package(LibDL)
    find_package(PCSCLite REQUIRED)
endif(UNIX)

include_directories(
    ${CMAKE_CURRENT_BINARY_DIR}
    ${LIBDL_INCLUDE_DIR}
    ${PCSCLITE_INCLUDE_DIR}
)

if(MSVC AND USE_STATIC_RUNTIME)
    message(STATUS "Building with static MSVC runtime")
    foreach(flag_var
            CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
            CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
        if(${flag_var} MATCHES "/MD")
            string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
        endif(${flag_var} MATCHES "/MD")
    endforeach(flag_var)
endif(MSVC AND USE_STATIC_RUNTIME)

set(smartcard_SRCS
    CardBase.cpp
    CTAPIManager.cpp
    DynamicLibrary.cpp
    locked_allocator.cpp
    PCSCManager.cpp
    SCError.cpp
    SmartCardManager.cpp
    types.cpp
)

set(esteid_SRCS
    esteid/EstEidCard.cpp
    esteid/EstEidCardMaintainer.cpp
)

set(sim_SRCS sim/SIMCard.cpp)

# Public headers which get installed into smartcardpp/ directory
set(smartcard_HDRS
    CardBase.h
    common.h
    CTAPIManager.h
    DynamicLibrary.h
    helperMacro.h
    internal-pcsc22.h
    locked_allocator.h
    ManagerInterface.h
    PCSCManager.h
    PinString.h
    SCError.h
    smartcardpp.h
    SmartCardManager.h
    types.h
)

# Public headers which get installed into smartcardpp/esteid/ directory
set(esteid_HDRS
    esteid/EstEidCard.h
    esteid/EstEidCardMaintainer.h
)

# Public headers which get installed into smartcardpp/sim/ directory
set(sim_HDRS sim/SIMCard.h)

set(GENERATED_HEADERS "")
macro(stage_smartcard_headers HEADERS)
    foreach(H ${HEADERS})
        set(SRC "${CMAKE_CURRENT_SOURCE_DIR}/${H}")
        set(DST "${CMAKE_CURRENT_BINARY_DIR}/smartcardpp/${H}")

        add_custom_command(
            OUTPUT ${DST}
            COMMAND ${CMAKE_COMMAND} -E copy ${SRC} ${DST}
            DEPENDS ${SRC}
        )

        set(GENERATED_HEADERS ${GENERATED_HEADERS} ${DST})
    endforeach(H)
endmacro(stage_smartcard_headers)

stage_smartcard_headers("${smartcard_HDRS}")
stage_smartcard_headers("${esteid_HDRS}")
stage_smartcard_headers("${sim_HDRS}")

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/smartcardpp DESTINATION ${INCLUDE_INSTALL_DIR})

if(WIN32 OR APPLE)
    set(LIB_TYPE STATIC)
else(WIN32)
    set(LIB_TYPE SHARED)
endif(WIN32)

add_library(smartcardpp ${LIB_TYPE}
    ${GENERATED_HEADERS}
    ${smartcard_SRCS}
{'fraction_non_alphanumeric': 0.09867924528301887, 'fraction_numerical': 0.004905660377358491, 'mean_word_length': 4.029411764705882, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1146027', 'n_tokens_mistral': 2011, 'n_tokens_neox': 1926, 'n_words': 310}