Switch to autotools.
This commit is contained in:
parent
a35b54f308
commit
06d3db4370
|
@ -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)
|
|
|
@ -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)
|
|
|
@ -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)
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
SUBDIRS = src
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue