switch to cmake for build system

This commit is contained in:
Nicholas O'Connor 2017-03-23 01:03:33 -07:00
parent 44a831a4b0
commit fc09bf57dc
11 changed files with 30 additions and 52 deletions

29
CMakeLists.txt Normal file
View File

@ -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)

View File

@ -1,3 +0,0 @@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = bootstrap
SUBDIRS = src

View File

@ -1,7 +1,3 @@
#!/bin/sh #!/bin/sh
if [ ! -d "m4" ]; then cmake .
mkdir m4
fi
autoreconf --install

View File

@ -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

View File

@ -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