2024-07-14 10:18:41 +02:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
2022-11-10 01:31:47 +01:00
|
|
|
|
|
|
|
enable_language(C)
|
|
|
|
enable_language(CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
2024-07-14 10:18:41 +02:00
|
|
|
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
2022-11-10 01:31:47 +01:00
|
|
|
if(POLICY CMP0077)
|
|
|
|
cmake_policy(SET CMP0077 NEW)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (MSVC)
|
2022-12-18 23:56:55 +01:00
|
|
|
add_compile_options(/W4)
|
2022-11-10 01:31:47 +01:00
|
|
|
else()
|
|
|
|
add_compile_options(-Wall -Wextra -pedantic)
|
|
|
|
endif()
|
|
|
|
|
2022-12-31 13:49:58 +01:00
|
|
|
project(oc-issuer VERSION 0.0.2 LANGUAGES CXX)
|
2022-11-10 01:31:47 +01:00
|
|
|
|
2023-04-20 22:52:56 +02:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
2022-11-10 01:31:47 +01:00
|
|
|
include(FetchContent)
|
2022-11-21 22:44:07 +01:00
|
|
|
|
2022-11-10 01:31:47 +01:00
|
|
|
#
|
|
|
|
# crow project Configuration variables
|
|
|
|
#
|
|
|
|
set(CROW_BUILD_EXAMPLES Off)
|
|
|
|
set(CROW_BUILD_TOOLS Off)
|
|
|
|
set(CROW_BUILD_TESTS Off)
|
|
|
|
set(CROW_BUILD_DOCS Off)
|
|
|
|
|
|
|
|
# add crow project to the build
|
|
|
|
FetchContent_Declare(crow
|
|
|
|
GIT_REPOSITORY https://github.com/CrowCpp/Crow.git
|
2024-07-14 10:18:41 +02:00
|
|
|
GIT_TAG v1.2.0
|
2022-11-10 01:31:47 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
if(NOT crow_POPULATED)
|
|
|
|
FetchContent_Populate(crow)
|
|
|
|
add_subdirectory(${crow_SOURCE_DIR} ${crow_BINARY_DIR})
|
|
|
|
endif(NOT crow_POPULATED)
|
|
|
|
|
|
|
|
# add tartan lamas expected library
|
|
|
|
FetchContent_Declare(expected
|
|
|
|
GIT_REPOSITORY https://github.com/TartanLlama/expected.git
|
|
|
|
GIT_TAG master
|
|
|
|
)
|
|
|
|
if(NOT expected_POPULATED)
|
|
|
|
FetchContent_Populate(expected)
|
|
|
|
endif(NOT expected_POPULATED)
|
2022-11-18 15:47:52 +01:00
|
|
|
|
2023-01-23 18:18:10 +01:00
|
|
|
# add crypt++ (+cmake) library
|
2024-07-14 10:18:41 +02:00
|
|
|
#set(CRYPTOPP_BUILD_TESTING Off)
|
|
|
|
#set(CRYPTOPP_INSTALL Off)
|
2023-01-23 18:18:10 +01:00
|
|
|
|
2024-07-14 10:18:41 +02:00
|
|
|
#if(NOT cryptopp_POPULATED)
|
|
|
|
# FetchContent_Declare(cryptopp
|
|
|
|
# GIT_REPOSITORY https://github.com/abdes/cryptopp-cmake.git
|
|
|
|
# GIT_TAG CRYPTOPP_8_7_0_1)
|
|
|
|
# FetchContent_Populate(cryptopp)
|
|
|
|
# add_subdirectory(${cryptopp_SOURCE_DIR} ${cryptopp_BINARY_DIR})
|
|
|
|
#endif(NOT cryptopp_POPULATED)
|
2023-01-23 18:18:10 +01:00
|
|
|
|
2022-11-21 22:44:07 +01:00
|
|
|
include(CTest)
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
set(CATCH_INSTALL_DOCS Off)
|
|
|
|
set(CATCH_INSTALL_EXTRAS Off)
|
|
|
|
FetchContent_Declare(
|
|
|
|
Catch2
|
|
|
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
2023-01-29 23:59:28 +01:00
|
|
|
GIT_TAG v3.3.1
|
2022-11-21 22:44:07 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
FetchContent_MakeAvailable(Catch2)
|
|
|
|
|
|
|
|
#add doxygen documentation
|
2022-11-18 15:47:52 +01:00
|
|
|
find_package(Doxygen
|
|
|
|
REQUIRED dot
|
|
|
|
OPTIONAL_COMPONENTS mscgen dia)
|
|
|
|
set(DOXYGEN_HAVE_DOT YES)
|
2022-12-31 13:49:58 +01:00
|
|
|
doxygen_add_docs( doc
|
|
|
|
README.md
|
|
|
|
src
|
|
|
|
COMMENT "Generate documentation"
|
2022-11-18 15:47:52 +01:00
|
|
|
)
|
2022-11-21 22:44:07 +01:00
|
|
|
|
|
|
|
# build common library
|
2023-01-23 17:06:20 +01:00
|
|
|
set(LIB_SOURCES
|
|
|
|
src/model.cpp src/model.hpp
|
|
|
|
src/json_serialisation.cpp
|
|
|
|
src/big_int.hpp src/big_int.cpp )
|
|
|
|
|
2022-11-21 22:44:07 +01:00
|
|
|
add_library(oc-mint-lib ${LIB_SOURCES})
|
2024-07-14 10:18:41 +02:00
|
|
|
target_link_libraries(oc-mint-lib PUBLIC Crow::Crow) # cryptopp::cryptopp)
|
2022-11-21 22:44:07 +01:00
|
|
|
target_include_directories(oc-mint-lib PUBLIC ${expected_SOURCE_DIR}/include src)
|
|
|
|
|
2022-12-31 13:49:58 +01:00
|
|
|
add_executable(${PROJECT_NAME} src/main.cpp)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE oc-mint-lib INTERFACE tl::expected::expected)
|
2022-11-21 22:44:07 +01:00
|
|
|
|
|
|
|
## these are unittests that can be run on any platform
|
2023-04-20 22:52:56 +02:00
|
|
|
add_executable(tests test/test_big_int.cpp
|
|
|
|
test/test_json_s8n.cpp
|
|
|
|
test/test_crypto.cpp)
|
|
|
|
|
2022-11-21 22:44:07 +01:00
|
|
|
target_link_libraries(tests
|
|
|
|
oc-mint-lib
|
|
|
|
Catch2::Catch2WithMain)
|
|
|
|
add_test(tests tests)
|