From ee350f15cda7a468fc319da3a16a859ed01acf77 Mon Sep 17 00:00:00 2001 From: Stephan Hilb <stephan.hilb@mathematik.uni-stuttgart.de> Date: Wed, 27 Mar 2019 17:33:59 +0100 Subject: [PATCH] add cmake files --- .gitignore | 5 +---- CMakeLists.txt | 14 ++++++++++++++ Makefile | 24 ------------------------ imageLib/CMakeLists.txt | 1 + imageLib/Makefile | 33 --------------------------------- 5 files changed, 16 insertions(+), 61 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile create mode 100644 imageLib/CMakeLists.txt delete mode 100644 imageLib/Makefile diff --git a/.gitignore b/.gitignore index b38bf6a..957eb9f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -*.o -*.a -color_flow -colortest +build/ *.png *.flo diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..cef2918 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.14) + +project(flow-code LANGUAGES CXX) + +add_subdirectory(imageLib) + + +add_executable(color_flow color_flow.cpp flowIO.cpp colorcode.cpp) +target_include_directories(color_flow PRIVATE imageLib) +target_link_libraries(color_flow PRIVATE imageLib PUBLIC png z) + +add_executable(colortest colortest.cpp colorcode.cpp) +target_include_directories(colortest PRIVATE imageLib) +target_link_libraries(colortest PRIVATE imageLib PUBLIC png z) diff --git a/Makefile b/Makefile deleted file mode 100644 index 7f9b5b8..0000000 --- a/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# Makefile for flow evaluation code - -SRC = flowIO.cpp colorcode.cpp colortest.cpp color_flow.cpp -BIN = colortest color_flow - -IMGLIB = imageLib - -CC = g++ -WARN = -W -Wall -OPT ?= -O3 -CPPFLAGS = $(OPT) $(WARN) -I$(IMGLIB) -LDLIBS = -L$(IMGLIB) -lImg -lpng -lz -EXE = $(SRC:.cpp=.exe) - -all: $(BIN) - -colortest: colortest.cpp colorcode.cpp -color_flow: color_flow.cpp flowIO.cpp colorcode.cpp - -clean: - rm -f core *.stackdump - -allclean: clean - rm -f $(BIN) $(EXE) diff --git a/imageLib/CMakeLists.txt b/imageLib/CMakeLists.txt new file mode 100644 index 0000000..d975ae0 --- /dev/null +++ b/imageLib/CMakeLists.txt @@ -0,0 +1 @@ +add_library(imageLib Convert.cpp Convolve.cpp Image.cpp ImageIO.cpp ImageIOpng.cpp RefCntMem.cpp) diff --git a/imageLib/Makefile b/imageLib/Makefile deleted file mode 100644 index 39e01fc..0000000 --- a/imageLib/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -SRC = Convert.cpp Convolve.cpp Image.cpp ImageIO.cpp ImageIOpng.cpp RefCntMem.cpp - -CC = g++ -WARN = -W -Wall -OPT ?= -O3 -CPPFLAGS = $(OPT) $(WARN) - -OBJ = $(SRC:.cpp=.o) - -all: libImg.a - -libImg.a: $(OBJ) - rm -f libImg.a - ar ruc libImg.a $(OBJ) - ranlib libImg.a - -clean: - rm -f $(OBJ) core *.stackdump *.bak - -allclean: clean - rm -f libImg.a - -depend: - @makedepend -Y -- $(CPPFLAGS) -- $(SRC) 2>> /dev/null - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -Convert.o: Image.h RefCntMem.h Error.h Convert.h -Convolve.o: Image.h RefCntMem.h Error.h Convert.h Convolve.h -Image.o: Image.h RefCntMem.h Error.h -ImageIO.o: Image.h RefCntMem.h Error.h ImageIO.h -ImageIOpng.o: Image.h RefCntMem.h Error.h -RefCntMem.o: RefCntMem.h -- GitLab