LogDoctor/logdoctor/CMakeLists.txt

336 lines
9.1 KiB
CMake
Raw Normal View History

2022-06-21 21:07:06 +02:00
cmake_minimum_required(VERSION 3.5)
2024-02-16 22:13:11 +01:00
project(LogDoctor VERSION 4.00 LANGUAGES CXX)
2022-06-21 21:07:06 +02:00
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 20)
2022-06-21 21:07:06 +02:00
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MSVC)
add_compile_options(/W2)
set(CMAKE_CXX_FLAGS_MINSIZEREL "/Os")
set(CMAKE_CXX_FLAGS_RELEASE "/O2")
else()
add_compile_options(-Wall -Wextra -Wpedantic)
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
endif()
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core Widgets Charts LinguistTools Sql Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Charts LinguistTools Sql Network)
2022-07-08 21:29:08 +02:00
2023-09-24 17:20:45 +02:00
if(${QT_VERSION_MAJOR} LESS 6)
message("Error: Qt6 or greater required")
return()
endif()
2022-06-21 21:07:06 +02:00
set(TS_FILES
translations/LogDoctor_en_GB.ts
translations/LogDoctor_es_ES.ts
translations/LogDoctor_fr_FR.ts
translations/LogDoctor_it_IT.ts
translations/LogDoctor_ja_JP.ts
translations/LogDoctor_pt_BR.ts
2022-06-21 21:07:06 +02:00
)
2022-08-27 11:18:02 +02:00
2022-06-21 21:07:06 +02:00
set(PROJECT_SOURCES
main.cpp
mainwindow.ui
mainwindow.h
mainwindow.cpp
2024-01-22 00:57:19 +01:00
main_lib.h
2024-01-22 00:15:10 +01:00
globals/db_names.h
globals/db_names.cpp
globals/global_configs.h
globals/global_configs.cpp
2024-02-04 11:39:16 +01:00
customs/logfile_treewidgetitem.h
customs/models/logfields_listmodel.h
customs/models/logfields_listmodel.cpp
utilities/arrays.h
2024-02-04 01:15:00 +01:00
utilities/bwlists.h
utilities/bwutils.cpp
2023-12-01 21:58:14 +01:00
utilities/chars.h
utilities/checks.h
utilities/checks.cpp
utilities/colors.h
utilities/colors.cpp
utilities/gzip.h
utilities/gzip.cpp
utilities/io.h
utilities/io.cpp
utilities/memory.h
utilities/memory.cpp
2023-01-27 02:48:46 +01:00
utilities/printables.h
utilities/printables.cpp
utilities/rtf.h
utilities/rtf.cpp
utilities/strings.h
utilities/strings.cpp
2022-11-07 21:29:29 +01:00
utilities/stylesheets.h
utilities/stylesheets.cpp
utilities/vectors.h
modules/shared.h
modules/exceptions.h
modules/exceptions.cpp
modules/tb.h
modules/tb.cpp
modules/database/database.h
modules/database/database.cpp
modules/dialogs.h
modules/dialogs.cpp
2023-09-10 16:44:30 +02:00
modules/dialogs/message_dialog.ui
modules/dialogs/message_dialog.h
modules/dialogs/message_dialog.cpp
modules/dialogs/boolean_dialog.ui
modules/dialogs/boolean_dialog.h
modules/dialogs/boolean_dialog.cpp
modules/dialogs/ida_dialog.ui
modules/dialogs/ida_dialog.h
modules/dialogs/ida_dialog.cpp
modules/blacklists/blacklists.h
modules/blacklists/blacklists.cpp
modules/blacklists/modules/lib.h
modules/blacklists/modules/blacklist.h
modules/blacklists/modules/blacklist.cpp
modules/blacklists/modules/blacklist_item.h
modules/blacklists/modules/blacklist_item.cpp
modules/warnlists/warnlists.h
modules/warnlists/warnlists.cpp
modules/warnlists/modules/lib.h
modules/warnlists/modules/warnlist.h
modules/warnlists/modules/warnlist.cpp
modules/warnlists/modules/warnlist_item.h
modules/warnlists/modules/warnlist_item.cpp
2024-02-04 11:40:28 +01:00
modules/craplog/lib.h
modules/craplog/craplog.h
modules/craplog/craplog.cpp
modules/craplog/modules/lib.h
modules/craplog/modules/datetime.h
modules/craplog/modules/datetime.cpp
modules/craplog/modules/donuts.h
modules/craplog/modules/donuts.cpp
modules/craplog/modules/formats.h
modules/craplog/modules/formats.cpp
modules/craplog/modules/hash.h
modules/craplog/modules/hash.cpp
modules/craplog/modules/logs.h
modules/craplog/modules/logs.cpp
modules/craplog/modules/sha256.h
modules/craplog/modules/sha256.cpp
modules/craplog/modules/workers/lib.h
2023-05-14 14:23:18 +02:00
modules/craplog/modules/workers/lister.h
modules/craplog/modules/workers/lister.cpp
modules/craplog/modules/workers/parser.h
modules/craplog/modules/workers/parser.cpp
2024-01-21 14:47:01 +01:00
modules/craplog/modules/workers/impl/loglinedata.cpp
2024-02-04 21:41:51 +01:00
modules/crapview/lib.h
modules/crapview/crapview.h
modules/crapview/crapview.cpp
2024-02-03 16:52:15 +01:00
modules/crapview/modules/lib.h
2023-07-23 11:00:46 +02:00
modules/crapview/modules/filters.h
modules/crapview/modules/filters.cpp
modules/crapview/modules/query.h
modules/crapview/modules/query.cpp
modules/craphelp/craphelp.ui
modules/craphelp/craphelp.h
modules/craphelp/craphelp.cpp
2022-11-13 01:36:54 +01:00
modules/crapup/crapup.ui
modules/crapup/crapup.h
modules/crapup/crapup.cpp
modules/crapup/modules/stylesheets.h
modules/crapup/modules/stylesheets.cpp
modules/crapinfo/crapinfo.ui
modules/crapinfo/crapinfo.h
modules/crapinfo/crapinfo.cpp
modules/crapinfo/modules/stylesheets.h
modules/crapinfo/modules/stylesheets.cpp
modules/changelog/changelog.ui
modules/changelog/changelog.h
modules/changelog/changelog.cpp
modules/changelog/modules/stylesheets.h
modules/changelog/modules/stylesheets.cpp
tools/crappath/crappath.h
tools/crappath/crappath.cpp
tools/crapnote/crapnote.ui
tools/crapnote/crapnote.h
tools/crapnote/crapnote.cpp
tools/crapnote/modules/stylesheets.h
tools/crapnote/modules/stylesheets.cpp
games/game_dialog.ui
games/game_dialog.h
games/game_dialog.cpp
2022-11-24 22:30:34 +01:00
games/crisscross/crisscross.ui
games/crisscross/game.h
games/crisscross/game.cpp
games/crisscross/modules/stylesheets.h
games/crisscross/modules/stylesheets.cpp
2022-11-24 22:30:34 +01:00
games/snake/snake.ui
games/snake/game.h
games/snake/game.cpp
games/snake/snake.h
games/snake/snake.cpp
games/snake/food.h
games/snake/food.cpp
games/snake/modules/stylesheets.h
games/snake/modules/stylesheets.cpp
2022-10-17 20:20:29 +02:00
resources/resources.qrc
${TS_FILES}
2022-06-21 21:07:06 +02:00
)
2023-09-24 17:20:45 +02:00
qt_add_executable(LogDoctor
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
2022-06-21 21:07:06 +02:00
if(WIN32)
2023-10-22 16:56:34 +02:00
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bstatic -lstdc++ -lwinpthread")
target_link_libraries(LogDoctor PRIVATE
-static Qt${QT_VERSION_MAJOR}::Core
-static Qt${QT_VERSION_MAJOR}::Widgets
-static Qt${QT_VERSION_MAJOR}::Charts
-static Qt${QT_VERSION_MAJOR}::Sql
2023-09-24 17:20:45 +02:00
-static Qt${QT_VERSION_MAJOR}::Network
)
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
target_link_libraries(LogDoctor PRIVATE
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Charts
Qt${QT_VERSION_MAJOR}::Sql
2023-09-24 17:20:45 +02:00
Qt${QT_VERSION_MAJOR}::Network
)
# Include zlib
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIRS})
target_link_libraries(LogDoctor PRIVATE ${ZLIB_LIBRARIES})
endif()
2022-08-12 22:13:14 +02:00
2022-08-17 23:36:39 +02:00
2023-09-24 17:20:45 +02:00
if(WIN32)
set_target_properties(LogDoctor PROPERTIES
WIN32_EXECUTABLE TRUE
)
elseif(APPLE)
2022-11-16 17:30:07 +01:00
set_target_properties(LogDoctor PROPERTIES
MACOSX_BUNDLE TRUE
#MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME}
MACOSX_BUNDLE_ICON_FILE ${PROJECT_NAME}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
endif()
2023-09-24 17:20:45 +02:00
qt_finalize_executable(LogDoctor)
2022-06-21 21:07:06 +02:00
2022-12-03 19:36:04 +01:00
# CTest
include(CTest)
enable_testing()
add_executable(LogDocTester
tests/main.cpp
tests/white_box.h
tests/white_box.cpp
# 2 test
modules/exceptions.h
modules/exceptions.cpp
modules/craplog/modules/lib.h
2024-01-21 14:47:01 +01:00
modules/craplog/modules/workers/lib.h
modules/craplog/modules/workers/impl/loglinedata.cpp
utilities/gzip.h
utilities/gzip.cpp
utilities/io.h
utilities/io.cpp
utilities/strings.h
utilities/strings.cpp
utilities/vectors.h
modules/craplog/modules/datetime.h
modules/craplog/modules/datetime.cpp
modules/craplog/modules/formats.h
modules/craplog/modules/formats.cpp
modules/craplog/modules/logs.h
modules/craplog/modules/logs.cpp
2023-07-23 11:00:46 +02:00
modules/crapview/modules/filters.h
modules/crapview/modules/filters.cpp
)
if(WIN32)
target_link_libraries(LogDocTester PRIVATE
-static Qt${QT_VERSION_MAJOR}::Widgets
#-static Qt${QT_VERSION_MAJOR}::Sql
)
else()
target_link_libraries(LogDocTester PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
#Qt${QT_VERSION_MAJOR}::Sql
${ZLIB_LIBRARIES}
)
endif()
add_test(
NAME LogDocTester
COMMAND $<TARGET_FILE:LogDocTester>
)
2022-12-06 21:24:04 +01:00
# Deb/Flatpak
if(UNIX AND NOT APPLE)
2022-12-03 19:36:04 +01:00
install(TARGETS
LogDoctor
RUNTIME DESTINATION /usr/bin
CONFIGURATIONS Release
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ
RENAME logdoctor
)
install(FILES
${CMAKE_SOURCE_DIR}/installation_stuff/LogDoctor.desktop
DESTINATION /usr/share/applications
)
2022-12-03 19:36:04 +01:00
install(DIRECTORY
DESTINATION /usr/share/LogDoctor
)
install(FILES
${CMAKE_SOURCE_DIR}/installation_stuff/LogDoctor.svg
DESTINATION /usr/share/LogDoctor
)
install(DIRECTORY
2022-12-06 21:24:04 +01:00
${CMAKE_SOURCE_DIR}/installation_stuff/logdocdata/help
DESTINATION /usr/share/LogDoctor
)
install(DIRECTORY
2022-12-06 21:24:04 +01:00
${CMAKE_SOURCE_DIR}/installation_stuff/logdocdata/licenses
DESTINATION /usr/share/LogDoctor
)
endif()