xmake icon indicating copy to clipboard operation
xmake copied to clipboard

Unable to import CMake QtCreator plugin libs

Open Arthapz opened this issue 4 years ago • 6 comments

Describe the bug

XMake fail to import QtCreator Library

to reproduce:

git pull https://github.com/qt-creator/qt-creator.git -b 6.0 --depth 1
wget -O libclang.7z https://download.qt.io/development_releases/prebuilt/libclang/libclang-release_130-based-windows-vs2019_64.7z
7za libclang.7z
cd qt-creator
xmake --trybuild="cmake" --tryconfigs="-DCMAKE_PREFIX_PATH=..\libclang"
$env:CMAKE_PREFIX_PATH="."; xmake l -vD find_package cmake::QtCreator

Expected behavior

To have XMake be able to import QtCreator plugin lib like any other CMake library

Error output

running builtin module find_package with args:
dump from _print_vlog @@programdir\plugins\lua\main.lua:55
"cmake::QtCreator"
finding QtCreator from cmake ..
cmake C:\Users\arthu\AppData\Local\Temp\.xmake\211110\_224DF2B365C648608976D180763FC7C0.dir
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
-- The C compiler identification is MSVC 19.30.30705.0
-- The CXX compiler identification is MSVC 19.30.30705.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found Threads: TRUE
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
-- Could NOT find WrapOpenSSLHeaders (missing: OPENSSL_INCLUDE_DIR)
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/arthu/AppData/Local/Temp/.xmake/211110/_224DF2B365C648608976D180763FC7C0.dir
checking for cmake::QtCreator ... no
dump from <anonymous> @@programdir\plugins\lua\main.lua:125
nil

Related Environment

  • xmake version: xmake v2.5.9+HEAD.809ee9806
  • os: Windows 11
  • target platform: MSVC 2022 64Bits

Arthapz avatar Nov 10 '21 12:11 Arthapz

Why not use custom packages or source code integration cmake packages?

https://xmake.io/#/package/local_3rd_source_library

waruqi avatar Nov 10 '21 13:11 waruqi

I can't test it because I don't have enough disk space to install the qt environment.

You can upload all the vcxproj project files generated by find_package cmake::xxx as attachments to show me.

waruqi avatar Nov 10 '21 14:11 waruqi

Here is the .dir generated by XMake with vcproj and cmake files _32749551513C4F20840C0B9DCB566890.dir.zip

Arthapz avatar Nov 11 '21 20:11 Arthapz

I have improved it, you can try it again. xmake update master

waruqi avatar Nov 12 '21 04:11 waruqi

Basic detection seem's to work, but no include dir / libs

> $env:CMAKE_PREFIX_PATH="C:\Users\arthu\Developpment\qt-creator-plugindev-debug"; xmake l -vD find_package 

cmake::QtCreator
running builtin module find_package with args:
dump from _print_vlog @@programdir\plugins\lua\main.lua:55
"cmake::QtCreator"
finding QtCreator from cmake ..
cmake C:\Users\arthu\AppData\Local\Temp\.xmake\211112\_045B64059D0243708E3831240A8600E0.dir
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
-- The C compiler identification is MSVC 19.30.30705.0
-- The CXX compiler identification is MSVC 19.30.30705.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found Threads: TRUE
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
-- Could NOT find WrapOpenSSLHeaders (missing: OPENSSL_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/arthu/AppData/Local/Temp/.xmake/211112/_045B64059D0243708E3831240A8600E0.dir
checking for cmake::QtCreator ... QtCreator
dump from <anonymous> @@programdir\plugins\lua\main.lua:125
{
  concat = function @programdir\modules\lib\detect\find_package.lua:28,
  links = {
    "QtCreator"
  },
  linkdirs = {
    "C:/Users/arthu/AppData/Local/Temp/.xmake/211112/_045B64059D0243708E3831240A8600E0.dir/Debug",
    "C:/Users/arthu/AppData/Local/Temp/.xmake/211112/_045B64059D0243708E3831240A8600E0.dir/Release",
    "C:/Users/arthu/AppData/Local/Temp/.xmake/211112/_045B64059D0243708E3831240A8600E0.dir/MinSizeRel",
    "C:/Users/arthu/AppData/Local/Temp/.xmake/211112/_045B64059D0243708E3831240A8600E0.dir/RelWithDebInfo"
  }
}

and with my project XMake.lua

package("QtCreator")
    on_fetch(function (package, opt)
         opt.components = {}
         table.insert(opt.components, "Core")
         table.insert(opt.components, "ExtensionSystem")
         table.insert(opt.components, "Utils")
         return package:find_package("cmake::QtCreator", opt)
    end)
package_end()


add_requires("QtCreator")

target("xmakeprojectmanager")
    add_rules("qt.shared")
    add_rules("mode.debug", "mode.release")
    add_files("src/*.cpp")
    add_headerfiles("src/*.hpp")
    add_languages("cxx20")
    if "${os}" == "windows" then
        add_cxxflags("/Zc:__cplusplus")
    end
    add_frameworks("QtCore", "QtWidgets")
    add_packages("QtCreator")
> $env:CMAKE_PREFIX_PATH="C:\Users\arthu\Developpment\qt-creator-plugindev-debug"; xmake f -vD -m debug

checking for platform ... windows
checking for architecture ... x64
checking for cl.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2022
checkinfo: cannot runv(dmd.exe --version), No such file or directory
checking for dmd ... no
checkinfo: cannot runv(ldc2.exe --version), No such file or directory
checking for ldc2 ... no
checkinfo: cannot runv(gdc.exe --version), No such file or directory
checking for gdc ... no
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(unzip.exe -v), No such file or directory
checking for unzip ... no
checking for 7z ... C:\Users\arthu\xmake\winenv\bin\7z
checking for git ... ok
checkinfo: cannot runv(gzip.exe --version), No such file or directory
checking for gzip ... no
finding QtCreator from cmake ..
checking for cmake ... ok
cmake C:\Users\arthu\AppData\Local\Temp\.xmake\211112\_6840B0915D6D440085B886431948A250.dir
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
-- The C compiler identification is MSVC 19.30.30705.0
-- The CXX compiler identification is MSVC 19.30.30705.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found Threads: TRUE
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
-- Could NOT find WrapOpenSSLHeaders (missing: OPENSSL_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/arthu/AppData/Local/Temp/.xmake/211112/_6840B0915D6D440085B886431948A250.dir
checking for cmake::QtCreator ... QtCreator
checking for qmake ... C:\Users\arthu\Developpment\Qt\6.2.1\msvc2019_64\bin\qmake
checking for Qt SDK directory ... C:/Users/arthu/Developpment/Qt/6.2.1/msvc2019_64
checking for Qt SDK version ... 6.2.1
checking for link.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\link.exe
checking for the shared library linker (sh) ... link.exe
checking for link.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\link.exe
checking for the linker (ld) ... link.exe
configure
{
    mode = debug
    plat = windows
    vs = 2022
    proxy_pac = pac.lua
    host = windows
    arch = x64
    ccache = true
    theme = dark
    buildir = build
    qt_sdkver = 6.2.1
    qt = C:/Users/arthu/Developpment/Qt/6.2.1/msvc2019_64
    ndk_stdcxx = true
    kind = static
    network = public
}

here the twos .dir _6840B0915D6D440085B886431948A250.dir.zip (from my xmake.lua)

_045B64059D0243708E3831240A8600E0.dir.zip (from the single command)

Arthapz avatar Nov 12 '21 18:11 Arthapz

I did not find any includedirs information in QtCreator.vcxproj generated by cmake, only link and linkdirs information.

Therefore, I cannot continue to improve it unless we can make cmake generate vcxproj with includedirs. But this should depend on the CMakelists.txt of the QtCreator project

waruqi avatar Nov 13 '21 02:11 waruqi