diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..105500a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.7.2) +project(cellar) + +find_package(PythonInterp) + +include_directories(include) + +set(coggedfiles) + +file(GLOB cogfiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/*.cog") + +foreach(cogfile ${cogfiles}) + string(REGEX REPLACE ".in\$" "" outfile "${cogfile}") + set(thisfile "${CMAKE_CURRENT_SOURCE_DIR}/${outfile}") + + add_custom_command(OUTPUT "${outfile}" + COMMAND ${PYTHON_EXECUTABLE} -m cogapp -d -o "${outfile}" "${cogfile}" + DEPENDS ${cogfile} + COMMENT "Greasing the cog for ${outfile}") + + set(coggedfiles ${coggedfiles} ${thisfile}) +endforeach(cogfile) + +add_custom_target(cog ALL DEPENDS ${cogfiles}) + +add_executable(cellar src/cellar.cpp src/commands.cpp src/fs.cpp + src/bottles.cpp src/version.cpp) +add_dependencies(cellar cog) diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 282d9b3..0000000 --- a/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 -EXTRA_DIST = bootstrap -SUBDIRS = src diff --git a/bootstrap b/bootstrap index dc68b4d..0a97620 100644 --- a/bootstrap +++ b/bootstrap @@ -1,7 +1,3 @@ #!/bin/sh -if [ ! -d "m4" ]; then - mkdir m4 -fi - -autoreconf --install +cmake . diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 6c8a7d6..0000000 --- a/configure.ac +++ /dev/null @@ -1,32 +0,0 @@ -AC_INIT([cellar], [0]) -AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) - -AC_CONFIG_MACRO_DIR([m4]) - -AC_PROG_CXX -AX_CXX_COMPILE_STDCXX_11 - -AC_PATH_PROG([COG], [cog], [not found]) -if test "$COG" == "not found" ; then - AC_PATH_PROG([COGPY], [cog.py], [not found]) - if test "$COGPY" == "not found" ; then - AC_MSG_ERROR(["Please install the Cog code generator, probably via "pip install cogapp"]) - fi - COG="$COGPY" - AC_SUBST(COG) -fi - -AX_CXX_HAVE_SSTREAM -PKG_CHECK_MODULES([TCLAP], [tclap >= 1.2.1]) - -AX_BOOST_BASE([1.63], , [AC_MSG_ERROR([boost 1.63 required])]) -AX_BOOST_SYSTEM -AX_BOOST_FILESYSTEM - -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([ - Makefile - src/Makefile -]) - -AC_OUTPUT diff --git a/src/bottles.hpp b/include/bottles.hpp similarity index 100% rename from src/bottles.hpp rename to include/bottles.hpp diff --git a/src/cellar.hpp b/include/cellar.hpp similarity index 100% rename from src/cellar.hpp rename to include/cellar.hpp diff --git a/src/commands.hpp b/include/commands.hpp similarity index 100% rename from src/commands.hpp rename to include/commands.hpp diff --git a/src/fs.hpp b/include/fs.hpp similarity index 100% rename from src/fs.hpp rename to include/fs.hpp diff --git a/src/json.hpp b/include/json.hpp similarity index 100% rename from src/json.hpp rename to include/json.hpp diff --git a/src/version.hpp b/include/version.hpp similarity index 100% rename from src/version.hpp rename to include/version.hpp diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 9bf5dc7..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -bin_PROGRAMS = cellar -cellar_CPPFLAGS = $(BOOST_CPPFLAGS) -cellar_LDFLAGS = $(BOOST_LDFLAGS) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) -cellar_SOURCES = commands.cpp cellar.cpp fs.cpp bottles.cpp - -# Generated files -nodist_cellar_SOURCES = version.cpp - -CLEANFILES = version.cpp - -version.cpp: - $(COG) -d -o version.cpp version.cpp.cog