cmake_minimum_required(VERSION 3.22.1)

project("a2fair")

# Optimization and symbol stripping for Release build
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -flto -fvisibility=hidden -fvisibility-inlines-hidden -fdata-sections -ffunction-sections")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -flto -Wl,--gc-sections -Wl,-s -Wl,--exclude-libs,ALL")

add_library(
        a2fair
        SHARED
        native-lib.cpp
        base32.cpp
        sha1.cpp
        sha256.cpp
        sha512.cpp
        hmac.cpp
        otp.cpp)

find_library(
        log-lib
        log)

target_link_libraries(
        a2fair
        ${log-lib})
