2011-01-22 13:13:05 +01:00
|
|
|
project (logdiag C)
|
2015-01-18 22:47:00 +01:00
|
|
|
cmake_minimum_required (VERSION 2.8)
|
2010-09-13 19:24:53 +02:00
|
|
|
|
2015-01-18 22:47:00 +01:00
|
|
|
# Default to 2.8 behaviour
|
|
|
|
cmake_policy (VERSION 2.8)
|
2010-09-13 19:24:53 +02:00
|
|
|
|
|
|
|
# Options
|
2013-04-13 18:06:43 +02:00
|
|
|
option (OPTION_USE_VERA "Use vera++ for source code style checks" OFF)
|
2010-09-13 19:24:53 +02:00
|
|
|
option (OPTION_NOINSTALL "Only for developers; work without installing" OFF)
|
|
|
|
|
|
|
|
if (OPTION_NOINSTALL)
|
|
|
|
set (OPTION_NOINSTALL 1)
|
|
|
|
else (OPTION_NOINSTALL)
|
|
|
|
set (OPTION_NOINSTALL 0)
|
|
|
|
endif (OPTION_NOINSTALL)
|
|
|
|
|
2012-08-31 15:23:02 +02:00
|
|
|
add_definitions (-DGSEAL_ENABLE)
|
|
|
|
|
2011-02-07 18:03:15 +01:00
|
|
|
# Project information
|
2010-09-13 19:24:53 +02:00
|
|
|
set (project_VERSION_MAJOR "0")
|
2011-02-07 20:46:29 +01:00
|
|
|
set (project_VERSION_MINOR "1")
|
2011-03-07 16:24:54 +01:00
|
|
|
set (project_VERSION_PATCH "2")
|
2010-09-17 19:03:03 +02:00
|
|
|
|
|
|
|
set (project_VERSION "${project_VERSION_MAJOR}")
|
|
|
|
set (project_VERSION "${project_VERSION}.${project_VERSION_MINOR}")
|
|
|
|
set (project_VERSION "${project_VERSION}.${project_VERSION_PATCH}")
|
2010-09-13 19:24:53 +02:00
|
|
|
|
2011-02-07 18:03:15 +01:00
|
|
|
set (project_URL "http://github.com/pjanouch/logdiag")
|
|
|
|
|
2010-09-13 19:24:53 +02:00
|
|
|
# For custom modules
|
|
|
|
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|
|
|
|
|
|
|
# Test this machine
|
|
|
|
include (CheckCSourceCompiles)
|
|
|
|
|
|
|
|
CHECK_C_SOURCE_COMPILES (
|
|
|
|
"typedef struct abc *d;
|
|
|
|
int test (d __restrict x);
|
|
|
|
int main (void) {return 0;}"
|
|
|
|
HAVE_SANE___RESTRICT)
|
|
|
|
|
|
|
|
CHECK_C_SOURCE_COMPILES (
|
|
|
|
"int test (void *restrict x);
|
|
|
|
int main (void) {return 0;}"
|
|
|
|
HAVE_RESTRICT)
|
|
|
|
|
2011-01-22 13:13:05 +01:00
|
|
|
# Automatic retrieval of dependencies
|
2010-09-13 19:24:53 +02:00
|
|
|
if (WIN32)
|
2011-01-22 13:13:05 +01:00
|
|
|
set (WIN32_DEPENDS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/win32-depends)
|
|
|
|
list (APPEND CMAKE_PREFIX_PATH ${WIN32_DEPENDS_PATH})
|
|
|
|
list (APPEND CMAKE_INCLUDE_PATH ${WIN32_DEPENDS_PATH}/lib)
|
|
|
|
list (APPEND CMAKE_C_FLAGS "-mms-bitfields")
|
|
|
|
|
2012-10-13 19:07:56 +02:00
|
|
|
if (CMAKE_CROSSCOMPILING)
|
|
|
|
list (APPEND CMAKE_FIND_ROOT_PATH ${WIN32_DEPENDS_PATH})
|
|
|
|
endif (CMAKE_CROSSCOMPILING)
|
|
|
|
|
2011-01-22 13:13:05 +01:00
|
|
|
add_custom_target (win32-depends COMMAND ${CMAKE_COMMAND} -P
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Win32Depends.cmake
|
2011-02-07 17:00:31 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
2011-01-22 13:13:05 +01:00
|
|
|
add_custom_target (win32-depends-clean COMMAND ${CMAKE_COMMAND} -E
|
|
|
|
remove_directory ${WIN32_DEPENDS_PATH})
|
2010-09-13 19:24:53 +02:00
|
|
|
endif (WIN32)
|
|
|
|
|
2011-01-22 17:13:56 +01:00
|
|
|
# Generate icons
|
|
|
|
find_program (CONVERT_EXECUTABLE convert)
|
|
|
|
mark_as_advanced (CONVERT_EXECUTABLE)
|
|
|
|
|
|
|
|
if (CONVERT_EXECUTABLE AND NOT WIN32)
|
|
|
|
set (icon_base ${CMAKE_CURRENT_SOURCE_DIR}/share/icons/hicolor)
|
|
|
|
set (icon_svg ${icon_base}/scalable/apps/logdiag.svg)
|
|
|
|
set (icon_size_list 16x16 32x32 48x48)
|
|
|
|
|
|
|
|
set (icon_png_list)
|
2011-01-23 13:26:00 +01:00
|
|
|
set (icon_symbolic_list)
|
2011-01-22 17:13:56 +01:00
|
|
|
foreach (icon_size ${icon_size_list})
|
|
|
|
set (icon_png_path ${icon_base}/${icon_size}/apps)
|
|
|
|
set (icon_png ${icon_png_path}/logdiag.png)
|
|
|
|
list (APPEND icon_png_list ${icon_png})
|
2012-01-29 19:59:56 +01:00
|
|
|
set (icon_symbolic ${CMAKE_PROJECT_NAME}_icons_${icon_size})
|
2011-01-23 13:26:00 +01:00
|
|
|
list (APPEND icon_symbolic_list ${icon_symbolic})
|
2011-01-22 17:13:56 +01:00
|
|
|
|
2011-01-23 13:26:00 +01:00
|
|
|
add_custom_command (OUTPUT ${icon_symbolic}
|
2011-01-22 17:13:56 +01:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${icon_png_path}
|
|
|
|
COMMAND ${CONVERT_EXECUTABLE} -background none
|
|
|
|
-resize ${icon_size} ${icon_svg} ${icon_png}
|
2011-01-23 13:26:00 +01:00
|
|
|
DEPENDS ${icon_svg} VERBATIM)
|
|
|
|
set_source_files_properties (${icon_symbolic}
|
|
|
|
PROPERTIES SYMBOLIC TRUE)
|
2011-01-22 17:13:56 +01:00
|
|
|
endforeach (icon_size)
|
|
|
|
|
|
|
|
set (icon_ico ${CMAKE_CURRENT_SOURCE_DIR}/share/logdiag.ico)
|
2012-01-29 19:59:56 +01:00
|
|
|
add_custom_target (${CMAKE_PROJECT_NAME}_icons
|
|
|
|
DEPENDS ${icon_symbolic_list}
|
2011-01-22 17:13:56 +01:00
|
|
|
COMMAND ${CONVERT_EXECUTABLE} ${icon_png_list} ${icon_ico}
|
2011-01-23 13:26:00 +01:00
|
|
|
COMMENT "Generating logdiag.ico" VERBATIM)
|
2011-01-22 17:13:56 +01:00
|
|
|
endif (CONVERT_EXECUTABLE AND NOT WIN32)
|
|
|
|
|
2010-12-18 15:39:50 +01:00
|
|
|
# Dependencies
|
2010-12-05 15:23:10 +01:00
|
|
|
find_package (JsonGlib REQUIRED)
|
|
|
|
|
2015-01-18 22:48:03 +01:00
|
|
|
find_package (PkgConfig REQUIRED)
|
|
|
|
pkg_search_module (Lua52 REQUIRED lua5.2 lua-5.2 lua>=5.2)
|
2015-01-19 00:02:48 +01:00
|
|
|
pkg_check_modules (GTK3 REQUIRED gtk+-3.0)
|
2015-01-18 22:48:03 +01:00
|
|
|
|
2010-09-13 19:24:53 +02:00
|
|
|
# Localization
|
2011-02-12 02:07:39 +01:00
|
|
|
find_package (Gettext REQUIRED)
|
|
|
|
file (GLOB project_PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/po/*.po)
|
|
|
|
GETTEXT_CREATE_TRANSLATIONS (
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/po/${CMAKE_PROJECT_NAME}.pot
|
|
|
|
ALL ${project_PO_FILES})
|
|
|
|
|
|
|
|
foreach (file ${project_PO_FILES})
|
|
|
|
get_filename_component (translation "${file}" NAME_WE)
|
|
|
|
list (APPEND project_TRANSLATIONS "${translation}")
|
|
|
|
endforeach (file)
|
2010-09-13 19:24:53 +02:00
|
|
|
|
|
|
|
# Documentation
|
2011-01-23 13:49:48 +01:00
|
|
|
# TODO: Add pregenerated docs to the tree
|
2010-12-18 15:39:50 +01:00
|
|
|
find_package (GtkDoc)
|
2010-09-13 19:24:53 +02:00
|
|
|
set (project_DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/reference")
|
|
|
|
|
|
|
|
# Project source files
|
2011-01-10 16:49:13 +01:00
|
|
|
set (liblogdiag_SOURCES
|
|
|
|
liblogdiag/ld-marshal.c
|
|
|
|
liblogdiag/ld-types.c
|
2011-01-31 21:58:41 +01:00
|
|
|
liblogdiag/ld-undo-action.c
|
2011-01-10 16:49:13 +01:00
|
|
|
liblogdiag/ld-diagram.c
|
|
|
|
liblogdiag/ld-diagram-object.c
|
|
|
|
liblogdiag/ld-diagram-symbol.c
|
2011-02-02 17:22:34 +01:00
|
|
|
liblogdiag/ld-diagram-connection.c
|
2011-02-16 07:50:07 +01:00
|
|
|
liblogdiag/ld-diagram-view.c
|
2011-01-10 16:49:13 +01:00
|
|
|
liblogdiag/ld-library.c
|
2012-08-30 00:54:38 +02:00
|
|
|
liblogdiag/ld-category-view.c
|
2012-10-08 09:11:32 +02:00
|
|
|
liblogdiag/ld-category-tree-view.c
|
2012-09-05 19:39:22 +02:00
|
|
|
liblogdiag/ld-category-symbol-view.c
|
2012-08-29 18:44:47 +02:00
|
|
|
liblogdiag/ld-category.c
|
2011-01-10 16:49:13 +01:00
|
|
|
liblogdiag/ld-symbol.c
|
|
|
|
liblogdiag/ld-lua.c
|
|
|
|
liblogdiag/ld-lua-symbol.c)
|
|
|
|
set (liblogdiag_HEADERS
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
|
|
|
liblogdiag/liblogdiag.h
|
|
|
|
liblogdiag/ld-marshal.h
|
|
|
|
liblogdiag/ld-types.h
|
2011-01-31 21:58:41 +01:00
|
|
|
liblogdiag/ld-undo-action.h
|
2011-01-10 16:49:13 +01:00
|
|
|
liblogdiag/ld-diagram.h
|
|
|
|
liblogdiag/ld-diagram-object.h
|
|
|
|
liblogdiag/ld-diagram-symbol.h
|
2011-02-02 17:22:34 +01:00
|
|
|
liblogdiag/ld-diagram-connection.h
|
2011-02-16 07:50:07 +01:00
|
|
|
liblogdiag/ld-diagram-view.h
|
2011-01-10 16:49:13 +01:00
|
|
|
liblogdiag/ld-library.h
|
2012-08-30 00:54:38 +02:00
|
|
|
liblogdiag/ld-category-view.h
|
2012-10-08 09:11:32 +02:00
|
|
|
liblogdiag/ld-category-tree-view.h
|
2012-09-05 19:39:22 +02:00
|
|
|
liblogdiag/ld-category-symbol-view.h
|
2012-08-29 18:44:47 +02:00
|
|
|
liblogdiag/ld-category.h
|
2011-01-10 16:49:13 +01:00
|
|
|
liblogdiag/ld-symbol.h
|
|
|
|
liblogdiag/ld-lua.h
|
|
|
|
liblogdiag/ld-lua-private.h
|
|
|
|
liblogdiag/ld-lua-symbol.h
|
|
|
|
liblogdiag/ld-lua-symbol-private.h)
|
|
|
|
|
2011-02-03 00:03:08 +01:00
|
|
|
set (logdiag_TESTS
|
2011-02-05 19:47:07 +01:00
|
|
|
point-array
|
|
|
|
diagram)
|
2011-02-03 00:03:08 +01:00
|
|
|
|
2010-09-13 19:24:53 +02:00
|
|
|
set (logdiag_SOURCES
|
2010-09-17 19:03:03 +02:00
|
|
|
src/ld-window-main.c
|
2011-01-10 16:49:13 +01:00
|
|
|
src/logdiag.c)
|
2010-09-13 19:24:53 +02:00
|
|
|
set (logdiag_HEADERS
|
2011-01-10 16:49:13 +01:00
|
|
|
${liblogdiag_HEADERS}
|
|
|
|
src/ld-window-main.h)
|
2010-09-13 19:24:53 +02:00
|
|
|
|
2011-01-22 17:13:56 +01:00
|
|
|
# Resource compilation for MinGW
|
|
|
|
if (MINGW)
|
|
|
|
set (CMAKE_RC_COMPILER_INIT windres)
|
|
|
|
enable_language (RC)
|
|
|
|
set (CMAKE_RC_FLAGS "-O coff")
|
|
|
|
set (CMAKE_RC_COMPILE_OBJECT
|
|
|
|
"<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> <SOURCE>")
|
|
|
|
endif (MINGW)
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
set (logdiag_SOURCES
|
|
|
|
${logdiag_SOURCES}
|
|
|
|
share/logdiag.rc)
|
|
|
|
endif (WIN32)
|
|
|
|
|
2010-09-13 19:24:53 +02:00
|
|
|
# Generate a configure file
|
|
|
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
|
|
include_directories (${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
2010-09-18 19:47:33 +02:00
|
|
|
# Generate marshallers
|
2011-01-27 18:56:41 +01:00
|
|
|
find_program (GLIB_GENMARSHAL_EXECUTABLE glib-genmarshal)
|
|
|
|
if (NOT GLIB_GENMARSHAL_EXECUTABLE)
|
|
|
|
message (FATAL_ERROR "glib-genmarshal not found")
|
|
|
|
endif (NOT GLIB_GENMARSHAL_EXECUTABLE)
|
|
|
|
|
2010-09-18 19:47:33 +02:00
|
|
|
function (glib_genmarshal base prefix)
|
2011-01-27 18:56:41 +01:00
|
|
|
get_filename_component (base_path "${base}" PATH)
|
|
|
|
get_filename_component (base_name "${base}" NAME)
|
|
|
|
set (command_base ${GLIB_GENMARSHAL_EXECUTABLE}
|
|
|
|
--prefix ${prefix} "${base_name}.list")
|
|
|
|
|
|
|
|
# On Windows, the final makefile may contain:
|
|
|
|
# cd e:\abc && ...
|
|
|
|
# That won't actually change the directory. We have to do:
|
|
|
|
# cd e:\abc && e: && ...
|
|
|
|
if (WIN32 AND "${base_path}" MATCHES "^.:[/\\\\]")
|
|
|
|
string (SUBSTRING "${base_path}" 0 2 base_drive)
|
|
|
|
set (command_base "${base_drive}" && "${command_base}")
|
|
|
|
endif (WIN32 AND "${base_path}" MATCHES "^.:[/\\\\]")
|
|
|
|
|
|
|
|
# NOTE: VERBATIM would cause problems, so it is not used here
|
|
|
|
add_custom_command (OUTPUT ${base}.c
|
|
|
|
COMMAND ${command_base} --body > "${base_name}.c"
|
|
|
|
DEPENDS "${base}.list"
|
|
|
|
WORKING_DIRECTORY "${base_path}"
|
|
|
|
COMMENT "Generating marshallers source file")
|
|
|
|
add_custom_command (OUTPUT ${base}.h
|
|
|
|
COMMAND ${command_base} --header > "${base_name}.h"
|
|
|
|
DEPENDS "${base}.list"
|
|
|
|
WORKING_DIRECTORY "${base_path}"
|
|
|
|
COMMENT "Generating marshallers header file")
|
2010-09-18 19:47:33 +02:00
|
|
|
endfunction (glib_genmarshal)
|
|
|
|
|
2011-01-10 16:49:13 +01:00
|
|
|
glib_genmarshal (${CMAKE_CURRENT_SOURCE_DIR}/liblogdiag/ld-marshal
|
2011-01-24 17:18:28 +01:00
|
|
|
ld_marshal)
|
2010-09-18 19:47:33 +02:00
|
|
|
|
2011-01-24 04:42:18 +01:00
|
|
|
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
|
2015-01-19 00:02:48 +01:00
|
|
|
include_directories (${GTK3_INCLUDE_DIRS}
|
2015-01-18 22:48:03 +01:00
|
|
|
${JSON_GLIB_INCLUDE_DIRS} ${Lua52_INCLUDE_DIRS})
|
2015-01-19 00:02:48 +01:00
|
|
|
set (logdiag_LIBS ${GTK3_LIBRARIES}
|
2015-01-18 22:48:03 +01:00
|
|
|
${JSON_GLIB_LIBRARIES} ${Lua52_LIBRARIES})
|
2011-01-10 16:49:13 +01:00
|
|
|
|
2011-02-12 02:07:39 +01:00
|
|
|
if (WIN32)
|
|
|
|
find_package (LibIntl REQUIRED)
|
|
|
|
list (APPEND logdiag_LIBS ${LIBINTL_LIBRARIES})
|
|
|
|
endif (WIN32)
|
|
|
|
|
2011-01-10 16:49:13 +01:00
|
|
|
# Build the library
|
|
|
|
add_library (liblogdiag STATIC ${liblogdiag_SOURCES} ${liblogdiag_HEADERS})
|
|
|
|
set_target_properties (liblogdiag PROPERTIES OUTPUT_NAME logdiag)
|
|
|
|
|
|
|
|
# Build the executable
|
2011-01-22 13:13:05 +01:00
|
|
|
add_executable (logdiag WIN32 ${logdiag_SOURCES} ${logdiag_HEADERS})
|
2011-01-23 13:49:48 +01:00
|
|
|
target_link_libraries (logdiag liblogdiag ${logdiag_LIBS})
|
2010-09-13 19:24:53 +02:00
|
|
|
|
2011-02-03 00:03:08 +01:00
|
|
|
# Testing
|
|
|
|
option (BUILD_TESTING "Build tests" OFF)
|
|
|
|
|
|
|
|
if (BUILD_TESTING)
|
|
|
|
enable_testing ()
|
|
|
|
|
|
|
|
foreach (name ${logdiag_TESTS})
|
|
|
|
add_executable (test-${name} tests/${name}.c)
|
|
|
|
target_link_libraries (test-${name} liblogdiag ${logdiag_LIBS})
|
|
|
|
|
|
|
|
add_test (test-${name} test-${name})
|
|
|
|
endforeach (name)
|
|
|
|
endif (BUILD_TESTING)
|
|
|
|
|
2010-12-18 15:39:50 +01:00
|
|
|
# Generate documentation
|
|
|
|
if (GTK_DOC_FOUND)
|
|
|
|
GTK_DOC_RUN (WORKING_DIR ${project_DOC_DIR}
|
2011-01-10 16:49:13 +01:00
|
|
|
SOURCE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/liblogdiag
|
2011-01-23 13:49:48 +01:00
|
|
|
SCANGOBJ liblogdiag ${logdiag_LIBS}
|
2010-12-18 15:39:50 +01:00
|
|
|
XML ${project_DOC_DIR}/xml --sgml-mode
|
|
|
|
HTML ${project_DOC_DIR}/html)
|
|
|
|
endif (GTK_DOC_FOUND)
|
|
|
|
|
2012-02-08 20:57:51 +01:00
|
|
|
find_package (CppCheck)
|
|
|
|
GENERATE_CPPCHECK (SOURCES liblogdiag src tests ENABLE_IDS all
|
|
|
|
TARGET_NAME ${CMAKE_PROJECT_NAME}_cppcheck INCLUDES ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
2013-04-13 18:06:43 +02:00
|
|
|
if (OPTION_USE_VERA)
|
2015-01-18 22:55:55 +01:00
|
|
|
# Force this off, we don't need it
|
|
|
|
option (VERA_LUA "" OFF)
|
|
|
|
|
2013-04-13 18:06:43 +02:00
|
|
|
# Make it build within the same build tree
|
|
|
|
get_directory_property (backup_includes INCLUDE_DIRECTORIES)
|
|
|
|
set_directory_properties (PROPERTIES INCLUDE_DIRECTORIES "")
|
|
|
|
set (backup_source_dir "${CMAKE_SOURCE_DIR}")
|
|
|
|
set (CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}/vera++")
|
|
|
|
|
|
|
|
add_subdirectory ("vera++")
|
|
|
|
|
|
|
|
set_directory_properties (PROPERTIES INCLUDE_DIRECTORIES "${backup_includes}")
|
|
|
|
set (CMAKE_SOURCE_DIR "${backup_source_dir}")
|
|
|
|
|
|
|
|
# Check the sources
|
|
|
|
# XXX: maybe do it per source file and not all at once
|
|
|
|
set (vera_srcs ${liblogdiag_SOURCES} ${logdiag_SOURCES} ${logdiag_HEADERS})
|
|
|
|
set (vera_output ${CMAKE_CURRENT_BINARY_DIR}/vera.log)
|
|
|
|
add_custom_command (OUTPUT ${vera_output}
|
2015-01-18 22:55:55 +01:00
|
|
|
COMMAND vera
|
2013-04-13 18:06:43 +02:00
|
|
|
-R F001 -R L001 -R T001 -R T004 -R T005 -R T006
|
|
|
|
-R T007 -R T009 -R T010 -R T015 -R T017 -R T018
|
|
|
|
-R L004 -P max-line-length=80
|
|
|
|
-R L005 -P max-consecutive-empty-lines=2
|
|
|
|
--root ${CMAKE_SOURCE_DIR}/vera++
|
|
|
|
--std-report=-
|
|
|
|
--std-report=${vera_output}
|
|
|
|
--warning -s
|
|
|
|
${vera_srcs}
|
|
|
|
DEPENDS ${vera_srcs}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
COMMENT "Checking style for logdiag")
|
|
|
|
|
|
|
|
add_custom_target (logdiag_vera ALL DEPENDS ${vera_output})
|
|
|
|
endif (OPTION_USE_VERA)
|
|
|
|
|
2011-06-10 18:18:58 +02:00
|
|
|
# GSettings
|
|
|
|
find_program (GLIB_COMPILE_SCHEMAS_EXECUTABLE glib-compile-schemas)
|
|
|
|
if (NOT GLIB_COMPILE_SCHEMAS_EXECUTABLE)
|
|
|
|
message (FATAL_ERROR "glib-compile-schemas not found")
|
|
|
|
endif (NOT GLIB_COMPILE_SCHEMAS_EXECUTABLE)
|
|
|
|
|
|
|
|
set (GSETTINGS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/share")
|
|
|
|
set (GSETTINGS_SCHEMAS "${GSETTINGS_DIR}/org.logdiag.gschema.xml")
|
|
|
|
|
2012-01-29 19:59:56 +01:00
|
|
|
add_custom_target (${CMAKE_PROJECT_NAME}_gschema_check
|
2011-06-10 18:18:58 +02:00
|
|
|
COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE} --dry-run "${GSETTINGS_DIR}"
|
|
|
|
DEPENDS "${GSETTINGS_SCHEMAS}"
|
|
|
|
COMMENT "Checking GSettings schema files" VERBATIM)
|
|
|
|
|
|
|
|
if (OPTION_NOINSTALL)
|
|
|
|
set (GSETTINGS_COMPILED_SCHEMA "${CMAKE_CURRENT_BINARY_DIR}/gschemas.compiled")
|
|
|
|
|
|
|
|
add_custom_command (OUTPUT "${GSETTINGS_COMPILED_SCHEMA}"
|
|
|
|
COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE}
|
|
|
|
"--targetdir=${CMAKE_CURRENT_BINARY_DIR}" "${GSETTINGS_DIR}"
|
|
|
|
DEPENDS "${GSETTINGS_SCHEMAS}"
|
|
|
|
COMMENT "Compiling GSettings schema files" VERBATIM)
|
2012-01-29 19:59:56 +01:00
|
|
|
add_custom_target (${CMAKE_PROJECT_NAME}_gschema ALL
|
|
|
|
DEPENDS "${GSETTINGS_COMPILED_SCHEMA}")
|
2011-06-10 18:18:58 +02:00
|
|
|
endif (OPTION_NOINSTALL)
|
|
|
|
|
2010-09-13 19:24:53 +02:00
|
|
|
# Installation
|
2011-06-10 18:18:58 +02:00
|
|
|
install (FILES ${GSETTINGS_SCHEMAS}
|
|
|
|
DESTINATION share/glib-2.0/schemas)
|
|
|
|
install (CODE " # DESTDIR is not in use on Windows
|
|
|
|
if (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\")
|
|
|
|
execute_process (COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE}
|
|
|
|
\"\${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas\")
|
|
|
|
endif (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\")")
|
|
|
|
|
2011-01-16 18:16:42 +01:00
|
|
|
install (DIRECTORY share/gui share/library
|
|
|
|
DESTINATION share/${CMAKE_PROJECT_NAME})
|
2010-12-18 15:39:50 +01:00
|
|
|
|
2011-01-22 13:13:05 +01:00
|
|
|
if (WIN32)
|
|
|
|
install (TARGETS logdiag DESTINATION .)
|
|
|
|
install (DIRECTORY
|
|
|
|
${WIN32_DEPENDS_PATH}/bin/
|
|
|
|
DESTINATION .
|
2011-02-12 02:07:39 +01:00
|
|
|
FILES_MATCHING PATTERN "*.dll"
|
2012-10-10 20:31:27 +02:00
|
|
|
PATTERN "libgettext*" EXCLUDE)
|
2011-01-22 13:13:05 +01:00
|
|
|
install (DIRECTORY
|
|
|
|
${WIN32_DEPENDS_PATH}/etc/
|
|
|
|
DESTINATION etc)
|
|
|
|
install (DIRECTORY
|
|
|
|
${WIN32_DEPENDS_PATH}/lib/glib-2.0
|
|
|
|
${WIN32_DEPENDS_PATH}/lib/gtk-2.0
|
|
|
|
${WIN32_DEPENDS_PATH}/lib/gdk-pixbuf-2.0
|
|
|
|
DESTINATION lib)
|
|
|
|
install (DIRECTORY
|
2011-02-12 18:44:55 +01:00
|
|
|
${WIN32_DEPENDS_PATH}/share/themes/MS-Windows
|
|
|
|
DESTINATION share/themes)
|
2011-02-12 02:07:39 +01:00
|
|
|
|
|
|
|
# Avoid partial translations
|
|
|
|
file (GLOB locales ${WIN32_DEPENDS_PATH}/share/locale/*)
|
|
|
|
foreach (locale ${locales})
|
|
|
|
get_filename_component (translation ${locale} NAME)
|
|
|
|
list (FIND project_TRANSLATIONS ${translation} translation_found)
|
|
|
|
if (translation_found GREATER -1)
|
|
|
|
install (DIRECTORY
|
|
|
|
${WIN32_DEPENDS_PATH}/share/locale/${translation}
|
|
|
|
DESTINATION share/locale)
|
|
|
|
endif (translation_found GREATER -1)
|
|
|
|
endforeach (locale)
|
2011-01-22 13:13:05 +01:00
|
|
|
else (WIN32)
|
|
|
|
install (TARGETS logdiag DESTINATION bin)
|
2010-12-18 15:39:50 +01:00
|
|
|
install (FILES share/logdiag.desktop DESTINATION share/applications)
|
2011-01-30 15:29:19 +01:00
|
|
|
install (FILES share/logdiag.xml DESTINATION share/mime/packages)
|
2011-01-16 16:46:48 +01:00
|
|
|
install (DIRECTORY share/icons DESTINATION share)
|
2011-02-04 19:47:10 +01:00
|
|
|
# Don't install the documentation yet as we don't install any library
|
|
|
|
# install (DIRECTORY "${project_DOC_DIR}/html/"
|
|
|
|
# DESTINATION share/gtk-doc/html/${CMAKE_PROJECT_NAME})
|
2011-02-20 13:45:10 +01:00
|
|
|
install (FILES LICENSE NEWS DESTINATION share/doc/${CMAKE_PROJECT_NAME})
|
2011-01-22 13:13:05 +01:00
|
|
|
endif (WIN32)
|
2010-09-13 19:24:53 +02:00
|
|
|
|
|
|
|
# CPack
|
2011-01-16 19:21:39 +01:00
|
|
|
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Schematic editor")
|
2011-02-08 00:38:44 +01:00
|
|
|
set (CPACK_PACKAGE_VENDOR "Premysl Janouch")
|
2011-04-21 14:43:40 +02:00
|
|
|
set (CPACK_PACKAGE_CONTACT "Přemysl Janouch <p.janouch@gmail.com>")
|
2010-09-13 19:24:53 +02:00
|
|
|
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
|
|
|
set (CPACK_PACKAGE_VERSION_MAJOR ${project_VERSION_MAJOR})
|
|
|
|
set (CPACK_PACKAGE_VERSION_MINOR ${project_VERSION_MINOR})
|
|
|
|
set (CPACK_PACKAGE_VERSION_PATCH ${project_VERSION_PATCH})
|
2011-01-22 19:48:30 +01:00
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
set (CPACK_GENERATOR "NSIS;ZIP")
|
|
|
|
else (WIN32)
|
|
|
|
set (CPACK_GENERATOR "TGZ;ZIP")
|
2011-04-21 14:43:40 +02:00
|
|
|
set (CPACK_SET_DESTDIR TRUE)
|
2011-01-22 19:48:30 +01:00
|
|
|
endif (WIN32)
|
2011-02-07 19:20:53 +01:00
|
|
|
|
2010-09-13 19:24:53 +02:00
|
|
|
set (CPACK_PACKAGE_FILE_NAME
|
2011-02-07 19:20:53 +01:00
|
|
|
"${CMAKE_PROJECT_NAME}-${project_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
2010-09-13 19:24:53 +02:00
|
|
|
set (CPACK_PACKAGE_INSTALL_DIRECTORY
|
2011-02-07 19:20:53 +01:00
|
|
|
"${CMAKE_PROJECT_NAME} ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
2011-02-04 17:21:27 +01:00
|
|
|
|
2011-02-13 17:51:56 +01:00
|
|
|
# FIXME: It is possible to install multiple copies. Everything screws up then.
|
2011-02-13 17:46:53 +01:00
|
|
|
set (CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/share\\\\header.bmp")
|
2011-01-22 19:48:30 +01:00
|
|
|
set (CPACK_NSIS_INSTALLED_ICON_NAME "logdiag.exe")
|
2011-02-13 17:51:56 +01:00
|
|
|
set (CPACK_NSIS_CREATE_ICONS_EXTRA "
|
|
|
|
CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\logdiag.lnk' '\$INSTDIR\\\\logdiag.exe'")
|
|
|
|
set (CPACK_NSIS_DELETE_ICONS_EXTRA "
|
|
|
|
Delete '\$SMPROGRAMS\\\\$MUI_TEMP\\\\logdiag.lnk'")
|
|
|
|
set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
|
|
|
|
WriteRegStr HKCR '.ldd' '' 'logdiag.Diagram'
|
|
|
|
WriteRegStr HKCR 'logdiag.Diagram' '' 'logdiag Diagram'
|
|
|
|
WriteRegStr HKCR 'logdiag.Diagram\\\\shell\\\\open\\\\command' '' '\\\"\$INSTDIR\\\\logdiag.exe\\\" \\\"%1\\\"'
|
|
|
|
WriteRegStr HKCR 'logdiag.Diagram\\\\shell\\\\edit\\\\command' '' '\\\"\$INSTDIR\\\\logdiag.exe\\\" \\\"%1\\\"'
|
|
|
|
System::Call 'shell32::SHChangeNotify(i,i,i,i) (0x08000000, 0x1000, 0, 0)'")
|
|
|
|
set (CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
|
|
|
|
DeleteRegKey HKCR 'logdiag.Diagram'
|
|
|
|
System::Call 'shell32::SHChangeNotify(i,i,i,i) (0x08000000, 0x1000, 0, 0)'")
|
2011-01-22 19:48:30 +01:00
|
|
|
|
2011-02-08 00:38:44 +01:00
|
|
|
string (REPLACE "http://" "http:\\\\\\\\" project_URL_NSIS "${project_URL}")
|
|
|
|
set (CPACK_NSIS_URL_INFO_ABOUT "${project_URL_NSIS}")
|
|
|
|
|
2011-02-07 19:20:53 +01:00
|
|
|
set (CPACK_DEBIAN_PACKAGE_DEPENDS
|
2012-10-10 20:31:27 +02:00
|
|
|
"libgtk2.0-0 (>= 2.12), libjson-glib-1.0-0 (>= 0.10.4), liblua5.1-0")
|
2011-02-07 19:20:53 +01:00
|
|
|
set (CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
|
|
|
|
"libgtk2.0-dev (>= 2.12), libjson-glib-dev (>= 0.10.4), liblua5.1-0-dev")
|
2011-02-04 17:21:27 +01:00
|
|
|
set (CPACK_DEBIAN_PACKAGE_SECTION "Electronics")
|
2011-02-07 18:03:15 +01:00
|
|
|
set (CPACK_DEBIAN_PACKAGE_HOMEPAGE "${project_URL}")
|
2011-02-04 17:21:27 +01:00
|
|
|
|
2012-10-10 20:31:27 +02:00
|
|
|
set (CPACK_RPM_PACKAGE_REQUIRES "gtk2 >= 2.12, json-glib >= 0.10.4, lua = 5.1")
|
2011-02-07 17:53:31 +01:00
|
|
|
set (CPACK_RPM_PACKAGE_GROUP "Graphics")
|
|
|
|
set (CPACK_RPM_PACKAGE_LICENSE "BSD")
|
2011-02-07 18:03:15 +01:00
|
|
|
set (CPACK_RPM_PACKAGE_URL "${project_URL}")
|
2011-02-07 17:53:31 +01:00
|
|
|
|
2010-09-13 19:24:53 +02:00
|
|
|
set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
|
2011-07-05 13:11:49 +02:00
|
|
|
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user;/win32-depends;/liblogdiag/ld-marshal.[ch]")
|
2011-02-07 19:20:53 +01:00
|
|
|
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${project_VERSION}")
|
2010-09-13 19:24:53 +02:00
|
|
|
|
|
|
|
include (CPack)
|
|
|
|
|