Browse Source

Remove waf, require cmake 2.6.0

master
Stefan Bühler 13 years ago
parent
commit
62dbd731f6
  1. 19
      CMakeLists.txt
  2. BIN
      waf
  3. 80
      wscript

19
CMakeLists.txt

@ -1,4 +1,6 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0 FATAL_ERROR)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
cmake_policy(VERSION 2.6.0)
MACRO(ADD_TARGET_PROPERTIES _target _name _properties)
SET(_properties ${ARGV})
@ -18,6 +20,9 @@ SET(PACKAGE_VERSION 1.0)
EXEC_PROGRAM(date ARGS "'+%b %d %Y %H:%M:%S UTC'" OUTPUT_VARIABLE PACKAGE_BUILD_DATE)
OPTION(USE_LIMITS "Enable /etc/security/limits.conf support" ON)
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
# GLIB 2
INCLUDE(FindPkgConfig)
@ -40,13 +45,13 @@ ADD_TARGET_PROPERTIES(spawn-fcgi COMPILE_FLAGS "-std=gnu99 -Wall -g -Wshadow -W
# GLIB 2
ADD_TARGET_PROPERTIES(spawn-fcgi LINK_FLAGS "${GLIB2_LDFLAGS}")
ADD_TARGET_PROPERTIES(spawn-fcgi COMPILE_FLAGS "${GLIB2_CFLAGS_OTHER}")
ADD_TARGET_PROPERTIES(spawn-fcgi COMPILE_DEFINITIONS "PACKAGE_NAME=${CMAKE_PROJECT_NAME}" PACKAGE_VERSION="${PACKAGE_VERSION}" PACKAGE_BUILD_DATE="${PACKAGE_BUILD_DATE}")
ADD_DEFINITIONS(
-DPACKAGE_NAME="\\"${CMAKE_PROJECT_NAME}\\""
-DPACKAGE_VERSION="\\"${PACKAGE_VERSION}\\""
-DPACKAGE_BUILD_DATE="\\"${PACKAGE_BUILD_DATE}\\""
)
#ADD_DEFINITIONS(
# -DPACKAGE_NAME="\\"${CMAKE_PROJECT_NAME}\\""
# -DPACKAGE_VERSION="\\"${PACKAGE_VERSION}\\""
# -DPACKAGE_BUILD_DATE="\\"${PACKAGE_BUILD_DATE}\\""
# )
INSTALL(TARGETS spawn-fcgi DESTINATION bin)

BIN
waf

80
wscript

@ -1,80 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
import Options, types, sys, Runner
from time import gmtime, strftime, timezone
# the following two variables are used by the target "waf dist"
VERSION='1.0'
APPNAME='spawn-fcgi'
# these variables are mandatory ('/' are converted automatically)
srcdir = '.'
blddir = 'build'
def set_options(opt):
opt.tool_options('compiler_cc')
opt.add_option('--without-limits', action='store_false', help='without /etc/security/limits.conf support', dest = 'limits', default = True)
def tolist(x):
if type(x) is types.ListType:
return x
return [x]
def PKGCONFIG(conf, name, uselib = None, define = '', version = '', mandatory = 0):
if not uselib: uselib = name
hconf = conf.create_pkgconfig_configurator()
hconf.name = name
hconf.version = version
hconf.uselib_store = uselib
hconf.define = define
hconf.mandatory = mandatory
res = hconf.run()
return res
def configure(conf):
opts = Options.options
conf.check_tool('compiler_cc')
if opts.limits:
conf.define("USE_LIMITS", 1)
conf.env['USE_LIMITS'] = opts.limits
conf.define("PACKAGE_NAME", APPNAME)
conf.define("PACKAGE_VERSION", VERSION)
conf.define("PACKAGE_BUILD_DATE", strftime("%b %d %Y %H:%M:%S UTC", gmtime()));
common_ccflags = [
'-std=gnu99', '-Wall', '-g', '-Wshadow', '-W', '-pedantic',
'-fPIC',
'-DHAVE_CONFIG_H', '-D_GNU_SOURCE',
]
conf.env['CCFLAGS_spawnfcgi'] += common_ccflags
PKGCONFIG(conf, "glib-2.0", uselib = 'glib', mandatory = 1)
incdir = conf.env['CPPPATH_glib'][0]
conf.env['CPPPATH_glib'] += [ incdir+'/glib-2.0/', incdir + '/glib-2.0/include/' ]
# CHECK_INCLUDE_FILES(conf, "glib.h", "HAVE_GLIB_H", uselib = 'glib', use = ['glib'], mandatory = 1)
conf.write_config_header('config.h')
main_source = '''
spawn-fcgi.c
'''
limits_source = '''
pam_limits.c
'''
def build(bld):
env = bld.env
spawnfcgi = bld.new_task_gen('cc', 'program')
spawnfcgi.name = 'spawn-fcgi'
spawnfcgi.source = main_source
if env['USE_LIMITS']:
spawnfcgi.source += limits_source
spawnfcgi.target = 'spawn-fcgi'
spawnfcgi.uselib += 'glib spawnfcgi'
spawnfcgi.includes = '.'
Loading…
Cancel
Save