2021-06-19 15:29:01 +02:00
|
|
|
# The last version with Windows XP support is 3.13, we want to keep that
|
2021-10-23 14:09:55 +02:00
|
|
|
cmake_minimum_required (VERSION 3.10)
|
2021-10-22 22:34:39 +02:00
|
|
|
project (logdiag VERSION 0.2.1 LANGUAGES C)
|
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)
|
2021-10-24 16:43:34 +02:00
|
|
|
option (OPTION_NOINSTALL "For developers only--work without installing" OFF)
|
|
|
|
option (OPTION_GTKDOC "For developers only--enable use of gtk-doc" OFF)
|
2015-01-21 20:25:59 +01:00
|
|
|
option (BUILD_TESTING "Build tests" OFF)
|
2012-08-31 15:23:02 +02:00
|
|
|
|
2011-02-07 18:03:15 +01:00
|
|
|
# Project information
|
2018-06-27 05:06:02 +02:00
|
|
|
set (project_URL "https://git.janouch.name/p/logdiag")
|
2011-02-07 18:03:15 +01:00
|
|
|
|
2010-09-13 19:24:53 +02:00
|
|
|
# For custom modules
|
2015-01-21 20:30:11 +01:00
|
|
|
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
2010-09-13 19:24:53 +02:00
|
|
|
|
2011-01-22 13:13:05 +01:00
|
|
|
# Automatic retrieval of dependencies
|
2010-09-13 19:24:53 +02:00
|
|
|
if (WIN32)
|
2015-01-21 20:30:11 +01:00
|
|
|
set (WIN32_DEPENDS_PATH ${PROJECT_SOURCE_DIR}/win32-depends)
|
2011-01-22 13:13:05 +01:00
|
|
|
list (APPEND CMAKE_PREFIX_PATH ${WIN32_DEPENDS_PATH})
|
|
|
|
list (APPEND CMAKE_INCLUDE_PATH ${WIN32_DEPENDS_PATH}/lib)
|
2021-10-22 00:08:58 +02:00
|
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mms-bitfields")
|
2011-01-22 13:13:05 +01:00
|
|
|
|
2012-10-13 19:07:56 +02:00
|
|
|
if (CMAKE_CROSSCOMPILING)
|
|
|
|
list (APPEND CMAKE_FIND_ROOT_PATH ${WIN32_DEPENDS_PATH})
|
|
|
|
endif (CMAKE_CROSSCOMPILING)
|
|
|
|
|
2018-06-25 02:02:26 +02:00
|
|
|
set (PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE)
|
|
|
|
# Seems like there is a regression setting this to two paths in one,
|
|
|
|
# setting the path manually
|
|
|
|
set (ENV{PKG_CONFIG_PATH} "${WIN32_DEPENDS_PATH}/lib/pkgconfig")
|
2015-01-20 23:21:49 +01:00
|
|
|
|
2011-01-22 13:13:05 +01:00
|
|
|
add_custom_target (win32-depends COMMAND ${CMAKE_COMMAND} -P
|
2015-01-21 20:30:11 +01:00
|
|
|
${PROJECT_SOURCE_DIR}/Win32Depends.cmake
|
|
|
|
WORKING_DIRECTORY ${PROJECT_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)
|
2015-01-21 20:30:11 +01:00
|
|
|
set (icon_base ${PROJECT_SOURCE_DIR}/share/icons/hicolor)
|
2011-01-22 17:13:56 +01:00
|
|
|
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})
|
2015-01-21 20:30:11 +01:00
|
|
|
set (icon_symbolic ${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)
|
|
|
|
|
2015-01-21 20:30:11 +01:00
|
|
|
set (icon_ico ${PROJECT_SOURCE_DIR}/share/logdiag.ico)
|
|
|
|
add_custom_target (${PROJECT_NAME}_icons
|
2012-01-29 19:59:56 +01:00
|
|
|
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
|
2015-01-18 22:48:03 +01:00
|
|
|
find_package (PkgConfig REQUIRED)
|
2016-03-15 22:12:14 +01:00
|
|
|
pkg_check_modules (GTK3 REQUIRED gtk+-3.0 json-glib-1.0)
|
2018-06-25 02:13:16 +02:00
|
|
|
|
|
|
|
if (NOT WIN32)
|
|
|
|
pkg_search_module (Lua REQUIRED lua>=5.2 lua5.3 lua-5.3 lua5.2 lua-5.2)
|
|
|
|
else (NOT WIN32)
|
|
|
|
# For whatever reason this now seems to be required
|
|
|
|
set (LUA_INCLUDE_DIR "${WIN32_DEPENDS_PATH}/include")
|
|
|
|
|
|
|
|
find_package (Lua REQUIRED)
|
|
|
|
if (LUA_VERSION_STRING VERSION_LESS "5.2")
|
|
|
|
message (FATAL_ERROR "Lua 5.2 not found")
|
|
|
|
endif (LUA_VERSION_STRING VERSION_LESS "5.2")
|
|
|
|
set (Lua_LIBRARIES ${LUA_LIBRARIES})
|
|
|
|
set (Lua_INCLUDE_DIRS ${LUA_INCLUDE_DIR})
|
|
|
|
endif (NOT WIN32)
|
2015-01-20 23:21:49 +01:00
|
|
|
|
|
|
|
# This actually fucks up MinGW cross-compilation if omitted
|
|
|
|
link_directories (${GTK3_LIBRARY_DIRS})
|
|
|
|
|
2010-09-13 19:24:53 +02:00
|
|
|
# Localization
|
2011-02-12 02:07:39 +01:00
|
|
|
find_package (Gettext REQUIRED)
|
2015-01-21 20:30:11 +01:00
|
|
|
file (GLOB project_PO_FILES ${PROJECT_SOURCE_DIR}/po/*.po)
|
2011-02-12 02:07:39 +01:00
|
|
|
GETTEXT_CREATE_TRANSLATIONS (
|
2015-01-21 20:30:11 +01:00
|
|
|
${PROJECT_SOURCE_DIR}/po/${PROJECT_NAME}.pot
|
2011-02-12 02:07:39 +01:00
|
|
|
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
|
|
|
|
2021-10-22 15:04:24 +02:00
|
|
|
# Documentation--gtk-doc 1.25 is required
|
2018-06-24 23:19:12 +02:00
|
|
|
find_package (GtkDoc 1.25)
|
|
|
|
set (project_DOC_DIR "${PROJECT_BINARY_DIR}/liblogdiag")
|
2010-09-13 19:24:53 +02:00
|
|
|
|
|
|
|
# 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
|
2015-01-21 20:30:11 +01:00
|
|
|
${PROJECT_BINARY_DIR}/config.h
|
2011-01-10 16:49:13 +01:00
|
|
|
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
|
2021-10-24 16:44:36 +02:00
|
|
|
add_definitions (-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36)
|
|
|
|
add_definitions (-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36)
|
2015-01-21 20:30:11 +01:00
|
|
|
configure_file (${PROJECT_SOURCE_DIR}/config.h.in
|
|
|
|
${PROJECT_BINARY_DIR}/config.h)
|
|
|
|
include_directories (${PROJECT_BINARY_DIR})
|
2010-09-13 19:24:53 +02:00
|
|
|
|
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)
|
|
|
|
|
2015-01-21 20:30:11 +01:00
|
|
|
glib_genmarshal (${PROJECT_SOURCE_DIR}/liblogdiag/ld-marshal
|
2011-01-24 17:18:28 +01:00
|
|
|
ld_marshal)
|
2010-09-18 19:47:33 +02:00
|
|
|
|
2015-01-21 20:30:11 +01:00
|
|
|
include_directories (${PROJECT_SOURCE_DIR})
|
2016-03-20 15:39:57 +01:00
|
|
|
include_directories (${GTK3_INCLUDE_DIRS} ${Lua_INCLUDE_DIRS})
|
|
|
|
set (logdiag_LIBS ${GTK3_LIBRARIES} ${Lua_LIBRARIES} m)
|
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})
|
2015-02-08 16:30:07 +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
|
|
|
|
if (BUILD_TESTING)
|
|
|
|
enable_testing ()
|
|
|
|
|
|
|
|
foreach (name ${logdiag_TESTS})
|
|
|
|
add_executable (test-${name} tests/${name}.c)
|
|
|
|
target_link_libraries (test-${name} liblogdiag ${logdiag_LIBS})
|
2021-10-22 15:04:24 +02:00
|
|
|
add_test (NAME test-${name} COMMAND test-${name})
|
|
|
|
list (APPEND logdiag_TEST_TARGETS test-${name})
|
2011-02-03 00:03:08 +01:00
|
|
|
endforeach (name)
|
2021-10-22 15:04:24 +02:00
|
|
|
if (WIN32 AND NOT CMAKE_CROSSCOMPILING)
|
|
|
|
set_tests_properties (${logdiag_TEST_TARGETS}
|
|
|
|
PROPERTIES ENVIRONMENT "PATH=${WIN32_DEPENDS_PATH}/bin")
|
|
|
|
endif ()
|
2011-02-03 00:03:08 +01:00
|
|
|
endif (BUILD_TESTING)
|
|
|
|
|
2010-12-18 15:39:50 +01:00
|
|
|
# Generate documentation
|
2021-10-24 16:43:34 +02:00
|
|
|
if (OPTION_GTKDOC AND GTKDOC_FOUND)
|
2021-10-24 15:11:52 +02:00
|
|
|
# Extracted LDFLAGS didn't contain -l in CMake 3.21.3 and gtk-doc 1.33.2,
|
|
|
|
# pass them explicitly and work around insanity; CMake still exits with
|
|
|
|
# an error and gtk-doc produces empty HTML documentation
|
|
|
|
string (REGEX REPLACE "(;)([^-])" "\\1-l\\2" xldflags "${logdiag_LIBS}")
|
|
|
|
set_target_properties (liblogdiag PROPERTIES LINK_LIBRARIES "")
|
|
|
|
|
|
|
|
# The "official" module wants an XML file I don't want to give it
|
|
|
|
file (WRITE ${PROJECT_BINARY_DIR}/liblogdiag-docs-dummy.xml "<book/>")
|
|
|
|
|
|
|
|
# XXX: not our bug but xml/gtkdocentities.ent cannot be passed
|
|
|
|
# XXX: this causes `make clean` to remove the entire build directory,
|
|
|
|
# because it marks CMAKE_CURRENT_BINARY_DIR as an output
|
2018-06-24 23:19:12 +02:00
|
|
|
gtk_doc_add_module (liblogdiag
|
|
|
|
SOURCE ${PROJECT_SOURCE_DIR}/liblogdiag
|
2021-10-24 15:11:52 +02:00
|
|
|
SUFFIXES c h LDFLAGS "-l${xldflags}"
|
|
|
|
XML ${PROJECT_BINARY_DIR}/liblogdiag-docs-dummy.xml
|
2018-06-24 23:19:12 +02:00
|
|
|
LIBRARIES liblogdiag)
|
|
|
|
endif ()
|
2010-12-18 15:39:50 +01:00
|
|
|
|
2012-02-08 20:57:51 +01:00
|
|
|
find_package (CppCheck)
|
|
|
|
GENERATE_CPPCHECK (SOURCES liblogdiag src tests ENABLE_IDS all
|
2015-01-21 20:30:11 +01:00
|
|
|
TARGET_NAME ${PROJECT_NAME}_cppcheck INCLUDES ${PROJECT_BINARY_DIR})
|
2012-02-08 20:57:51 +01:00
|
|
|
|
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})
|
2015-01-21 20:30:11 +01:00
|
|
|
set (vera_output ${PROJECT_BINARY_DIR}/vera.log)
|
2013-04-13 18:06:43 +02:00
|
|
|
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)
|
|
|
|
|
2015-01-21 20:30:11 +01:00
|
|
|
set (GSETTINGS_DIR "${PROJECT_SOURCE_DIR}/share")
|
2011-06-10 18:18:58 +02:00
|
|
|
set (GSETTINGS_SCHEMAS "${GSETTINGS_DIR}/org.logdiag.gschema.xml")
|
|
|
|
|
2015-01-21 20:30:11 +01:00
|
|
|
add_custom_target (${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)
|
2015-01-21 20:30:11 +01:00
|
|
|
set (GSETTINGS_COMPILED_SCHEMA "${PROJECT_BINARY_DIR}/gschemas.compiled")
|
2011-06-10 18:18:58 +02:00
|
|
|
|
|
|
|
add_custom_command (OUTPUT "${GSETTINGS_COMPILED_SCHEMA}"
|
|
|
|
COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE}
|
2015-01-21 20:30:11 +01:00
|
|
|
"--targetdir=${PROJECT_BINARY_DIR}" "${GSETTINGS_DIR}"
|
2011-06-10 18:18:58 +02:00
|
|
|
DEPENDS "${GSETTINGS_SCHEMAS}"
|
|
|
|
COMMENT "Compiling GSettings schema files" VERBATIM)
|
2015-01-21 20:30:11 +01:00
|
|
|
add_custom_target (${PROJECT_NAME}_gschema ALL
|
2012-01-29 19:59:56 +01:00
|
|
|
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-01-22 13:13:05 +01:00
|
|
|
if (WIN32)
|
|
|
|
install (TARGETS logdiag DESTINATION .)
|
|
|
|
install (DIRECTORY
|
|
|
|
${WIN32_DEPENDS_PATH}/bin/
|
|
|
|
DESTINATION .
|
2021-10-23 14:09:55 +02:00
|
|
|
FILES_MATCHING PATTERN "*.dll")
|
2011-01-22 13:13:05 +01:00
|
|
|
install (DIRECTORY
|
|
|
|
${WIN32_DEPENDS_PATH}/etc/
|
|
|
|
DESTINATION etc)
|
|
|
|
install (DIRECTORY
|
|
|
|
${WIN32_DEPENDS_PATH}/lib/gdk-pixbuf-2.0
|
2021-10-21 19:16:01 +02:00
|
|
|
DESTINATION lib
|
|
|
|
FILES_MATCHING PATTERN "*" PATTERN "*.a" EXCLUDE)
|
2015-01-28 00:16:41 +01:00
|
|
|
install (DIRECTORY
|
|
|
|
${WIN32_DEPENDS_PATH}/share/glib-2.0/schemas
|
|
|
|
DESTINATION share/glib-2.0
|
|
|
|
FILES_MATCHING PATTERN "org.gtk.Settings.*")
|
2011-02-12 02:07:39 +01:00
|
|
|
|
2021-10-21 19:16:01 +02:00
|
|
|
install (DIRECTORY
|
|
|
|
${WIN32_DEPENDS_PATH}/share/icons/Adwaita
|
|
|
|
DESTINATION share/icons OPTIONAL)
|
2018-06-25 03:05:52 +02:00
|
|
|
install (FILES
|
|
|
|
${WIN32_DEPENDS_PATH}/share/icons/hicolor/index.theme
|
|
|
|
DESTINATION share/icons/hicolor)
|
|
|
|
install (DIRECTORY share/icons DESTINATION share)
|
|
|
|
|
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)
|
2021-10-23 14:09:55 +02:00
|
|
|
|
|
|
|
install (SCRIPT Win32Cleanup.cmake)
|
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/"
|
2015-01-21 20:30:11 +01:00
|
|
|
# DESTINATION share/gtk-doc/html/${PROJECT_NAME})
|
|
|
|
install (FILES LICENSE NEWS DESTINATION share/doc/${PROJECT_NAME})
|
2011-01-22 13:13:05 +01:00
|
|
|
endif (WIN32)
|
2010-09-13 19:24:53 +02:00
|
|
|
|
2021-10-24 23:58:52 +02:00
|
|
|
install (DIRECTORY docs/user-guide DESTINATION share/doc/${PROJECT_NAME})
|
2021-10-22 15:04:24 +02:00
|
|
|
install (DIRECTORY share/gui share/library DESTINATION share/${PROJECT_NAME})
|
|
|
|
install (FILES ${GSETTINGS_SCHEMAS} DESTINATION share/glib-2.0/schemas)
|
2021-10-23 16:29:48 +02:00
|
|
|
install (CODE " # DESTDIR is not in use on Windows (WIN32 is only native here!)
|
2015-01-28 00:16:41 +01:00
|
|
|
if (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\")
|
2021-10-22 15:04:24 +02:00
|
|
|
execute_process (COMMAND \"${GLIB_COMPILE_SCHEMAS_EXECUTABLE}\"
|
2015-01-28 00:16:41 +01:00
|
|
|
\"\${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas\")
|
2021-10-23 16:29:48 +02:00
|
|
|
endif ()")
|
2015-01-28 00:16:41 +01:00
|
|
|
|
2010-09-13 19:24:53 +02:00
|
|
|
# CPack
|
2011-01-16 19:21:39 +01:00
|
|
|
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Schematic editor")
|
2020-09-28 04:49:03 +02:00
|
|
|
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
|
|
|
|
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
|
2015-01-21 20:30:11 +01:00
|
|
|
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
2021-10-22 15:04:24 +02:00
|
|
|
set (CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
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
|
2021-10-22 15:04:24 +02:00
|
|
|
"${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
|
|
|
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${CPACK_PACKAGE_VERSION}")
|
|
|
|
|
|
|
|
# XXX: It is still possible to install multiple copies, making commands collide.
|
|
|
|
set (CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
|
|
|
|
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME}")
|
2011-02-04 17:21:27 +01:00
|
|
|
|
2015-01-21 20:30:11 +01:00
|
|
|
set (CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/share\\\\header.bmp")
|
2011-01-22 19:48:30 +01:00
|
|
|
set (CPACK_NSIS_INSTALLED_ICON_NAME "logdiag.exe")
|
2021-10-23 16:29:48 +02: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 [[
|
2011-02-13 17:51:56 +01:00
|
|
|
WriteRegStr HKCR '.ldd' '' 'logdiag.Diagram'
|
|
|
|
WriteRegStr HKCR 'logdiag.Diagram' '' 'logdiag Diagram'
|
2021-10-23 16:29:48 +02:00
|
|
|
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 [[
|
2011-02-13 17:51:56 +01:00
|
|
|
DeleteRegKey HKCR 'logdiag.Diagram'
|
2021-10-23 16:29:48 +02:00
|
|
|
System::Call 'shell32::SHChangeNotify(i,i,i,i) (0x08000000, 0x1000, 0, 0)'
|
|
|
|
]])
|
2011-01-22 19:48:30 +01:00
|
|
|
|
2018-06-27 05:06:02 +02:00
|
|
|
string (REPLACE "https://" "https:\\\\\\\\" project_URL_NSIS "${project_URL}")
|
2011-02-08 00:38:44 +01:00
|
|
|
set (CPACK_NSIS_URL_INFO_ABOUT "${project_URL_NSIS}")
|
|
|
|
|
2011-02-07 19:20:53 +01:00
|
|
|
set (CPACK_DEBIAN_PACKAGE_DEPENDS
|
2015-01-20 23:23:03 +01:00
|
|
|
"libgtk3.0-0 (>= 3.8), libjson-glib-1.0-0 (>= 0.10.4), liblua5.2-0")
|
2011-02-07 19:20:53 +01:00
|
|
|
set (CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
|
2015-01-20 23:23:03 +01:00
|
|
|
"libgtk3.0-dev (>= 3.8), libjson-glib-dev (>= 0.10.4), liblua5.2-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
|
|
|
|
2015-02-09 20:28:03 +01:00
|
|
|
set (CPACK_RPM_PACKAGE_REQUIRES "gtk3 >= 3.8, json-glib >= 0.10.4, lua = 5.2")
|
2011-02-07 17:53:31 +01:00
|
|
|
set (CPACK_RPM_PACKAGE_GROUP "Graphics")
|
2016-03-15 22:17:47 +01:00
|
|
|
set (CPACK_RPM_PACKAGE_LICENSE "ISC")
|
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]")
|
2021-10-22 15:04:24 +02:00
|
|
|
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
|
2010-09-13 19:24:53 +02:00
|
|
|
|
|
|
|
include (CPack)
|
|
|
|
|