Skip to content

Commit

Permalink
Format cmake files (Mudlet#3598)
Browse files Browse the repository at this point in the history
  • Loading branch information
vadi2 authored Apr 12, 2020
1 parent 752e38e commit 4ee1f46
Show file tree
Hide file tree
Showing 11 changed files with 656 additions and 811 deletions.
109 changes: 49 additions & 60 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,21 @@
# Should be called before PROJECT.
cmake_minimum_required(VERSION 3.3)
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13") # Qt 5.11.2 with which we build on OS X supports 10.11 and up, but some tools are not provided as bottles for that anymore.
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13") # Qt 5.11.2 with which we build on OS
# X supports 10.11 and up, but some
# tools are not provided as bottles
# for that anymore.
endif()

project(mudlet)

if(CMAKE_CONFIGURATION_TYPES)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
--force-new-ctest-process --output-on-failure
--build-config "$<CONFIGURATION>")
add_custom_target(
check COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process
--output-on-failure --build-config "$<CONFIGURATION>")
else()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
--force-new-ctest-process --output-on-failure)
--force-new-ctest-process --output-on-failure)
endif()

enable_testing()
Expand All @@ -66,21 +69,21 @@ else()
set(APP_TARGET mudlet)
endif()

# APP_BUILD should only be empty/null in official "release" builds,
# developers may like to set the MUDLET_VERSION_BUILD environment variable to
# their user and branch names to make it easier to tell different builds apart!
# APP_BUILD should only be empty/null in official "release" builds, developers
# may like to set the MUDLET_VERSION_BUILD environment variable to their user
# and branch names to make it easier to tell different builds apart!
#
# Changing this pair of values affects: ctelnet.cpp, main.cpp, mudlet.cpp
# dlgAboutDialog.cpp and TLuaInterpreter.cpp. It will not necessarily cause
# those files to be automatically rebuilt so you may need to 'touch' those files if
# the variables are changed and you are not doing a full, clean, rebuild!
# Use APP_VERSION, APP_BUILD and APP_TARGET defines in the source code if needed.
# IMPORTANT:
# To insure consistency please ensure the SAME of the first two values are also
# assigned to the "VERSION" and "BUILD" variables in the native qmake project
# file, which is NOW called: ./src/mudlet.pro
# those files to be automatically rebuilt so you may need to 'touch' those files
# if the variables are changed and you are not doing a full, clean, rebuild! Use
# APP_VERSION, APP_BUILD and APP_TARGET defines in the source code if needed.
# IMPORTANT: To insure consistency please ensure the SAME of the first two
# values are also assigned to the "VERSION" and "BUILD" variables in the native
# qmake project file, which is NOW called: ./src/mudlet.pro
set(APP_VERSION 4.6.2)
if(DEFINED ENV{MUDLET_VERSION_BUILD} AND NOT $ENV{MUDLET_VERSION_BUILD} STREQUAL "")
if(DEFINED ENV{MUDLET_VERSION_BUILD} AND NOT $ENV{MUDLET_VERSION_BUILD}
STREQUAL "")
set(APP_BUILD $ENV{MUDLET_VERSION_BUILD})
else()
set(APP_BUILD "-dev")
Expand All @@ -91,69 +94,55 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
include(IncludeOptionalModule)

include_optional_module(
ENVIRONMENT_VARIABLE WITH_UPDATER
OPTION_VARIABLE USE_UPDATER
READABLE_NAME "updater"
ENVIRONMENT_VARIABLE
WITH_UPDATER
OPTION_VARIABLE
USE_UPDATER
READABLE_NAME
"updater"
SUPPORTED_SYSTEMS
"Linux"
"Windows"
"Darwin"
)
include_optional_module(
ENVIRONMENT_VARIABLE WITH_FONTS
OPTION_VARIABLE USE_FONTS
READABLE_NAME "fonts"
)
include_optional_module(
ENVIRONMENT_VARIABLE WITH_3DMAPPER
OPTION_VARIABLE USE_3DMAPPER
READABLE_NAME "3D mapper"
)
"Linux"
"Windows"
"Darwin")
include_optional_module(ENVIRONMENT_VARIABLE WITH_FONTS OPTION_VARIABLE
USE_FONTS READABLE_NAME "fonts")
include_optional_module(ENVIRONMENT_VARIABLE WITH_3DMAPPER OPTION_VARIABLE
USE_3DMAPPER READABLE_NAME "3D mapper")
include_optional_module(
ENVIRONMENT_VARIABLE WITH_VARIABLE_SPLASH_SCREEN
OPTION_VARIABLE USE_VARIABLE_SPLASH_SCREEN
READABLE_NAME "build-type splash screen"
)
ENVIRONMENT_VARIABLE WITH_VARIABLE_SPLASH_SCREEN OPTION_VARIABLE
USE_VARIABLE_SPLASH_SCREEN READABLE_NAME "build-type splash screen")

include(InitGitSubmodule)

git_submodule_init(
CHECK_FILE "3rdparty/edbee-lib/CMakeLists.txt"
SUBMODULE_PATH "3rdparty/edbee-lib"
READABLE_NAME "edbee-lib editor widget"
)
CHECK_FILE "3rdparty/edbee-lib/CMakeLists.txt" SUBMODULE_PATH
"3rdparty/edbee-lib" READABLE_NAME "edbee-lib editor widget")

git_submodule_init(
CHECK_FILE "3rdparty/qtkeychain/CMakeLists.txt"
SUBMODULE_PATH "3rdparty/qtkeychain"
READABLE_NAME "QtKeychain"
)
CHECK_FILE "3rdparty/qtkeychain/CMakeLists.txt" SUBMODULE_PATH
"3rdparty/qtkeychain" READABLE_NAME "QtKeychain")

git_submodule_init(
CHECK_FILE "3rdparty/lcf/lcf-scm-1.rockspec"
SUBMODULE_PATH "3rdparty/lcf"
READABLE_NAME "lua code formatter source code"
)
CHECK_FILE "3rdparty/lcf/lcf-scm-1.rockspec" SUBMODULE_PATH "3rdparty/lcf"
READABLE_NAME "lua code formatter source code")

if(USE_UPDATER)
git_submodule_init(
CHECK_FILE "3rdparty/dblsqd/CMakeLists.txt"
SUBMODULE_PATH "3rdparty/dblsqd"
READABLE_NAME "DBLSQD updater"
)
git_submodule_init(CHECK_FILE "3rdparty/dblsqd/CMakeLists.txt" SUBMODULE_PATH
"3rdparty/dblsqd" READABLE_NAME "DBLSQD updater")
endif()

if(APPLE)
if(USE_UPDATER)
git_submodule_init(
CHECK_FILE "3rdparty/sparkle-glue/CMakeLists.txt"
SUBMODULE_PATH "3rdparty/sparkle-glue"
READABLE_NAME "Sparkle glue for updater"
)
CHECK_FILE "3rdparty/sparkle-glue/CMakeLists.txt" SUBMODULE_PATH
"3rdparty/sparkle-glue" READABLE_NAME "Sparkle glue for updater")

if(NOT EXISTS "${CMAKE_HOME_DIRECTORY}/3rdparty/cocoapods/Pods/Sparkle")
message(STATUS "Sparkle CocoaPod is missing, running 'pod install' to get it...")
execute_process(TIMEOUT 30
message(
STATUS "Sparkle CocoaPod is missing, running 'pod install' to get it..."
)
execute_process(
TIMEOUT 30
WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/3rdparty/cocoapods"
COMMAND pod install)
endif()
Expand Down
212 changes: 93 additions & 119 deletions cmake/FindHUNSPELL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,134 +8,108 @@
# HUNSPELL_LIBRARY
# HUNSPELL_INCLUDE_DIR, where to find hunspell/*.h

FIND_PACKAGE(PkgConfig)
find_package(PkgConfig)

PKG_SEARCH_MODULE(PC_HUNSPELL hunspell libhunspell)
pkg_search_module(PC_HUNSPELL hunspell libhunspell)

FIND_PATH(HUNSPELL_INCLUDE_DIR hunspell/hunspell.h
HINTS
${HUNSPELL_DIR}
$ENV{HUNSPELL_DIR}
${PC_HUNSPELL_INCLUDE_DIRS}
PATH_SUFFIXES
include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_path(
HUNSPELL_INCLUDE_DIR hunspell/hunspell.h
HINTS ${HUNSPELL_DIR} $ENV{HUNSPELL_DIR} ${PC_HUNSPELL_INCLUDE_DIRS}
PATH_SUFFIXES include
PATHS ~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt)

FIND_LIBRARY(HUNSPELL_LIBRARY_RELEASE
NAMES
hunspell
libhunspell
hunspell-1.7
hunspell-1.6
hunspell-1.5
hunspell-1.4
hunspell-1.3
HINTS
${HUNSPELL_DIR}
$ENV{HUNSPELL_DIR}
${PC_HUNSPELL_LIBRARY_DIRS}
${PC_HUNSPELL_LIBRARY_DIR}
PATH_SUFFIXES
lib64
lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
find_library(
HUNSPELL_LIBRARY_RELEASE
NAMES hunspell
libhunspell
hunspell-1.7
hunspell-1.6
hunspell-1.5
hunspell-1.4
hunspell-1.3
HINTS ${HUNSPELL_DIR} $ENV{HUNSPELL_DIR} ${PC_HUNSPELL_LIBRARY_DIRS}
${PC_HUNSPELL_LIBRARY_DIR}
PATH_SUFFIXES lib64 lib
PATHS ~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt)

FIND_LIBRARY(HUNSPELL_LIBRARY_DEBUG
NAMES
hunspelld
libhunspelld
hunspelld-1.7
hunspelld-1.6
hunspelld-1.5
hunspelld-1.4
hunspelld-1.3
HINTS
${HUNSPELL_DIR}
$ENV{HUNSPELL_DIR}
${PC_HUNSPELL_LIBRARY_DIRS}
${PC_HUNSPELL_LIBRARY_DIR}
PATH_SUFFIXES
lib64
lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
find_library(
HUNSPELL_LIBRARY_DEBUG
NAMES hunspelld
libhunspelld
hunspelld-1.7
hunspelld-1.6
hunspelld-1.5
hunspelld-1.4
hunspelld-1.3
HINTS ${HUNSPELL_DIR} $ENV{HUNSPELL_DIR} ${PC_HUNSPELL_LIBRARY_DIRS}
${PC_HUNSPELL_LIBRARY_DIR}
PATH_SUFFIXES lib64 lib
PATHS ~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt)

IF(HUNSPELL_LIBRARY_DEBUG AND HUNSPELL_LIBRARY_RELEASE)
SET(HUNSPELL_LIBRARY optimized ${HUNSPELL_LIBRARY_RELEASE} debug ${HUNSPELL_LIBRARY_DEBUG} )
ELSEIF(HUNSPELL_LIBRARY_RELEASE)
SET(HUNSPELL_LIBRARY ${HUNSPELL_LIBRARY_RELEASE} )
ELSEIF(HUNSPELL_LIBRARY_DEBUG)
SET(HUNSPELL_LIBRARY ${HUNSPELL_LIBRARY_DEBUG} )
ENDIF()
if(HUNSPELL_LIBRARY_DEBUG AND HUNSPELL_LIBRARY_RELEASE)
set(HUNSPELL_LIBRARY optimized ${HUNSPELL_LIBRARY_RELEASE} debug
${HUNSPELL_LIBRARY_DEBUG})
elseif(HUNSPELL_LIBRARY_RELEASE)
set(HUNSPELL_LIBRARY ${HUNSPELL_LIBRARY_RELEASE})
elseif(HUNSPELL_LIBRARY_DEBUG)
set(HUNSPELL_LIBRARY ${HUNSPELL_LIBRARY_DEBUG})
endif()

IF(PC_HUNSPELL_hunspell_FOUND)
SET(HUNSPELL_VERSION ${PC_HUNSPELL_hunspell_VERSION})
ELSEIF(PC_HUNSPELL_libhunspell_FOUND)
SET(HUNSPELL_VERSION ${PC_HUNSPELL_libhunspell_VERSION})
ELSE()
SET(HUNSPELL_VERSION ${PC_HUNSPELL_VERSION})
ENDIF()
if(PC_HUNSPELL_hunspell_FOUND)
set(HUNSPELL_VERSION ${PC_HUNSPELL_hunspell_VERSION})
elseif(PC_HUNSPELL_libhunspell_FOUND)
set(HUNSPELL_VERSION ${PC_HUNSPELL_libhunspell_VERSION})
else()
set(HUNSPELL_VERSION ${PC_HUNSPELL_VERSION})
endif()

INCLUDE(FindPackageHandleStandardArgs)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set HUNSPELL_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HUNSPELL
REQUIRED_VARS
HUNSPELL_LIBRARY
HUNSPELL_INCLUDE_DIR
VERSION_VAR
HUNSPELL_VERSION
)
find_package_handle_standard_args(
HUNSPELL REQUIRED_VARS HUNSPELL_LIBRARY HUNSPELL_INCLUDE_DIR VERSION_VAR
HUNSPELL_VERSION)

MARK_AS_ADVANCED(HUNSPELL_INCLUDE_DIR HUNSPELL_LIBRARY HUNSPELL_LIBRARY_RELEASE HUNSPELL_LIBRARY_DEBUG)
mark_as_advanced(HUNSPELL_INCLUDE_DIR HUNSPELL_LIBRARY HUNSPELL_LIBRARY_RELEASE
HUNSPELL_LIBRARY_DEBUG)

GET_FILENAME_COMPONENT(HUNSPELL_FILENAME ${HUNSPELL_LIBRARY} NAME_WE)
STRING(FIND ${HUNSPELL_FILENAME} .a HUNSPELL_STATIC)
get_filename_component(HUNSPELL_FILENAME ${HUNSPELL_LIBRARY} NAME_WE)
string(FIND ${HUNSPELL_FILENAME} .a HUNSPELL_STATIC)

IF(HUNSPELL_FOUND AND NOT TARGET HUNSPELL::HUNSPELL)
IF(HUNSPELL_STATIC EQUAL -1)
ADD_LIBRARY(HUNSPELL::HUNSPELL SHARED IMPORTED)
SET_TARGET_PROPERTIES(HUNSPELL::HUNSPELL PROPERTIES
IMPORTED_LOCATION
"${HUNSPELL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES
"${HUNSPELL_INCLUDE_DIR}"
)
ELSE()
ADD_LIBRARY(HUNSPELL::HUNSPELL STATIC IMPORTED)
SET_TARGET_PROPERTIES(HUNSPELL::HUNSPELL PROPERTIES
INTERFACE_COMPILE_DEFINITIONS
HUNSPELL_STATIC
IMPORTED_LOCATION
"${HUNSPELL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES
"${HUNSPELL_INCLUDE_DIR}"
)
ENDIF()
ENDIF()
if(HUNSPELL_FOUND AND NOT TARGET HUNSPELL::HUNSPELL)
if(HUNSPELL_STATIC EQUAL -1)
add_library(HUNSPELL::HUNSPELL SHARED IMPORTED)
set_target_properties(
HUNSPELL::HUNSPELL
PROPERTIES IMPORTED_LOCATION "${HUNSPELL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${HUNSPELL_INCLUDE_DIR}")
else()
add_library(HUNSPELL::HUNSPELL STATIC IMPORTED)
set_target_properties(
HUNSPELL::HUNSPELL
PROPERTIES INTERFACE_COMPILE_DEFINITIONS HUNSPELL_STATIC
IMPORTED_LOCATION "${HUNSPELL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${HUNSPELL_INCLUDE_DIR}")
endif()
endif()
Loading

0 comments on commit 4ee1f46

Please sign in to comment.