From b7b3936e56e19aeb5211e46234989859cc79cf8a Mon Sep 17 00:00:00 2001 From: R4SAS Date: Sat, 28 Jan 2023 23:24:17 +0000 Subject: [PATCH] update cmake and makefile Signed-off-by: R4SAS --- tests/CMakeLists.txt | 40 +++++++------------------------------- tests/Makefile | 46 +++++++++++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 51 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c6eec047..35b7aec4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,8 +5,6 @@ include_directories(${CHECK_INCLUDE_DIRS}) # Compiler flags: if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter -Wextra -pedantic -O0 -g -Wl,-undefined,dynamic_lookup") -else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter -Wextra -pedantic -O0 -g -D_GLIBCXX_USE_NANOSLEEP=1 -Wl,--unresolved-symbols=ignore-in-object-files") endif() set(TEST_PATH ${CMAKE_CURRENT_BINARY_DIR}) @@ -18,80 +16,50 @@ include_directories( ) set(test-http-merge_chunked_SRCS - ../libi2pd/HTTP.cpp test-http-merge_chunked.cpp ) set(test-http-req_SRCS - ../libi2pd/HTTP.cpp test-http-req.cpp ) set(test-http-res_SRCS - ../libi2pd/HTTP.cpp test-http-res.cpp ) set(test-http-url_decode_SRCS - ../libi2pd/HTTP.cpp test-http-url_decode.cpp ) set(test-http-url_SRCS - ../libi2pd/HTTP.cpp test-http-url.cpp ) set(test-base-64_SRCS - ../libi2pd/Base.cpp test-base-64.cpp ) set(test-gost_SRCS - ../libi2pd/Gost.cpp - ../libi2pd/I2PEndian.cpp test-gost.cpp ) set(test-gost-sig_SRCS - ../libi2pd/Gost.cpp - ../libi2pd/I2PEndian.cpp - ../libi2pd/Crypto.cpp - ../libi2pd/Log.cpp test-gost-sig.cpp ) set(test-x25519_SRCS - ../libi2pd/Ed25519.cpp - ../libi2pd/I2PEndian.cpp - ../libi2pd/Log.cpp - ../libi2pd/Crypto.cpp test-x25519.cpp ) set(test-aeadchacha20poly1305_SRCS - ../libi2pd/Crypto.cpp - ../libi2pd/ChaCha20.cpp - ../libi2pd/Poly1305.cpp test-aeadchacha20poly1305.cpp ) set(test-blinding_SRCS - ../libi2pd/Crypto.cpp - ../libi2pd/Blinding.cpp - ../libi2pd/Ed25519.cpp - ../libi2pd/I2PEndian.cpp - ../libi2pd/Log.cpp - ../libi2pd/util.cpp - ../libi2pd/Identity.cpp - ../libi2pd/Signature.cpp - ../libi2pd/Timestamp.cpp test-blinding.cpp ) SET(test-elligator_SRCS - ../libi2pd/Elligator.cpp - ../libi2pd/Crypto.cpp test-elligator.cpp ) @@ -115,9 +83,15 @@ set(LIBS OpenSSL::SSL OpenSSL::Crypto Threads::Threads + libi2pd ) -target_link_libraries(test-gost OpenSSL::Crypto Threads::Threads) +target_link_libraries(test-http-merge_chunked ${LIBS}) +target_link_libraries(test-http-req ${LIBS}) +target_link_libraries(test-http-res ${LIBS}) +target_link_libraries(test-http-url_decode ${LIBS}) +target_link_libraries(test-http-url ${LIBS}) +target_link_libraries(test-gost ${LIBS}) target_link_libraries(test-gost-sig ${LIBS}) target_link_libraries(test-x25519 ${LIBS}) target_link_libraries(test-aeadchacha20poly1305 ${LIBS}) diff --git a/tests/Makefile b/tests/Makefile index f8f6cf77..82a39c86 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,33 +1,43 @@ -CXXFLAGS += -Wall -Wno-unused-parameter -Wextra -pedantic -O0 -g -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1 -pthread -Wl,--unresolved-symbols=ignore-in-object-files +CXXFLAGS += -Wall -Wno-unused-parameter -Wextra -pedantic -O0 -g -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1 -DOPENSSL_SUPPRESS_DEPRECATED -pthread -Wl,--unresolved-symbols=ignore-in-object-files INCFLAGS += -I../libi2pd -TESTS = test-gost test-gost-sig test-base-64 test-x25519 test-aeadchacha20poly1305 test-blinding test-elligator +TESTS = test-gost test-gost-sig test-base-64 test-x25519 test-aeadchacha20poly1305 test-blinding test-elligator \ + test-http-merge_chunked test-http-res test-http-url_decode test-http-req test-http-url + +LDLIBS = \ + -lboost_system \ + -lboost_filesystem \ + -lboost_system \ + -lcrypto \ + -lssl \ + -L.. \ + -li2pd all: $(TESTS) run -test-http-%: ../libi2pd/HTTP.cpp test-http-%.cpp - $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ +test-http-%: test-http-%.cpp + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LDLIBS) -test-base-%: ../libi2pd/Base.cpp test-base-%.cpp - $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ +test-base-%: test-base-%.cpp + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LDLIBS) -test-gost: ../libi2pd/Gost.cpp ../libi2pd/I2PEndian.cpp test-gost.cpp - $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ -lcrypto +test-gost: test-gost.cpp + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LDLIBS) -test-gost-sig: ../libi2pd/Gost.cpp ../libi2pd/I2PEndian.cpp ../libi2pd/Crypto.cpp ../libi2pd/Log.cpp test-gost-sig.cpp - $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ -lcrypto -lssl -lboost_system +test-gost-sig: test-gost-sig.cpp + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LDLIBS) -test-x25519: ../libi2pd/Ed25519.cpp ../libi2pd/I2PEndian.cpp ../libi2pd/Log.cpp ../libi2pd/Crypto.cpp test-x25519.cpp - $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ -lcrypto -lssl -lboost_system +test-x25519: test-x25519.cpp + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LDLIBS) -test-aeadchacha20poly1305: ../libi2pd/Crypto.cpp ../libi2pd/ChaCha20.cpp ../libi2pd/Poly1305.cpp test-aeadchacha20poly1305.cpp - $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ -lcrypto -lssl -lboost_system +test-aeadchacha20poly1305: test-aeadchacha20poly1305.cpp + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LDLIBS) -test-blinding: ../libi2pd/Crypto.cpp ../libi2pd/Blinding.cpp ../libi2pd/Ed25519.cpp ../libi2pd/I2PEndian.cpp ../libi2pd/Log.cpp ../libi2pd/util.cpp ../libi2pd/Identity.cpp ../libi2pd/Signature.cpp ../libi2pd/Timestamp.cpp test-blinding.cpp - $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ -lcrypto -lssl -lboost_system +test-blinding: test-blinding.cpp + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LDLIBS) -test-elligator: ../libi2pd/Elligator.cpp ../libi2pd/Crypto.cpp test-elligator.cpp - $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ -lcrypto -lssl -lboost_system +test-elligator: test-elligator.cpp + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LDLIBS) run: $(TESTS) @for TEST in $(TESTS); do ./$$TEST ; done