Make a separate library.

This is required for gtkdoc-scangobj. So far it's much like it's been
before, the main differences are that source files are in two directories
from now on and the build process has two stages.
This commit is contained in:
Přemysl Eric Janouch 2011-01-10 16:49:13 +01:00
parent 63b36a2b5b
commit 616c49a505
29 changed files with 48 additions and 38 deletions

View File

@ -79,37 +79,41 @@ find_package (GtkDoc)
set (project_DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/reference")
# Project source files
set (logdiag_SOURCES
src/logdiag.c
src/ld-marshal.c
src/ld-types.c
src/ld-window-main.c
src/ld-diagram.c
src/ld-diagram-object.c
src/ld-diagram-symbol.c
src/ld-canvas.c
src/ld-library.c
src/ld-symbol-category.c
src/ld-symbol.c
src/ld-lua.c
src/ld-lua-symbol.c)
set (logdiag_HEADERS
set (liblogdiag_SOURCES
liblogdiag/ld-marshal.c
liblogdiag/ld-types.c
liblogdiag/ld-diagram.c
liblogdiag/ld-diagram-object.c
liblogdiag/ld-diagram-symbol.c
liblogdiag/ld-canvas.c
liblogdiag/ld-library.c
liblogdiag/ld-symbol-category.c
liblogdiag/ld-symbol.c
liblogdiag/ld-lua.c
liblogdiag/ld-lua-symbol.c)
set (liblogdiag_HEADERS
${CMAKE_CURRENT_BINARY_DIR}/config.h
src/liblogdiag.h
src/ld-marshal.h
src/ld-types.h
src/ld-window-main.h
src/ld-diagram.h
src/ld-diagram-object.h
src/ld-diagram-symbol.h
src/ld-canvas.h
src/ld-library.h
src/ld-symbol-category.h
src/ld-symbol.h
src/ld-lua.h
src/ld-lua-private.h
src/ld-lua-symbol.h
src/ld-lua-symbol-private.h)
liblogdiag/liblogdiag.h
liblogdiag/ld-marshal.h
liblogdiag/ld-types.h
liblogdiag/ld-diagram.h
liblogdiag/ld-diagram-object.h
liblogdiag/ld-diagram-symbol.h
liblogdiag/ld-canvas.h
liblogdiag/ld-library.h
liblogdiag/ld-symbol-category.h
liblogdiag/ld-symbol.h
liblogdiag/ld-lua.h
liblogdiag/ld-lua-private.h
liblogdiag/ld-lua-symbol.h
liblogdiag/ld-lua-symbol-private.h)
set (logdiag_SOURCES
src/ld-window-main.c
src/logdiag.c)
set (logdiag_HEADERS
${liblogdiag_HEADERS}
src/ld-window-main.h)
# Generate a configure file
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
@ -151,18 +155,24 @@ function (glib_genmarshal base prefix)
endif (GLIB_GENMARSHAL_EXECUTABLE)
endfunction (glib_genmarshal)
glib_genmarshal (${CMAKE_CURRENT_SOURCE_DIR}/src/ld-marshal
glib_genmarshal (${CMAKE_CURRENT_SOURCE_DIR}/liblogdiag/ld-marshal
g_cclosure_user_marshal)
# Build the executable
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/liblogdiag)
include_directories (${GTK2_INCLUDE_DIRS} ${JSON_GLIB_INCLUDE_DIRS} ${LUA_INCLUDE_DIR})
# Build the library
add_library (liblogdiag STATIC ${liblogdiag_SOURCES} ${liblogdiag_HEADERS})
set_target_properties (liblogdiag PROPERTIES OUTPUT_NAME logdiag)
# Build the executable
add_executable (logdiag ${logdiag_SOURCES} ${logdiag_HEADERS})
target_link_libraries (logdiag ${GTK2_LIBRARIES} ${JSON_GLIB_LIBRARIES} ${LUA_LIBRARIES})
target_link_libraries (logdiag liblogdiag ${GTK2_LIBRARIES} ${JSON_GLIB_LIBRARIES} ${LUA_LIBRARIES})
# Generate documentation
if (GTK_DOC_FOUND)
GTK_DOC_RUN (WORKING_DIR ${project_DOC_DIR}
SOURCE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src
SOURCE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/liblogdiag
XML ${project_DOC_DIR}/xml --sgml-mode
HTML ${project_DOC_DIR}/html)
endif (GTK_DOC_FOUND)

View File

@ -4,6 +4,9 @@
# is that the translator should not need to run
# the whole configure process to get this single stupid file.
# Source files
SOURCES=$(echo ../{src,liblogdiag}/*.c)
# Get the package name from CMakeLists.txt
PACKAGE=$(sed -n '/^[ \t]*[pP][rR][oO][jJ][eE][cC][tT][ \t]*([ \t]*\([^ \t)]\{1,\}\).*).*/{s//\1/p;q}' \
../CMakeLists.txt)
@ -27,7 +30,7 @@ if [ "$MAJOR" != "" ]; then
fi
# Finally make the template
xgettext -LC -k_ -kN_:1,2 -kG_ ../src/*.c -o "$PACKAGE".pot \
xgettext -LC -k_ -kN_:1,2 -kG_ $SOURCES -o "$PACKAGE".pot \
--package-name="$PACKAGE" --package-version="$VERSION" \
--copyright-holder="Přemysl Janouch"

View File

@ -22,9 +22,6 @@
*
* #LdWindowMain is the main window of the application.
*/
/* NOTE: The main window should not maybe be included in either
* the documentation or the static library.
*/
/*
* SymbolMenuItem: