Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ test-base64
.wsjcpp/*
*.o
*.exe
build/
base64-test-11
base64-test-17
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.12)
project("cpp-base64" LANGUAGES CXX VERSION 2.0.8
DESCRIPTION "Base64 encoding and decoding with C++"
HOMEPAGE_URL "https://github.com/CodeFinder2/cpp-base64")
include(GNUInstallDirs)

add_library(${PROJECT_NAME} src/base64.cpp)
target_include_directories(${PROJECT_NAME} SYSTEM
PUBLIC $<BUILD_INTERFACE:${${PROJECT_NAME}_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME} DESTINATION include)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Config
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
export(TARGETS ${PROJECT_NAME} FILE ${PROJECT_NAME}Config.cmake)
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ WARNINGS= \
-fdiagnostics-show-option

test: base64-test-11 base64-test-17
base64-test-11
base64-test-17
-./base64-test-11
-./base64-test-17

base64-test-11: base64-11.o test-11.o
g++ base64-11.o test-11.o -o $@

base64-test-17: base64-17.o test-17.o
g++ base64-17.o test-17.o -o $@

base64-11.o: base64.cpp base64.h
g++ -std=c++11 $(WARNINGS) -c base64.cpp -o base64-11.o
base64-11.o: src/base64.cpp include/cpp-base64/base64.h
g++ -std=c++11 $(WARNINGS) -c src/base64.cpp -o base64-11.o -I include

base64-17.o: base64.cpp base64.h
g++ -std=c++17 $(WARNINGS) -c base64.cpp -o base64-17.o
base64-17.o: src/base64.cpp include/cpp-base64/base64.h
g++ -std=c++17 $(WARNINGS) -c src/base64.cpp -o base64-17.o -I include

test-11.o: test.cpp
g++ -std=c++11 $(WARNINGS) -c test.cpp -o test-11.o
test-11.o: test/test.cpp
g++ -std=c++11 $(WARNINGS) -c test/test.cpp -o test-11.o -I include

test-17.o: test.cpp
g++ -std=c++17 $(WARNINGS) -c test.cpp -o test-17.o
test-17.o: test/test.cpp
g++ -std=c++17 $(WARNINGS) -c test/test.cpp -o test-17.o -I include
2 changes: 1 addition & 1 deletion compile-and-run-test
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
g++ test.cpp base64.cpp -o test-base64
g++ test/test.cpp src/base64.cpp -o test-base64 -I include
./test-base64
File renamed without changes.
2 changes: 1 addition & 1 deletion base64.cpp → src/base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

*/

#include "base64.h"
#include "cpp-base64/base64.h"

#include <algorithm>
#include <stdexcept>
Expand Down
2 changes: 1 addition & 1 deletion measure-time.cpp → test/measure-time.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "base64.h"
#include "../include/cpp-base64/base64.h"
#include <iostream>
#include <chrono>

Expand Down
2 changes: 1 addition & 1 deletion test-google.cpp → test/test-google.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "base64.h"
#include "../include/cpp-base64/base64.h"
#include <iostream>

#include <gtest/gtest.h>
Expand Down
2 changes: 1 addition & 1 deletion test.cpp → test/test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "base64.h"
#include <cpp-base64/base64.h>
#include <iostream>

int main() {
Expand Down