diff --git a/.gitignore b/.gitignore index 88ffc13..796b96d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/opustags -/opustags.1.gz +/build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8131449 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.9) + +project( + opustags + VERSION 1.2.0 + LANGUAGES CXX +) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +include(FindPkgConfig) +pkg_check_modules(OGG REQUIRED ogg) + +add_executable(opustags opustags.cc) +target_compile_options(opustags PUBLIC ${OGG_CFLAGS}) +target_link_libraries(opustags PUBLIC ${OGG_LIBRARIES}) + +include(GNUInstallDirs) +install(TARGETS opustags DESTINATION "${CMAKE_INSTALL_BINDIR}") +install(FILES opustags.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") + +add_custom_target(check COMMAND prove "${CMAKE_SOURCE_DIR}/t") diff --git a/Makefile b/Makefile deleted file mode 100644 index 0981d2f..0000000 --- a/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -DESTDIR=/usr/local -MANDEST=share/man -CXXFLAGS=-Wall -std=c++14 -LDFLAGS=-logg - -all: opustags - -opustags: opustags.cc - -man: opustags.1 - gzip opustags.1.gz - -install: opustags man - mkdir -p $(DESTDIR)/bin $(DESTDIR)/$(MANDEST)/man1 - install -m 755 opustags $(DESTDIR)/bin/ - install -m 644 opustags.1.gz $(DESTDIR)/$(MANDEST)/man1/ - -uninstall: - rm -f $(DESTDIR)/bin/opustags - rm -f $(DESTDIR)/$(MANDEST)/man1/opustags.1.gz - -clean: - rm -f opustags opustags.1.gz - -check: opustags - prove - -.PHONY: all man install uninstall clean check diff --git a/README.md b/README.md index 1349c29..fb37aee 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,24 @@ Requirements ------------ * a C++14 compiler, +* CMake, * a POSIX-compliant system, * libogg. Installing ---------- +opustags is a commonplace CMake project. + +Here's how to install it in your .local, under your home: + + mkdir build + cd build + cmake -DCMAKE_INSTALL_PREFIX=~/.local .. make - make DESTDIR=/usr/local install + make install + +Note that you don't need to install opustags in order to run it, as the executable is standalone. Documentation -------------