Refactor: turn the base32 wrapper into a static library

This library is meant for private use by Keysmith, to simplify linking to the base32 functionality in CMake files.
master
Johan Ouwerkerk 2019-12-15 17:15:28 +01:00 committed by Bhushan Shah
parent 32693b7092
commit a5794e02da
8 changed files with 28 additions and 13 deletions

View File

@ -1,12 +1,10 @@
include_directories(BEFORE ../src)
add_subdirectory(base32)
add_subdirectory(validators)
set(Base32_UUT_SRCS ../src/base32.cpp)
set(Account_UUT_SRCS ../src/account.cpp ${Base32_UUT_SRCS})
set(Test_DEP_LIBS Qt5::Core Qt5::Test)
set(Account_UUT_SRCS ../src/account.cpp)
set(Test_DEP_LIBS Qt5::Core Qt5::Test ${LIBOATH_LIBRARIES} base32_lib)
ecm_add_test(base32-decode.cpp ${Base32_UUT_SRCS} LINK_LIBRARIES ${Test_DEP_LIBS} ${LIBOATH_LIBRARIES} TEST_NAME base32-decode)
ecm_add_test(hotp-generator-samples.cpp ${Account_UUT_SRCS} LINK_LIBRARIES ${Test_DEP_LIBS} ${LIBOATH_LIBRARIES} TEST_NAME hotp-generator-samples)
ecm_add_test(totp-generator-samples.cpp ${Account_UUT_SRCS} LINK_LIBRARIES ${Test_DEP_LIBS} ${LIBOATH_LIBRARIES} TEST_NAME totp-generator-samples)
ecm_add_test(hotp-generator-samples.cpp ${Account_UUT_SRCS} LINK_LIBRARIES ${Test_DEP_LIBS} TEST_NAME hotp-generator-samples)
ecm_add_test(totp-generator-samples.cpp ${Account_UUT_SRCS} LINK_LIBRARIES ${Test_DEP_LIBS} TEST_NAME totp-generator-samples)

View File

@ -0,0 +1,9 @@
set(Test_DEP_LIBS Qt5::Core Qt5::Test ${LIBOATH_LIBRARIES} base32_lib)
set(base32_lib_test_SRCS base32-decode.cpp)
ecm_add_tests(
${base32_lib_test_SRCS}
LINK_LIBRARIES ${Test_DEP_LIBS}
NAME_PREFIX base32-
)

View File

@ -16,7 +16,7 @@
* *
****************************************************************************/
#include "base32.h"
#include "base32/base32.h"
#include <QTest>
#include <QtDebug>

View File

@ -1,13 +1,13 @@
add_subdirectory(base32)
add_subdirectory(validators)
set(keysmith_SRCS
main.cpp
accountmodel.cpp
account.cpp
base32.cpp
)
)
set(keysmith_internal_libs validator_lib)
set(keysmith_internal_libs base32_lib validator_lib)
qt5_add_resources(RESOURCES resources.qrc)
add_executable(org.kde.keysmith ${keysmith_SRCS} ${RESOURCES})

View File

@ -18,7 +18,7 @@
#include "account.h"
#include "base32.h"
#include "base32/base32.h"
#include "oath_p.h"
#include <QDateTime>

View File

@ -0,0 +1,8 @@
#
# This directory contains a wrapper around base32 functionality of the oath library
#
set(base32_SRCS base32.cpp)
add_library(base32_lib STATIC ${base32_SRCS})
target_link_libraries(base32_lib Qt5::Core ${LIBOATH_LIBRARIES})

View File

@ -18,7 +18,7 @@
#include "base32.h"
#include "oath_p.h"
#include "../oath_p.h"
#include <QtDebug>