Compare commits

...

2 Commits

Author SHA1 Message Date
c73199e6d6 Move to CMake 2022-03-03 07:34:08 +01:00
1f625c830f Added files to gitignore 2022-03-03 07:33:55 +01:00
3 changed files with 47 additions and 48 deletions

4
.gitignore vendored
View File

@ -4,3 +4,7 @@ menuprint
.lvimrc
example.*
dhparam*
.cache
.clang-format
build
compile_commands.json

43
CMakeLists.txt Normal file
View File

@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
enable_language(CXX)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBXML REQUIRED libxml-2.0)
pkg_check_modules(LIBXMLPP REQUIRED libxml++-3.0)
find_library(Restbed restbed
PATHS /usr/lib)
find_library(Curl curl
PATHS /usr/lib)
project(LunchRest)
list(APPEND Restaurants
restaurants/udrevaka.cpp
restaurants/padagali.cpp
restaurants/lightofindia.cpp
restaurants/ukarla.cpp
restaurants/alcapone.cpp
restaurants/plac.cpp
restaurants/zo.cpp
restaurants/suzies.cpp
restaurants/tao.cpp
restaurants/mahostina.cpp
)
add_executable(lunchrest)
target_sources(lunchrest
PRIVATE ${Restaurants}
PRIVATE main.cpp
PRIVATE meal.cpp
PRIVATE menu.cpp
PRIVATE network/network.cpp
PRIVATE restaurants/restaurants.cpp
PRIVATE environment.cpp
)
target_link_libraries(lunchrest ${LIBXML_LIBRARIES} ${LIBXMLPP_LIBRARIES} ${Restbed} ${Curl})
target_include_directories(lunchrest PUBLIC ${LIBXML_INCLUDE_DIRS} ${LIBXMLPP_INCLUDE_DIRS})

View File

@ -1,48 +0,0 @@
CXX ?= g++
CFLAGS ?= -O2 -Wall -Wextra `pkg-config libxml-2.0 --cflags` `pkg-config libxml++-3.0 --cflags`
PREFIX ?= /usr/local/bin
LDFLAGS ?= -lcurl -lrestbed `pkg-config libxml-2.0 --libs` `pkg-config libxml++-3.0 --libs`
PARSERS = udrevaka.o padagali.o lightofindia.o ukarla.o alcapone.o plac.o zo.o suzies.o tao.o mahostina.o
.PHONY: default
default: menuprint
menuprint: main.o meal.o menu.o network.o restaurants.o environment.o $(PARSERS)
$(CXX) $(CFLAGS) -o $@ $^ ${LDFLAGS}
main.o: main.cpp restaurant.hpp menu.hpp meal.hpp restaurants/restaurants.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
meal.o: meal.cpp meal.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
menu.o: menu.cpp menu.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
network.o: network/network.cpp network/network.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
restaurants.o: restaurants/restaurants.cpp restaurants/restaurants.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
environment.o: environment.cpp environment.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
udrevaka.o: restaurants/udrevaka.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
padagali.o: restaurants/padagali.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
lightofindia.o: restaurants/lightofindia.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
ukarla.o: restaurants/ukarla.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
alcapone.o: restaurants/alcapone.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
plac.o: restaurants/plac.cpp restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
zo.o: restaurants/zo.cpp restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
suzies.o: restaurants/suzies.cpp restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
tao.o: restaurants/tao.cpp restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
mahostina.o: restaurants/mahostina.cpp restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
clean:
rm -Rf *.o menuprint