2023-04-09 05:35:35 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-04-03 13:49:25 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2022-01-24 02:23:08 +00:00
|
|
|
|
2023-06-20 12:34:34 +00:00
|
|
|
project(FreeKill VERSION 0.2.5)
|
2023-03-08 04:14:02 +00:00
|
|
|
add_definitions(-DFK_VERSION=\"${CMAKE_PROJECT_VERSION}\")
|
2022-01-24 02:23:08 +00:00
|
|
|
|
2022-09-14 05:01:10 +00:00
|
|
|
find_package(Qt6 REQUIRED COMPONENTS
|
2022-04-30 07:27:56 +00:00
|
|
|
Network
|
2022-01-24 02:23:08 +00:00
|
|
|
)
|
|
|
|
|
2023-03-08 04:14:02 +00:00
|
|
|
if (NOT DEFINED FK_SERVER_ONLY)
|
|
|
|
find_package(Qt6 REQUIRED COMPONENTS
|
|
|
|
Gui
|
|
|
|
Qml
|
|
|
|
Widgets
|
|
|
|
Multimedia
|
|
|
|
QuickControls2
|
|
|
|
LinguistTools
|
|
|
|
)
|
|
|
|
else ()
|
|
|
|
add_definitions(-DFK_SERVER_ONLY)
|
|
|
|
endif()
|
|
|
|
|
2022-12-18 04:52:52 +00:00
|
|
|
find_package(OpenSSL)
|
2022-01-24 02:23:08 +00:00
|
|
|
find_package(Lua)
|
2022-03-24 13:23:42 +00:00
|
|
|
find_package(SQLite3)
|
2022-01-24 02:23:08 +00:00
|
|
|
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
2023-03-08 04:14:02 +00:00
|
|
|
set(REQUIRED_QT_VERSION "6.4")
|
2022-01-24 02:23:08 +00:00
|
|
|
|
|
|
|
include_directories(include/lua)
|
2023-02-15 11:54:35 +00:00
|
|
|
include_directories(include)
|
|
|
|
include_directories(include/libgit2)
|
2022-01-24 02:23:08 +00:00
|
|
|
include_directories(src)
|
|
|
|
include_directories(src/client)
|
|
|
|
include_directories(src/core)
|
|
|
|
include_directories(src/network)
|
|
|
|
include_directories(src/server)
|
|
|
|
include_directories(src/ui)
|
|
|
|
|
2023-01-03 15:37:14 +00:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
|
|
|
|
# Fix include problem
|
|
|
|
include_directories("/usr/include/openssl-1.1/")
|
|
|
|
endif()
|
|
|
|
|
2022-09-14 05:01:10 +00:00
|
|
|
file(GLOB SWIG_FILES "${PROJECT_SOURCE_DIR}/src/swig/*.i")
|
2023-01-03 15:37:14 +00:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
|
|
|
|
set(SWIG_SOURCE ${PROJECT_SOURCE_DIR}/src/swig/freekill-wasm.i)
|
2023-03-08 04:14:02 +00:00
|
|
|
elseif (DEFINED FK_SERVER_ONLY)
|
|
|
|
set(SWIG_SOURCE ${PROJECT_SOURCE_DIR}/src/swig/freekill-nogui.i)
|
2023-01-03 15:37:14 +00:00
|
|
|
else ()
|
|
|
|
set(SWIG_SOURCE ${PROJECT_SOURCE_DIR}/src/swig/freekill.i)
|
|
|
|
endif ()
|
|
|
|
|
2022-09-14 05:01:10 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${PROJECT_SOURCE_DIR}/src/swig/freekill-wrap.cxx
|
|
|
|
DEPENDS ${SWIG_FILES}
|
|
|
|
COMMENT "Generating freekill-wrap.cxx"
|
|
|
|
COMMAND swig -c++ -lua -Wall -o
|
|
|
|
${PROJECT_SOURCE_DIR}/src/swig/freekill-wrap.cxx
|
2023-01-03 15:37:14 +00:00
|
|
|
${SWIG_SOURCE}
|
2022-09-14 05:01:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
qt_add_executable(FreeKill)
|
2023-03-08 04:14:02 +00:00
|
|
|
|
|
|
|
if (NOT DEFINED FK_SERVER_ONLY)
|
|
|
|
qt_add_translations(FreeKill
|
|
|
|
TS_FILES lang/zh_CN.ts
|
|
|
|
QM_FILES_OUTPUT_VARIABLE zh_CN.qm
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
TARGET FreeKill
|
|
|
|
POST_BUILD
|
2023-03-09 05:32:09 +00:00
|
|
|
COMMENT "Generating version file fk_ver"
|
|
|
|
COMMAND echo ${CMAKE_PROJECT_VERSION} > ${PROJECT_SOURCE_DIR}/fk_ver
|
2023-01-29 10:11:41 +00:00
|
|
|
)
|
2023-01-03 15:37:14 +00:00
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
|
2023-04-30 10:54:23 +00:00
|
|
|
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS}
|
|
|
|
"-s INITIAL_MEMORY=64MB"
|
|
|
|
)
|
|
|
|
|
|
|
|
file(GLOB_RECURSE FK_SCRIPT_FILES
|
|
|
|
RELATIVE ${PROJECT_SOURCE_DIR}
|
|
|
|
*.lua *.qml *.js *.fkp *.sql zh_CN.qm
|
|
|
|
)
|
|
|
|
qt_add_resources(FreeKill "scripts_qrc"
|
|
|
|
PREFIX "/"
|
|
|
|
FILES ${FK_SCRIPT_FILES}
|
|
|
|
)
|
|
|
|
|
|
|
|
qt_add_resources(FreeKill "font_qrc"
|
|
|
|
PREFIX "/"
|
|
|
|
FILES "fonts/FZLBGBK.ttf"
|
|
|
|
)
|
|
|
|
|
|
|
|
file(GLOB_RECURSE FK_IMG_FILES
|
|
|
|
RELATIVE ${PROJECT_SOURCE_DIR}
|
|
|
|
${PROJECT_SOURCE_DIR}/image/*.jpg
|
|
|
|
${PROJECT_SOURCE_DIR}/image/*.png
|
|
|
|
)
|
|
|
|
qt_add_resources(FreeKill "img_qrc"
|
|
|
|
PREFIX "/"
|
|
|
|
FILES ${FK_IMG_FILES}
|
|
|
|
)
|
|
|
|
file(GLOB_RECURSE FK_AUDIO_FILES
|
|
|
|
RELATIVE ${PROJECT_SOURCE_DIR}
|
|
|
|
${PROJECT_SOURCE_DIR}/audio/*.mp3
|
|
|
|
)
|
|
|
|
qt_add_resources(FreeKill "audio_qrc"
|
|
|
|
PREFIX "/"
|
|
|
|
FILES ${FK_AUDIO_FILES}
|
|
|
|
)
|
|
|
|
file(GLOB_RECURSE FK_PKG_FILES
|
|
|
|
RELATIVE ${PROJECT_SOURCE_DIR}
|
|
|
|
${PROJECT_SOURCE_DIR}/packages/*.mp3
|
|
|
|
${PROJECT_SOURCE_DIR}/packages/*.jpg
|
|
|
|
${PROJECT_SOURCE_DIR}/packages/*.png
|
|
|
|
)
|
|
|
|
qt_add_resources(FreeKill "pkg_qrc"
|
|
|
|
PREFIX "/"
|
|
|
|
FILES ${FK_PKG_FILES}
|
|
|
|
)
|
|
|
|
|
2023-01-03 15:37:14 +00:00
|
|
|
endif()
|
2023-04-30 10:54:23 +00:00
|
|
|
|
2022-01-24 02:23:08 +00:00
|
|
|
add_subdirectory(src)
|