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") set (project_DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/reference")
# Project source files # Project source files
set (logdiag_SOURCES set (liblogdiag_SOURCES
src/logdiag.c liblogdiag/ld-marshal.c
src/ld-marshal.c liblogdiag/ld-types.c
src/ld-types.c liblogdiag/ld-diagram.c
src/ld-window-main.c liblogdiag/ld-diagram-object.c
src/ld-diagram.c liblogdiag/ld-diagram-symbol.c
src/ld-diagram-object.c liblogdiag/ld-canvas.c
src/ld-diagram-symbol.c liblogdiag/ld-library.c
src/ld-canvas.c liblogdiag/ld-symbol-category.c
src/ld-library.c liblogdiag/ld-symbol.c
src/ld-symbol-category.c liblogdiag/ld-lua.c
src/ld-symbol.c liblogdiag/ld-lua-symbol.c)
src/ld-lua.c set (liblogdiag_HEADERS
src/ld-lua-symbol.c)
set (logdiag_HEADERS
${CMAKE_CURRENT_BINARY_DIR}/config.h ${CMAKE_CURRENT_BINARY_DIR}/config.h
src/liblogdiag.h liblogdiag/liblogdiag.h
src/ld-marshal.h liblogdiag/ld-marshal.h
src/ld-types.h liblogdiag/ld-types.h
src/ld-window-main.h liblogdiag/ld-diagram.h
src/ld-diagram.h liblogdiag/ld-diagram-object.h
src/ld-diagram-object.h liblogdiag/ld-diagram-symbol.h
src/ld-diagram-symbol.h liblogdiag/ld-canvas.h
src/ld-canvas.h liblogdiag/ld-library.h
src/ld-library.h liblogdiag/ld-symbol-category.h
src/ld-symbol-category.h liblogdiag/ld-symbol.h
src/ld-symbol.h liblogdiag/ld-lua.h
src/ld-lua.h liblogdiag/ld-lua-private.h
src/ld-lua-private.h liblogdiag/ld-lua-symbol.h
src/ld-lua-symbol.h liblogdiag/ld-lua-symbol-private.h)
src/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 # Generate a configure file
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
@ -151,18 +155,24 @@ function (glib_genmarshal base prefix)
endif (GLIB_GENMARSHAL_EXECUTABLE) endif (GLIB_GENMARSHAL_EXECUTABLE)
endfunction (glib_genmarshal) 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) 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}) 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}) 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 # Generate documentation
if (GTK_DOC_FOUND) if (GTK_DOC_FOUND)
GTK_DOC_RUN (WORKING_DIR ${project_DOC_DIR} 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 XML ${project_DOC_DIR}/xml --sgml-mode
HTML ${project_DOC_DIR}/html) HTML ${project_DOC_DIR}/html)
endif (GTK_DOC_FOUND) endif (GTK_DOC_FOUND)

View File

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

View File

@ -22,9 +22,6 @@
* *
* #LdWindowMain is the main window of the application. * #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: * SymbolMenuItem: