mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
More CMake work: Build swig wrappers correctly. Build gnc-module.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18736 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
1c3889b359
commit
a75e6bd547
@ -6,6 +6,12 @@
|
||||
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
|
||||
PROJECT (gnucash)
|
||||
|
||||
# Extra cmake macros
|
||||
SET (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules;${CMAKE_MODULE_PATH}")
|
||||
INCLUDE (MacroAppendForeach)
|
||||
INCLUDE (MacroAddSourceFileCompileFlags)
|
||||
INCLUDE (GncAddSwigCommand)
|
||||
|
||||
# ############################################################
|
||||
|
||||
# Find pkg-config
|
||||
@ -24,13 +30,23 @@ FIND_PATH (LIBINTL_INCLUDE_PATH NAMES libintl.h
|
||||
FIND_PATH (REGEX_INCLUDE_PATH NAMES regex.h
|
||||
PATHS /usr/include /opt/gnome/include)
|
||||
|
||||
# ############################################################
|
||||
|
||||
FIND_PACKAGE (SWIG REQUIRED)
|
||||
INCLUDE (${SWIG_USE_FILE})
|
||||
|
||||
#FIND_PACKAGE (GUILE REQUIRED)
|
||||
|
||||
# Workaround to create a dummy swig-runtime.h file
|
||||
FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/swig-runtime.h "")
|
||||
# Command to generate the swig-runtime.h header
|
||||
SET (SWIG_RUNTIME_H ${CMAKE_BINARY_DIR}/swig-runtime.h)
|
||||
ADD_CUSTOM_COMMAND (
|
||||
OUTPUT ${SWIG_RUNTIME_H}
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/CMakeLists.txt
|
||||
COMMAND ${SWIG_EXECUTABLE} -guile -external-runtime ${SWIG_RUNTIME_H}
|
||||
)
|
||||
|
||||
# Add a custom target to drive the custom command.
|
||||
ADD_CUSTOM_TARGET (swig-runtime-h ALL DEPENDS ${SWIG_RUNTIME_H})
|
||||
|
||||
# ############################################################
|
||||
|
||||
@ -166,7 +182,8 @@ FILE (APPEND ${CONFIG_H} "
|
||||
# ############################################################
|
||||
|
||||
# The subdirectories
|
||||
ADD_SUBDIRECTORY (libqof)
|
||||
#ADD_SUBDIRECTORY (libqof)
|
||||
ADD_SUBDIRECTORY (core-utils)
|
||||
ADD_SUBDIRECTORY (gnc-module)
|
||||
ADD_SUBDIRECTORY (engine)
|
||||
|
||||
|
29
src/cmake_modules/COPYING-CMAKE-SCRIPTS.txt
Normal file
29
src/cmake_modules/COPYING-CMAKE-SCRIPTS.txt
Normal file
@ -0,0 +1,29 @@
|
||||
The copyright notice below applies to all files in the cmake_modules/
|
||||
directory. Some of them were published on
|
||||
http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules, others on
|
||||
http://cmake-modules.googlecode.com/svn/trunk/Modules/.
|
||||
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
15
src/cmake_modules/GncAddSwigCommand.cmake
Normal file
15
src/cmake_modules/GncAddSwigCommand.cmake
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2010, Christian Stimming
|
||||
|
||||
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
MACRO (GNC_ADD_SWIG_COMMAND _target _input)
|
||||
|
||||
ADD_CUSTOM_COMMAND (
|
||||
OUTPUT ${_target}
|
||||
DEPENDS ${_input} ${CMAKE_SOURCE_DIR}/base-typemaps.i ${ARGN}
|
||||
COMMAND ${SWIG_EXECUTABLE} -guile ${SWIG_ARGS} -Linkage module -I${CMAKE_SOURCE_DIR}/libqof/qof -I${CMAKE_SOURCE_DIR} -o ${_target} ${_input}
|
||||
)
|
||||
|
||||
ENDMACRO (GNC_ADD_SWIG_COMMAND)
|
19
src/cmake_modules/MacroAddSourceFileCompileFlags.cmake
Normal file
19
src/cmake_modules/MacroAddSourceFileCompileFlags.cmake
Normal file
@ -0,0 +1,19 @@
|
||||
# - MACRO_ADD_SOURCE_FILE_COMPILE_FLAGS(<_target> "flags...")
|
||||
|
||||
# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
MACRO (MACRO_ADD_SOURCE_FILE_COMPILE_FLAGS _sourcefile _additionalflags)
|
||||
|
||||
GET_SOURCE_FILE_PROPERTY (_flags ${_sourcefile} COMPILE_FLAGS)
|
||||
if (_flags)
|
||||
set(_flags "${_flags} ${_additionalflags}")
|
||||
else (_flags)
|
||||
set(_flags "${_additionalflags}")
|
||||
endif (_flags)
|
||||
SET_SOURCE_FILES_PROPERTIES (${_sourcefile} PROPERTIES COMPILE_FLAGS "${_flags}")
|
||||
|
||||
ENDMACRO (MACRO_ADD_SOURCE_FILE_COMPILE_FLAGS)
|
20
src/cmake_modules/MacroAppendForeach.cmake
Normal file
20
src/cmake_modules/MacroAppendForeach.cmake
Normal file
@ -0,0 +1,20 @@
|
||||
# - MACRO_APPEND_FOREACH(<_targetlist> _prefix _suffix <_sourcelist> )
|
||||
|
||||
# Copyright (c) 2009, Christian Stimming
|
||||
|
||||
# Appends each element of the <_sourcelist> to the <_targetlist>, but
|
||||
# with the _prefix prepended and _suffix appended. Note: If no suffix
|
||||
# is desired, pass an empty string ("") there.
|
||||
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
MACRO (MACRO_APPEND_FOREACH _target _prefix _suffix)
|
||||
|
||||
FOREACH (_loop_var ${ARGN})
|
||||
|
||||
SET (${_target} ${${_target}} "${_prefix}${_loop_var}${_suffix}")
|
||||
|
||||
ENDFOREACH (_loop_var)
|
||||
|
||||
ENDMACRO (MACRO_APPEND_FOREACH)
|
@ -1,4 +1,4 @@
|
||||
# CMakeLists.txt for src/libqof
|
||||
# CMakeLists.txt for src/core-utils
|
||||
|
||||
# EXPERIMENTAL! This is just a trial of how far we can get for a cmake
|
||||
# build system.
|
||||
@ -11,9 +11,11 @@ INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR} ) # for config.h
|
||||
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}) # for gnc-ui.h
|
||||
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}) # when building swig-core-utils.c
|
||||
|
||||
# FIXME: I still need to look up SWIG wrapper generation in cmake...
|
||||
#SWIG_ADD_MODULE (core_utils c swig-core-utils.i swig-core-utils.c)
|
||||
# Command to generate the swig-engine.c wrapper file
|
||||
SET (SWIG_CORE_UTILS_C ${CMAKE_CURRENT_BINARY_DIR}/swig-core-utils.c)
|
||||
GNC_ADD_SWIG_COMMAND (${SWIG_CORE_UTILS_C} ${CMAKE_CURRENT_SOURCE_DIR}/core-utils.i)
|
||||
|
||||
SET (libgnc_core_utils_SOURCES
|
||||
gnc-main.c
|
||||
@ -21,7 +23,7 @@ SET (libgnc_core_utils_SOURCES
|
||||
gnc-gdate-utils.c
|
||||
gnc-gkeyfile-utils.c
|
||||
gnc-glib-utils.c
|
||||
../gnc-module/gnc-module.c
|
||||
${SWIG_CORE_UTILS_C}
|
||||
)
|
||||
|
||||
SET (libgnc_core_utils_HEADERS
|
||||
@ -30,8 +32,6 @@ SET (libgnc_core_utils_HEADERS
|
||||
gnc-gdate-utils.h
|
||||
gnc-gkeyfile-utils.h
|
||||
gnc-glib-utils.h
|
||||
../gnc-module/gnc-module.h
|
||||
../gnc-module/gnc-module-api.h
|
||||
)
|
||||
|
||||
ADD_LIBRARY (core-utils
|
||||
|
@ -15,47 +15,6 @@ INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/gnc-module) # for gnc-glib-utils.h
|
||||
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/core-utils) # for gnc-glib-utils.h
|
||||
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}) # for <Account.h>
|
||||
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) # for gncla-dir.h
|
||||
MESSAGE(STATUS "SWIG_DIR=${SWIG_DIR}")
|
||||
# FIXME: I still need to look up SWIG wrapper generation in cmake...
|
||||
#SWIG_ADD_MODULE (engine guile swig-engine.i swig-engine.c)
|
||||
|
||||
# Workaround to create a dummy gncla-dir.h file
|
||||
FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/gncla-dir.h "")
|
||||
|
||||
SET (libgncmod_engine_SOURCES
|
||||
Account.c
|
||||
Recurrence.c
|
||||
Period.c
|
||||
Query.c
|
||||
SchedXaction.c
|
||||
SX-book.c
|
||||
SX-ttinfo.c
|
||||
Scrub.c
|
||||
Scrub2.c
|
||||
Scrub3.c
|
||||
Split.c
|
||||
TransLog.c
|
||||
Transaction.c
|
||||
binreloc.c
|
||||
cap-gains.c
|
||||
cashobjects.c
|
||||
gnc-associate-account.c
|
||||
gnc-budget.c
|
||||
# gnc-commodity.c
|
||||
gnc-engine.c
|
||||
gnc-filepath-utils.c
|
||||
gnc-hooks.c
|
||||
gnc-lot.c
|
||||
gnc-path.c
|
||||
gnc-pricedb.c
|
||||
gnc-session.c
|
||||
gnc-session-scm.c
|
||||
gncmod-engine.c
|
||||
kvp-scm.c
|
||||
engine-helpers.c
|
||||
glib-helpers.c
|
||||
policy.c
|
||||
)
|
||||
|
||||
SET (libgncmod_engine_HEADERS
|
||||
Account.h
|
||||
@ -98,8 +57,59 @@ SET (libgncmod_engine_HEADERS
|
||||
policy.h
|
||||
)
|
||||
|
||||
# Command to generate the swig-engine.c wrapper file
|
||||
SET (SWIG_ENGINE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-engine.c)
|
||||
GNC_ADD_SWIG_COMMAND (${SWIG_ENGINE_C} ${CMAKE_CURRENT_SOURCE_DIR}/engine.i)
|
||||
|
||||
# Workaround to create a very simple gncla-dir.h file
|
||||
FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/gncla-dir.h "
|
||||
#define PREFIX \"${CMAKE_INSTALL_PREFIX}\"
|
||||
#define DATADIR \"${CMAKE_INSTALL_PREFIX}/share\"
|
||||
#define SYSCONFDIR \"${CMAKE_INSTALL_PREFIX}/etc\"
|
||||
#define LIBDIR \"${CMAKE_INSTALL_PREFIX}/lib\"
|
||||
#define LOCALE_DATADIRNAME \"share\"
|
||||
")
|
||||
|
||||
SET (libgncmod_engine_SOURCES
|
||||
Account.c
|
||||
Recurrence.c
|
||||
Period.c
|
||||
Query.c
|
||||
SchedXaction.c
|
||||
SX-book.c
|
||||
SX-ttinfo.c
|
||||
Scrub.c
|
||||
Scrub2.c
|
||||
Scrub3.c
|
||||
Split.c
|
||||
TransLog.c
|
||||
Transaction.c
|
||||
binreloc.c
|
||||
cap-gains.c
|
||||
cashobjects.c
|
||||
gnc-associate-account.c
|
||||
gnc-budget.c
|
||||
# gnc-commodity.c
|
||||
gnc-engine.c
|
||||
gnc-filepath-utils.c
|
||||
gnc-hooks.c
|
||||
gnc-lot.c
|
||||
gnc-path.c
|
||||
gnc-pricedb.c
|
||||
gnc-session.c
|
||||
gnc-session-scm.c
|
||||
gncmod-engine.c
|
||||
kvp-scm.c
|
||||
engine-helpers.c
|
||||
glib-helpers.c
|
||||
policy.c
|
||||
${SWIG_ENGINE_C}
|
||||
)
|
||||
|
||||
ADD_LIBRARY (engine
|
||||
${libgncmod_engine_SOURCES}
|
||||
${libgncmod_engine_HEADERS}
|
||||
)
|
||||
|
||||
# We depend on the swig-runtime-h target
|
||||
ADD_DEPENDENCIES (engine swig-runtime-h)
|
||||
|
29
src/gnc-module/CMakeLists.txt
Normal file
29
src/gnc-module/CMakeLists.txt
Normal file
@ -0,0 +1,29 @@
|
||||
# CMakeLists.txt for src/gnc-module
|
||||
|
||||
ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.module\")
|
||||
|
||||
INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
|
||||
INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR} ) # for config.h
|
||||
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}) # for gnc-ui.h
|
||||
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}) # when building swig-gnc-module.c
|
||||
|
||||
# Command to generate the swig-engine.c wrapper file
|
||||
SET (SWIG_GNC_MODULE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnc-module.c)
|
||||
GNC_ADD_SWIG_COMMAND (${SWIG_GNC_MODULE_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnc-module.i)
|
||||
|
||||
SET (libgnc_module_SOURCES
|
||||
gnc-module.c
|
||||
${SWIG_GNC_MODULE_C}
|
||||
)
|
||||
|
||||
SET (libgnc_module_HEADERS
|
||||
gnc-module.h
|
||||
gnc-module-api.h
|
||||
)
|
||||
|
||||
ADD_LIBRARY (gnc-module
|
||||
${libgnc_module_SOURCES}
|
||||
${libgnc_module_HEADERS}
|
||||
)
|
@ -12,8 +12,10 @@ INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR} ) # for config.h
|
||||
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/../lib/libc) # for strptime.h
|
||||
|
||||
|
||||
# Workaround to create a qofla-dir.h file
|
||||
FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/qofla-dir.h "#define QOF_LIB_DIR \"foobar\"\n")
|
||||
# Workaround to create a very simple gncla-dir.h file
|
||||
FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/qofla-dir.h "
|
||||
#define QOF_LIB_DIR \"${CMAKE_INSTALL_PREFIX}/lib/gnucash\"
|
||||
")
|
||||
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) # for qofla-dir.h
|
||||
|
||||
SET (libgnc_qof_SOURCES
|
||||
|
Loading…
Reference in New Issue
Block a user