You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ubinstall-gtk/source/CMakeLists.txt

178 lines
6.1 KiB

cmake_minimum_required(VERSION 3.7)
project(ubinstall-gtk)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtk+-3.0)
include_directories(${GTK_INCLUDE_DIRS})
link_directories(${GTK_LIBRARY_DIRS})
add_definitions(${GTK_CFLAGS_OTHER})
pkg_check_modules(VTE291 REQUIRED vte-2.91)
include_directories(${VTE291_INCLUDE_DIRS})
link_directories(${VTE291_LIBRARY_DIRS})
add_definitions(${VTE291_CFLAGS_OTHER})
pkg_check_modules(JSON REQUIRED json-c)
include_directories(${JSON_INCLUDE_DIRS})
link_directories(${JSON_LIBRARY_DIRS})
add_definitions(${JSON_CFLAGS_OTHER})
find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0)
option(WEBKIT_FOUND "No" OFF)
if(WEBKIT_LIBRARIES_FOUND)
option(WEBKIT_FOUND "Yes" ON)
PKG_CHECK_MODULES(WEBKIT REQUIRED webkit2gtk-4.0 webkit2gtk-web-extension-4.0)
include_directories(${WEBKIT_INCLUDE_DIRS})
link_directories(${WEBKIT_LIBRARY_DIRS})
add_definitions(${WEBKIT_CFLAGS_OTHER})
endif()
set(GRESOURCE_C resources.c)
set(GRESOURCE_XML gresource.xml)
find_program(GLIB_COMPILE_RESOURCES NAMES glib-compile-resources REQUIRED)
add_custom_target(GLADE ubinstall-gtk.glade)
set(DEPENDFILES
../images/keyboard.png
../images/keyboard-ru.png
../images/map-time-zone.png
../images/slide-0.png
../images/slide-1.png
../images/slide-2.png
../images/slide-3.png
../images/slide-4.png
../images/slide-5.png
../images/slide-6.png
../images/slide-7.png
../images/slide-8.png
../images/slide-9.png
../images/slide-10.png
../images/slide-11.png
../images/slide-12.png
../images/slide-12.png
../images/language.png
../ubinstall-gtk.glade
../ubinstall-gtk-language.glade
../ubinstall-gtk-keyboard.glade
../ubinstall-gtk-log-view.glade
../ubinstall-gtk-warning.glade
../ubinstall-gtk-user.glade
../ubinstall-gtk-menu.glade
../ubinstall-gtk-menu-item.glade
../ubinstall-gtk-kernel-row.glade
../ubinstall-gtk-kernel-addon-row.glade
../ubinstall-gtk-os-row.glade
../ubinstall-gtk-service-window.glade
../ubinstall-gtk-bootloader-user.glade
../ubinstall-gtk-network-box.glade
../ubinstall-gtk-advanced-box.glade
../ubinstall-gtk-configuration-mode.glade
../ubinstall-gtk-source.glade
../ubinstall-gtk-source-element.glade
../ubinstall-gtk-layouts.glade
../ubinstall-gtk-keyboard-layouts.glade
../gresource.xml
../ubinstall-gtk.css
../modules.csv
../kernel-list.csv
../kernel-list-addon.csv
../services-list.csv
../network-list.csv
../filesystems-format-list.csv
../vfs-list.csv
../icons-builtin/install_type_custom_normal.png
../icons-builtin/install_type_data_only_normal.png
../icons-builtin/install_type_fast_normal.png
../icons-builtin/install_type_grub_install_normal.png
../icons-builtin/install_type_grub_update_normal.png
../icons-builtin/install_type_next_normal.png
../icons-builtin/install_type_part_normal.png
../icons-builtin/install_type_recovery_normal.png
../icons-builtin/install_type_system_only_normal.png
)
file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_custom_command(
OUTPUT ${GRESOURCE_C}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${GLIB_COMPILE_RESOURCES}
ARGS
--generate-source
--target=${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
${GRESOURCE_XML}
VERBATIM
MAIN_DEPENDENCY ${GRESOURCE_XML}
DEPENDS
${GLADE}
)
add_custom_target(
dummy-resource
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
)
add_definitions(-DVTE_INCLUDE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \
-O2 -pipe -fno-plt -fexceptions \
-Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection")
string(FIND "${CMAKE_CXX_FLAGS}" "-D_FORTIFY_SOURCE" FORTIFY_FOUND)
if(FORTIFY_FOUND EQUAL -1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wp,-D_FORTIFY_SOURCE=2")
endif()
set(SOURCE_FILES
ubinstall-gtk.c
ubinstall-gtk-advanced.c
ubinstall-gtk-page-switch.c
ubinstall-gtk-keyboard.c
ubinstall-gtk-region.c
ubinstall-gtk-bootloader.c
ubinstall-gtk-components.c
ubinstall-gtk-grub.c
ubinstall-gtk-installation.c
ubinstall-gtk-network.c
ubinstall-gtk-separate.c
ubinstall-gtk-users.c
ubinstall-gtk-configuration-mode.c
ubinstall-gtk-decorations.c
ubinstall-gtk-log.c
# ubinstall-gtk-password.c
ubinstall-gtk-saving.c
ubinstall-gtk-standard.c
ubinstall-gtk-install-start.c
ubinstall-gtk-startup-services.c
ubinstall-gtk-kernel.c
ubinstall-gtk-language.c
ubinstall-gtk.h
ubl-strings.h
)
set(LIBRARIES
${GTK_LIBRARIES}
${WEBKIT_LIBRARIES}
${UTILS_LIBRARIES}
${VTE291_LIBRARIES}
${JSON_LIBRARIES}
pthread
ublsettings
ublsettings-gtk3
ublsettingsui-gtk3
)
add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C})
target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBRARIES})
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR})
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
PROPERTIES GENERATED TRUE
)
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
add_dependencies(${PROJECT_NAME} dummy-resource)