小编Alg*_*rys的帖子

在CMake中设置中间文件(如.obj)的目录

我已经看到CMake把中间文件,比如.obj放在这样的目录中:

project.dir/sort/of/copy/of/source/directory
Run Code Online (Sandbox Code Playgroud)

有办法有这样的东西:

project.dir/Debug/ myfiles.obj    |--> for my debug
Run Code Online (Sandbox Code Playgroud)

project.dir/Release/ myfiles.obj    |--> for my release
Run Code Online (Sandbox Code Playgroud)

暂时,我使用2个单独的目录来生成每次我的库或可执行文件的Debug和release.在我有了平台之后......

是否有类似于CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE或CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ...

对于中间文件.obj?

我也尝试了/Fo但是当我使用这个FLAG时,Cmake覆盖了他的配置:

warning D9025 : overriding '/Fo;../x64/Debug/' with '/FoCMakeFiles\project.dir\src\project\main.cpp.obj'

请问有人有解决方案吗?

cmake

12
推荐指数
1
解决办法
4139
查看次数

在Inno Setup中使用Define和Constant

我对Inno Setup中的#define有疑问.如果我做了一些修改,我会设置一个运行良好的设置,我正在考虑app的未来.例如,如果我更改版本(Major,Minor,Build,Patch,...),我不想每次都更改所有行(如Registry).

所以我试着做出类似的东西:

#define MyAppMajor "5"
#define MyAppMinor "5"
#define MyAppBuild "1"
#define MyAppPatch "1"

...

[Files]    
Source: "D:\ProgramFiles\..."; DestDir: "{app}\Program\{MyAppMajor}.{MyAppMinor}\"; Flags: ignoreversion;

[Registry]
Root: "HKLM32"; Subkey: "Software\program\"; ... ; ValueData: "{MyAppMajor}.{MyAppMinor}.{MyAppBuild}.{MyAppPatch}";
Run Code Online (Sandbox Code Playgroud)

但这不编译,它说:

"Unknown constant"MyAppMajor".如果你试图嵌入单个"{"而不是常量,则使用两个连续的"{"字符.

有没有办法为版本化或其他常量做类似的事情?

inno-setup

6
推荐指数
1
解决办法
5659
查看次数

PyQt:带有 QRunnables 的 QThreadPool 需要时间退出

我有一个创建 QRunnables 并在 QThreadPool 实例中启动它们的类。

我的线程运行良好,但如果用户想退出应用程序,应用程序需要很长时间才能停止。当然是因为发起的请求需要时间。

这是我如何使用 QThreadPool、QRunnables 的片段代码:

import sys
from PyQt5.Qt import QThreadPool, QApplication, QWidget, QVBoxLayout
from PyQt5.Qt import QTimer, QObject, QPushButton, QLabel
from PyQt5.Qt import QRunnable


class BackendQRunnable(QRunnable):
    """
        Class who create a QThread to trigger requests
    """

    def __init__(self, task):
        super(BackendQRunnable, self).__init__()
        self.task = task

    def run(self):
        """
        Run the QRunnable. Trigger actions depending on the selected task

        """

        # Here I make long requests
        if 'user' in self.task:
            self.query_user_data()
        elif 'host' in self.task:
            self.query_hosts_data()
        elif …
Run Code Online (Sandbox Code Playgroud)

qt pyqt qthread pyqt5

6
推荐指数
1
解决办法
6245
查看次数

QT:.ui 文件中的标头

我想知道如何使<header>files.ui与cmake的定制部件作品。

我有这样的 CMakeLists :

cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)

project(qtelec C CXX)

set(CMAKE_PREFIX_PATH $ENV{HOME}/Qt5.6.0/5.6/gcc_64)
set(SRC_BASE_DIR "../../../qtelec")
set(COREALPI_BUILD_DIR "../../../../corealpi/build")

set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

find_package(Qt5Widgets REQUIRED)

file(GLOB_RECURSE SRC_FILES 
    ${SRC_BASE_DIR}/src/*.h 
    ${SRC_BASE_DIR}/src/*.cpp
)

link_directories(${COREALPI_BUILD_DIR}/elec)
link_directories(${COREALPI_BUILD_DIR}/elec/core)

add_library(qtelec SHARED
    ${SRC_FILES}
)

add_subdirectory(${SRC_BASE_DIR}/../platform/cmake/qtutils ${CMAKE_BINARY_DIR}/qtutils)  
include_directories(${SRC_BASE_DIR}/../external/qtpropertybrowser/latest/src)
include_directories(${SRC_BASE_DIR}/../qtutils/src)
#include_directories(${SRC_BASE_DIR}/src/widgets)
include_directories(${COREALPI_BUILD_DIR}/../include/ca)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

target_link_libraries(qtelec qtpropertybrowser elec core qtutils Qt5::Widgets)
Run Code Online (Sandbox Code Playgroud)

cmake ..有效,但cmake --build .给我以下错误:

[ 65%] Building CXX object CMakeFiles/qtelec.dir/home/mea/workspace/repos/qtelec/qtelec/src/forms/conversionform.cpp.o
In file included from /home/mea/workspace/repos/qtelec/qtelec/src/forms/conversionform.cpp:2:0:
/home/mea/workspace/repos/qtelec/build/ui_conversionform.h:18:40: fatal error: ../widgets/canecoboxwidget.h: Aucun fichier …
Run Code Online (Sandbox Code Playgroud)

qt cmake

5
推荐指数
1
解决办法
1944
查看次数

如何在 GitPython 中使用 git blame ?

我正在尝试在我的脚本中使用 GitPython 模块......但我不能。这不是很有记录:GitPython Blame

我想我还没有那么远,因为我想要重现的通常 git 责备如下: git blame -L127,+1 ../../core/src/filepath.cpp -e

这是我的脚本:

from git import *
    repo = Repo("C:\\Path\\to\\my\\repos\\")
    assert not repo.bare
    # log_line = open("lineDeb.txt")
    # for line in log_line:
    repo.git.blame(L='127,+1' '../../core/src/filepath.cpp', e=True)
Run Code Online (Sandbox Code Playgroud)

注释的两行是为了在我的“lineDeb.txt”文件中的每个数字行上进行 git blame 的最终目标。

我有以下输出:

...
git.exc.GitCommandError: 'git blame -L127,+1../../core/src/filepath.cpp -e' returned with exit code 129
stderr: 'usage: git blame [options] [rev-opts] [rev] [--] file
...
Run Code Online (Sandbox Code Playgroud)

我知道我可以用 os 模块制作它,但我想保留在 python 中。

如果这个模块或 python 的专家可以帮助我?

也许我没有正确使用 GitPython?

目标是获取行提交者的电子邮件......

提前致谢。

python gitpython

4
推荐指数
1
解决办法
3708
查看次数

用于在安装结束时复制文件的脚本:Inno Setup

我解释了我的项目:我的设置将附带2个许可证文件,他们不得包含在相关设置中.像这样 :

Folder/
---- Setup.exe
---- CanBTL.dat
---- CanBTP.dat

我希望,如果确定他们在这里,将这些文件复制到将使用Setup.exe构建的文件夹中.所以我正在尝试制作这段代码:

我编辑我的脚本:编辑:

[Code]
function CheckForFile(CurPageID: Integer): Boolean;
begin
if (CurPageID = wpFinished) and (FileExists('CanBTL.dat' + 'CanBTP.dat')) then 
  begin
     FileCopy(ExpandConstant('CanBTL.dat' + 'CanBTP.dat'), ExpandConstant('{cf}\Folder\'), false); 
  end;
end;
Run Code Online (Sandbox Code Playgroud)

目标是将setup.exe旁边的两个.dat文件复制到setup.exe创建的文件夹中

它编译,但似乎什么也没做.我的文件没有被复制.

我仍然是Inno Setup中的部分代码的初学者,所以如果有人可以帮助我吗?

谢谢

inno-setup

3
推荐指数
1
解决办法
6597
查看次数

使用 python 和 lxml 解析 vcxproj

我正在尝试使用 Python 和 lxml 解析 vcxproj。当我尝试这样做时,除非我删除<Project >.

这是我的 .vcxproj(我将其缩减为测试):

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseDebug|Win32">
      <Configuration>ReleaseDebug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseDebug|x64">
      <Configuration>ReleaseDebug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)

我的python代码:

#!/usr/bin/python3
# -*- coding: utf-8 -*-

from lxml import etree

tree = etree.parse("core.xml")

for conf in tree.xpath("/Project/ItemGroup/ProjectConfiguration/Configuration"):
    print(conf.text)
Run Code Online (Sandbox Code Playgroud)

如果我这样运行,脚本可以工作但什么也不显示。如果我DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"在节点项目脚本中删除工作...

我是 xml …

python xml vcxproj

1
推荐指数
1
解决办法
1291
查看次数

标签 统计

cmake ×2

inno-setup ×2

python ×2

qt ×2

gitpython ×1

pyqt ×1

pyqt5 ×1

qthread ×1

vcxproj ×1

xml ×1