mirror of
https://github.com/Mudlet/Mudlet
synced 2026-08-13 18:26:27 -04:00
* Enhance: enable builds in a full Windows MSYS2 environment (QMake only) By defining `WITH_MAIN_BUILD_SYSTEM` to the value `NO` this PR makes enough changes to the qmake project file to enable Mudlet to be compiled in a full MSYS2 development environment (in the MSYS2 Qt Creator) - this will enable easier development by Windows users (particularly those who also have some familiarity with *nix systems) as I have documented at: "Compiling on Windows 7+ (MSYS2_Alternative)" but it seems that the URL is causing GitHub to forget about the PR as it seems to push and is recorded in my local repository but never actually lands there! It also makes some changes to the setting up of the LUA package paths for the lua code formatter so that the paths are all entered with Unix style directory separators but converted to whatever the Lua package handler is set to use. In a Windows environment it is not unheard of to get both '\' and '/' being used within the same path as different parts get generated in stages - and using the backslash one can produce surprising error messages if the back slash is not properly escaped when displaying those messages in the main console or elsewhere (they dissappear entirely or end up escaping following characters producing misleading information). Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Update src/mudlet.pro BugFix: fix a typo in qmake project file. Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Revise: reduce almost duplicate comments Fix an addition to the `package.cpath` which would not have worked as it did not specify the file extension which is OS dependent. Also remove LuaJIT remenent, which we dropped support for a long time back. Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Apply suggestions from code review Revise: fix an error in a comment. Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Revise: take out some pre-processor stuff as run-time code works without it I was a bit sceptical at first but it *seems* to work. Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Enhance: modifications to get CMake working on Windows Revise a Mudlet specific CMake macro to not include the word "module" as that is not appropriate for all usages now. Fix an obscure CMake build error caused by the use of: `LIBRARYNAME::LIBRARYNAME` in `target_link_libraries(...)` which is the form for an interface usage of a library - this causes a failure of the build with an error message of the form: `src/CMakeFiles/mudlet.dir/build.make:1954: *** target pattern contains no '%'. Stop.` that line is actually one about one of the libraries concerned - and it is the first one which shows up in that file with a LIBRARYNAME-NOTFOUND entry. The fix seems to be to use only a LIBRARYNAME form. Fix a problem in `(static QString) mudlet::getShortPathName(const QString& name)` which is cause by a Windows specific function that takes.returns template/typedef type arguments which only work if the symbols `UNICODE` and `_UNICODE` to be defined and which aren't in an MSYS2/ Mingw-w64 environment. Revise some usages of the APP_BUILD defined value so that they are handled correctly (using `QStringLiteral`/`QByteArray` wrapppers). Change the CMake find module for Pugixml so that it uses a variable name in ALL_UPPER_CASE to remove a developer warning about using a mixed case one. Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Edit: fix copy paste issue I thought something needed to be more conditional than it was but didn't get it undone in last commit. Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Refactor: simplify the code to set up the Lua/C additional paths for LCF Peer-review suggested I needed to shrink the code. Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Revise: shrink some comments Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Revise: implement some changes requested by peer-review Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Revise: shorten multi-line comment in initIndenterGlobals() Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Revise: further change suggested in peer-review Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Fix recognition of static libraries in own Find modules Co-authored-by: keneanung <keneanung@googlemail.com>
99 lines
2.8 KiB
CMake
99 lines
2.8 KiB
CMake
# Locate ZIP library
|
|
# This module defines
|
|
# ZIP_FOUND, if false, do not try to link to ZIP
|
|
# ZIP_LIBRARIES
|
|
# ZIP_INCLUDE_DIR, where to find zip*.h
|
|
|
|
find_package(PkgConfig)
|
|
|
|
pkg_search_module(PC_ZIP zip libzip)
|
|
|
|
find_path(
|
|
ZIP_INCLUDE_DIR zip.h
|
|
HINTS ${ZIP_DIR} $ENV{ZIP_DIR} ${PC_ZIP_INCLUDE_DIRS}
|
|
PATH_SUFFIXES include
|
|
PATHS ~/Library/Frameworks
|
|
/Library/Frameworks
|
|
/usr/local
|
|
/usr
|
|
/sw # Fink
|
|
/opt/local # DarwinPorts
|
|
/opt/csw # Blastwave
|
|
/opt)
|
|
|
|
find_library(
|
|
ZIP_LIBRARY_RELEASE
|
|
NAMES zip zip_s
|
|
HINTS ${ZIP_DIR} $ENV{ZIP_DIR} ${PC_ZIP_LIBRARY_DIRS} ${PC_ZIP_LIBRARY_DIR}
|
|
PATH_SUFFIXES lib64 lib
|
|
PATHS ~/Library/Frameworks
|
|
/Library/Frameworks
|
|
/usr/local
|
|
/usr
|
|
/sw
|
|
/opt/local
|
|
/opt/csw
|
|
/opt)
|
|
|
|
find_library(
|
|
ZIP_LIBRARY_DEBUG
|
|
NAMES zipd zip_sd
|
|
HINTS ${ZIP_DIR} $ENV{ZIP_DIR} ${PC_ZIP_LIBRARY_DIRS} ${PC_ZIP_LIBRARY_DIR}
|
|
PATH_SUFFIXES lib64 lib
|
|
PATHS ~/Library/Frameworks
|
|
/Library/Frameworks
|
|
/usr/local
|
|
/usr
|
|
/sw
|
|
/opt/local
|
|
/opt/csw
|
|
/opt)
|
|
|
|
if(ZIP_LIBRARY_DEBUG AND ZIP_LIBRARY_RELEASE)
|
|
set(ZIP_LIBRARY optimized ${ZIP_LIBRARY_RELEASE} debug ${ZIP_LIBRARY_DEBUG})
|
|
get_filename_component(ZIP_FILENAME ${ZIP_LIBRARY_RELEASE} NAME)
|
|
elseif(ZIP_LIBRARY_RELEASE)
|
|
set(ZIP_LIBRARY ${ZIP_LIBRARY_RELEASE})
|
|
get_filename_component(ZIP_FILENAME ${ZIP_LIBRARY_RELEASE} NAME)
|
|
elseif(ZIP_LIBRARY_DEBUG)
|
|
set(ZIP_LIBRARY ${ZIP_LIBRARY_DEBUG})
|
|
get_filename_component(ZIP_FILENAME ${ZIP_LIBRARY_DEBUG} NAME)
|
|
endif()
|
|
|
|
if(PC_ZIP_zip_FOUND)
|
|
set(ZIP_VERSION ${PC_ZIP_zip_VERSION})
|
|
elseif(PC_ZIP_libzip_FOUND)
|
|
set(ZIP_VERSION ${PC_ZIP_libzip_VERSION})
|
|
else()
|
|
set(ZIP_VERSION ${PC_ZIP_VERSION})
|
|
endif()
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
# handle the QUIETLY and REQUIRED arguments and set ZIP_FOUND to TRUE if all
|
|
# listed variables are TRUE
|
|
find_package_handle_standard_args(ZIP REQUIRED_VARS ZIP_LIBRARY ZIP_INCLUDE_DIR
|
|
VERSION_VAR ZIP_VERSION)
|
|
|
|
string(FIND ${ZIP_FILENAME} zip_s ZIP_STATIC)
|
|
if(ZIP_STATIC EQUAL -1)
|
|
string(FIND ${ZIP_FILENAME} .a ZIP_STATIC)
|
|
endif()
|
|
|
|
mark_as_advanced(ZIP_INCLUDE_DIR ZIP_LIBRARY ZIP_LIBRARY_RELEASE
|
|
ZIP_LIBRARY_DEBUG)
|
|
|
|
if(ZIP_FOUND AND NOT TARGET ZIP::ZIP)
|
|
if(ZIP_STATIC EQUAL -1)
|
|
add_library(ZIP::ZIP SHARED IMPORTED)
|
|
set_target_properties(
|
|
ZIP::ZIP
|
|
PROPERTIES INTERFACE_COMPILE_DEFINITIONS ZIP_EXTERN= IMPORTED_LOCATION
|
|
"${ZIP_LIBRARY}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${ZIP_INCLUDE_DIR}")
|
|
else()
|
|
add_library(ZIP::ZIP STATIC IMPORTED)
|
|
set_target_properties(
|
|
ZIP::ZIP PROPERTIES IMPORTED_LOCATION "${ZIP_LIBRARY}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${ZIP_INCLUDE_DIR}")
|
|
endif()
|
|
endif()
|