From 39796bce97301e5e8dfb89f83287533b7db0dbbe Mon Sep 17 00:00:00 2001 From: Friedrich Wiemer Date: Tue, 26 Jan 2016 15:17:45 +0100 Subject: [PATCH 1/4] remove handwritten makefile and replace it with cmake build project by: cd build && cmake .. && make --- .gitignore | 6 +++++ CMakeLists.txt | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 59 ------------------------------------------------ 3 files changed, 67 insertions(+), 59 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile diff --git a/.gitignore b/.gitignore index b4224c1..0522baa 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,9 @@ lin # vim tmp files *.swp *~ + +# cmake files +build/CMakeCache.txt +build/CMakeFiles/ +build/Makefile +build/cmake_install.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..66c30b7 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,61 @@ +cmake_minimum_required (VERSION 3.0) +project (lineartrails) + +set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) + +set (CMAKE_CXX_FLAGS "-Wall -Wpedantic -std=c++11") +set (CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG") +set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g") + +add_executable (lin + tool/main.cpp + + tinyxml2/tinyxml2.cpp + tinyxml2/tinyxml2.h + + tool/cache.h + tool/cache.hpp + tool/commandlineparser.cpp + tool/commandlineparser.h + tool/configparser.cpp + tool/configparser.h + tool/guessmask.cpp + tool/guessmask.h + tool/layer.cpp + tool/layer.h + tool/lrucache.h + tool/lrucache.hpp + tool/mask.cpp + tool/mask.h + tool/permutation.cpp + tool/permutation.h + tool/permutation_list.cpp + tool/permutation_list.h + tool/search.cpp + tool/search.h + tool/statemask.h + tool/statemask.hpp + tool/step_linear.h + tool/step_linear.hpp + tool/step_nonlinear.h + tool/step_nonlinear.hpp + + target/ascon.cpp + target/ascon.h + target/ascon_permutation.cpp + target/ascon_permutation.h + target/icepole.cpp + target/icepole.h + target/icepole_permutation.cpp + target/icepole_permutation.h + target/keccak1600.cpp + target/keccak1600.h + target/keccak1600_permutation.cpp + target/keccak1600_permutation.h + target/prost256.cpp + target/prost256.h + target/prost256_permutation.cpp + target/prost256_permutation.h +) +target_compile_definitions (lin PRIVATE -DTERMINALCOLORS) +target_include_directories (lin PRIVATE tool/ target/) diff --git a/Makefile b/Makefile deleted file mode 100644 index 7a1a5f1..0000000 --- a/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -SHELL=/bin/sh -.SUFFIXES: -.SUFFIXES: .cpp .h .o - -CXX=g++ -CXXFLAGS=-c -Wall -march=native -std=c++11 -DTERMINALCOLORS -FASTFLAGS=-O3 -DEBUGFLAGS=-g -CLUSTERCXXFLAGS=-c -Wall -std=c++11 -O3 -#LDFLAGS=-pthread -LDFLAGS= -SRC_DIR=tool target -BUILD_DIR=build -SOURCES=$(foreach srcdir,$(SRC_DIR),$(wildcard $(srcdir)/*.cpp)) -#OBJECTS=$(addprefix build/,${SOURCES:.cpp=.o}) -OBJECTS=$(foreach srcdir,$(SRC_DIR),$(patsubst $(srcdir)/%.cpp,$(BUILD_DIR)/%.o,$(filter $(srcdir)/%.cpp,$(SOURCES)))) -INCLUDES=$(addprefix -I,$(SRC_DIR)) -vpath %.cpp $(SRC_DIR) -vpath %.h $(SRC_DIR) -vpath %.hpp $(SRC_DIR) -TITLE=lin - -.PHONY : all clean - -# make all -all: fast - -# make fast -fast: CXXFLAGS += $(FASTFLAGS) -fast: $(TITLE) - -# make fastdebug -fastdebug: CXXFLAGS += $(FASTFLAGS) $(DEBUGFLAGS) -fastdebug: $(TITLE) - -# make debug -debug: CXXFLAGS += $(DEBUGFLAGS) -debug: $(TITLE) - -# make cluster -cluster: CXXFLAGS = $(CLUSTERCXXFLAGS) -cluster: $(TITLE) - -# make -$(TITLE): $(OBJECTS) $(BUILD_DIR)/tinyxml2.o - $(CXX) -g -o $@ $^ $(INCLUDES) $(LDFLAGS) - -# make %.o -$(BUILD_DIR)/%.o: %.cpp - $(CXX) $(CXXFLAGS) -o $@ $< -MMD -MF ./$@.d $(INCLUDES) $(LDFLAGS) - -$(BUILD_DIR)/tinyxml2.o: tinyxml2/tinyxml2.cpp - $(CXX) $(CXXFLAGS) -o $@ tinyxml2/tinyxml2.cpp -MMD -MF ./$@.d $(LDFLAGS) - -# make clean -clean: - rm -f $(BUILD_DIR)/*.o $(BUILD_DIR)/*.d $(TITLE) - --include $(wildcard $(BUILD_DIR)/*.d) From 161fc1c22dec2361c212700743d80825d04362ae Mon Sep 17 00:00:00 2001 From: Friedrich Wiemer Date: Tue, 26 Jan 2016 15:20:58 +0100 Subject: [PATCH 2/4] updated readme with cmake build instructions --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6260025..034b154 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,10 @@ Build git submodule init && git submodule update ``` -To build: +The build system is created by cmake, so after checking out the git repository, do: ``` -make +cd build && cmake .. && make ``` @@ -36,7 +36,7 @@ The folder ./examples contains example search configuration for Ascon, ICEPOLE, Keyak, Minalpher and Proest. To start a search simply call for instance: ``` -./lin -I 10 -S 2 -i examples/ascon_3_rounds_typeI.xml +bin/lin -I 10 -S 2 -i examples/ascon_3_rounds_typeI.xml ``` * `-I` determines how often status information of the search is displayed. From 5b6919f48d4a8ba111238ea434da0d92b37fe291 Mon Sep 17 00:00:00 2001 From: Friedrich Wiemer Date: Tue, 26 Jan 2016 15:25:51 +0100 Subject: [PATCH 3/4] removed unnecessary gitignore --- build/.gitignore | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 build/.gitignore diff --git a/build/.gitignore b/build/.gitignore deleted file mode 100644 index 378671a..0000000 --- a/build/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Compiled Object files -*.d -*.o From ed00c49709049625fea1cce9f32f6216b93c0503 Mon Sep 17 00:00:00 2001 From: Friedrich Wiemer Date: Tue, 26 Jan 2016 15:30:05 +0100 Subject: [PATCH 4/4] fix build instructions (added "mkdir build") --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 034b154..3a0debd 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ git submodule init && git submodule update The build system is created by cmake, so after checking out the git repository, do: ``` -cd build && cmake .. && make +mkdir build && cd build && cmake .. && make && cd .. ```