From 06d3db43701c893f03a1a94f7ec6d189cb8e3d27 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Mon, 18 Dec 2017 20:59:29 -0800 Subject: [PATCH] Switch to autotools. --- CMakeLists.txt | 64 ------------------------------------------------- CMakePack.txt | 18 -------------- CMakeTests.txt | 12 ---------- Makefile.am | 2 ++ autobuild | 29 ++++++++++++++++++++++ configure.ac | 23 ++++++++++++++++++ src/Makefile.am | 7 ++++++ 7 files changed, 61 insertions(+), 94 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 CMakePack.txt delete mode 100644 CMakeTests.txt create mode 100644 Makefile.am create mode 100644 autobuild create mode 100644 configure.ac create mode 100644 src/Makefile.am diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index a0d3833..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -SET(MAKE_VERBOSE_MAKEFILE ON) -SET(CMAKE_BUILD_TYPE Debug CACHE STRING "default to debug" FORCE) -set(CXX_EXTENSIONS OFF) - -# Basic project setup. -cmake_minimum_required(VERSION 3.5) # Xenial's CMake version. -project(ods) -set (${PROJECT_NAME}_VERSION_MAJOR 0) -set (${PROJECT_NAME}_VERSION_MINOR 1) - -# Require clang. -set(CC clang) -set(CXX clang++) - -# Set C++ compile flags for all builds. -add_compile_options(-Wall -Wextra -pedantic -Wshadow -Wpointer-arith) -add_compile_options(-Wcast-align -Wwrite-strings -Wmissing-declarations) -add_compile_options(-Werror -Wunused-variable -fno-elide-constructors) - -# These might be contentious. -add_compile_options(-Weffc++) -# add_compile_options(-std=c++14) - -if(CMAKE_BUILD_TYPE MATCHES DEBUG) -add_compile_options(-O0) -endif() - -if (CMAKE_BUILD_TYPE MATCHES RELEASE) -add_compile_options(-O2) -endif() - -if(CMAKE_GENERATOR MATCHES "Unix Makefiles") -SET(CMAKE_COLOR_MAKEFILE ON) -SET(CMAKE_VERBOSE_MAKEFILE ON) -endif() - -file(GLOB_RECURSE SOURCES src/*.cc src/*.cpp) -file(GLOB_RECURSE HEADERS include/*.h) -file(GLOB HEADIRS include/*) # ha ha ha - -include_directories(include test/include) - -# Build shared library that can be reloaded while testing. -add_library(${PROJECT_NAME} SHARED ${SOURCES}) - -# Add static library for inclusion in final builds. -add_library(${PROJECT_NAME}-static STATIC ${SOURCES}) - -# Require C++14. -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) -set_property(TARGET ${PROJECT_NAME}-static PROPERTY CXX_STANDARD 14) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -set_property(TARGET ${PROJECT_NAME}-static PROPERTY CXX_STANDARD_REQUIRED ON) - -# Set up the library installation target. -install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) -install(TARGETS ${PROJECT_NAME}-static DESTINATION lib/${PROJECT_NAME}) - -# Install the headers. -install(DIRECTORY ${HEADIRS} DESTINATION include/${PROJECT_NAME}) - -# include(CMakeTests.txt) -# include(CMakePack.txt) \ No newline at end of file diff --git a/CMakePack.txt b/CMakePack.txt deleted file mode 100644 index 45ed2b2..0000000 --- a/CMakePack.txt +++ /dev/null @@ -1,18 +0,0 @@ -# build a CPack driven installer package -include(InstallRequiredSystemLibraries) -set(CPACK_RESOURCE_FILE_LICENSE - "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") -set(CPACK_PACKAGE_VERSION_MAJOR "${${PROJECT_NAME}_VERSION_MAJOR}") -set(CPACK_PACKAGE_VERSION_MINOR "${${PROJECT_NAME}_VERSION_MINOR}") - -# Debian settings -set(CPACK_DEBIAN_PACKAGE_MAINTAINER "K. Isom") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "library of data structures") -set(CPACK_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION}) -set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc++1 (>= 3.7.0-1)") -# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA -set(CPACK_DEBIAN_PACKAGE_SECTION devel) - -# actually do the thing -set(CPACK_GENERATOR DEB) -include (CPack) \ No newline at end of file diff --git a/CMakeTests.txt b/CMakeTests.txt deleted file mode 100644 index d37b306..0000000 --- a/CMakeTests.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Set up tests. -enable_testing() - -# sctest tests -add_executable(simple_suite_example test/test/simple_suite_example.cpp) -target_link_libraries(simple_suite_example ${PROJECT_NAME}-static) -add_test(SimpleSuite_example, simple_suite_example) - -# math tests -add_executable(geom2d_test test/math/geom2d_test.cpp) -target_link_libraries(geom2d_test ${PROJECT_NAME}-static) -add_test(geom2d_test geom2d_test) \ No newline at end of file diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..7b571e6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,2 @@ +ACLOCAL_AMFLAGS = -I m4 +SUBDIRS = src \ No newline at end of file diff --git a/autobuild b/autobuild new file mode 100644 index 0000000..b9dcb72 --- /dev/null +++ b/autobuild @@ -0,0 +1,29 @@ +#!/bin/sh +set -eux + +command -v clang 2>&1 > /dev/null && CXX=clang++ +CXX=${CXX:-g++} +CONFOPTS="CXX=$CXX" + +SILENT="${SILENT:-yes}" +if [ "${SILENT}" = "yes" ] +then + CONFOPTS="$CONFOPTS --enable-silent-rules" +fi + +[ -d m4 ] || mkdir m4 + +if [ "$(uname -o)" = "Android" ] +then + SRCDIR="$(pwd)" + BUILDDIR=$HOME/build/ods + [ -d "$BUILDDIR" ] && rm -rf $BUILDDIR + mkdir -p $BUILDDIR && cd $BUILDDIR + autoreconf -i $SRCDIR + bash $SRCDIR/configure $CONFOPTS +else + autoreconf -i + ./configure $CONFOPTS +fi +pwd +make diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..fb3e1a7 --- /dev/null +++ b/configure.ac @@ -0,0 +1,23 @@ +# autoconf version 2.68 and automake version 1.11 seem to be the latest +# versions that can be used with Travis right now. +AC_PREREQ([2.68]) +AC_INIT([ods], + [0.1.0], + [coder@kyleisom.net], + [ods], + [https://github.com/kisom/ods/]) +AM_INIT_AUTOMAKE([1.11 foreign]) + +AC_CONFIG_SRCDIR([src/ch01ex01.cc]) +AC_CONFIG_FILES([Makefile src/Makefile]) +AC_CONFIG_MACRO_DIR([m4]) + +PKG_PROG_PKG_CONFIG +AC_CHECK_HEADERS + +LT_INIT +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_CC_C_O + +AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..289d240 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,7 @@ +AM_CPPFLAGS = -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align +AM_CPPFLAGS += -Wwrite-strings -Wmissing-declarations -Wno-long-long -Werror +AM_CPPFLAGS += -Wunused-variable -std=c++14 -D_XOPEN_SOURCE -O0 -g -I. +AM_CPPFLAGS += -fno-elide-constructors -Weffc++ + +bin_PROGRAMS := ch01ex01 +ch01ex01_SOURCES := ch01ex01.cc \ No newline at end of file