我有一个使用CMake构建并运行良好的项目.我的项目设置如下:
??? CMakeLists.txt
|
??? include/
? ??? standalone/
? ??? x.hpp
|
??? src/
??? standalone/
??? main.cpp
Run Code Online (Sandbox Code Playgroud)
我的标题的内容是这样的:
// ------x.hpp--------
#pragma once
#include <iostream>
class X
{
public:
void hello()
{
std::cout << "Hello World!\n"; // needs <iostream>
}
};
// -------main.cpp-------
#include <standalone/x.hpp>
int main()
{
X x;
x.hello();
}
Run Code Online (Sandbox Code Playgroud)
我使用以下内容 CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(standalone)
###############################################################
# Compiler settings
###############################################################
# use C++11 features
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# set warning level
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -pedantic -pedantic-errors …Run Code Online (Sandbox Code Playgroud) c++ cmake header-files buildconfiguration build-dependencies
我和我的团队正在将VS2012用于许多项目,并且我们的QA和UAT小组开发了一个工作流程,涉及5个环境:本地,开发阶段,测试,预生产和生产.我们发现自己必须为每个项目和解决方案创建Local/Dev/Test/Preprod/Prod构建配置,并删除调试和发布配置.
有没有办法让VS在新项目上创建这些环境而不是调试/发布配置?
编辑:我无法找到任何全局选项,因为似乎构建配置都在单独的项目文件夹中.
我所做的是找到一些我最常见的项目,并因此修改项目模板:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Local|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<-- SNIP -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Prod|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>Run Code Online (Sandbox Code Playgroud)<Content Include="Web.config" />
<Content Include="Web.Local.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Dev.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Test.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Preprod.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Prod.config">
<DependentUpon>Web.config</DependentUpon>
</Content>Run Code Online (Sandbox Code Playgroud)<ProjectItem ReplaceParameters="true" TargetFileName="Web.config">WebApiWeb.config</ProjectItem> <ProjectItem ReplaceParameters="true" TargetFileName="Web.Local.config">Web.Local.config</ProjectItem> <ProjectItem ReplaceParameters="true" TargetFileName="Web.Dev.config">Web.Dev.config</ProjectItem> <ProjectItem ReplaceParameters="true" TargetFileName="Web.Test.config">Web.Test.config</ProjectItem> <ProjectItem ReplaceParameters="true" TargetFileName="Web.Preprod.config">Web.Preprod.config</ProjectItem> <ProjectItem ReplaceParameters="true" TargetFileName="Web.Prod.config">Web.Prod.config</ProjectItem>
当我创建新项目时,我所有想要的环境都在那里,调试就不见了!但是,Release仍然存在,包括我删除的web.Release.Config文件.知道这个无关的配置文件/构建配置可能来自何处?
我正在尝试在我的 Ubuntu 14.04 LTS 上构建fastjet-3.0.1。
在运行以下:
./configure --enable-allcxxplugins
Run Code Online (Sandbox Code Playgroud)
我收到以下消息:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive...
ATTENTION! pax archive volume change required.
Ready for archive volume: 1
Input archive name or "." to quit pax.
Archive name >
Run Code Online (Sandbox Code Playgroud)
我尝试查找 Pax 是什么以及如何处理此错误,但没有找到任何有用的信息。对此的任何帮助都会很棒!谢谢。
我使用 build.gradle(app) 来创建不同风格的 apk。但是安装不同风格的同一个 apk 会覆盖前一个。我想创建不同的 apk 以同时在同一设备上运行。我想使用不同的 appicon 创建不同的 apk,这些 appicon 可以安装在同一设备上并同时运行。任何链接或教程或直接帮助表示赞赏。
提前致谢。
在 Daniel Pfeiffer ( Effective CMake ) 和 Deniz Bahadir ( More Modern CMake ) 的演讲中,甚至在CMake 文档中,建议(至少).cmake生成文件以便在其他项目中使用 CMake 的存储库:foo-config.cmake和foo-config-version.cmake(对于包foo;另一种可能的命名方案是FooConfig.cmake和FooConfigVersion.cmake)。
这对我来说已经很奇怪了。为什么不应该foo-config.cmake有有关已安装版本的信息/命令?这两个独立文件的存在是否有某种客观原因,或者只是 CMake 设计的“失误”?
编辑:为了集中注意力,剪掉了这个问题的其余部分,因为我弄错了。
英特尔 C/C++ 有一堆自定义标志,其中一些混合了编译和链接(例如-qopenmp),而另一些只是特殊的替代形式(例如-ipp用于与英特尔的 ipp 库链接)。
我可以“手动”将此类标志添加到编译器标志中,并忽略它们可能具有链接含义的事实;或者将它们添加到编译和链接标志中。但这两种选择似乎都“不可行”。如何在 CMake 中正确使用各种 ICC 特定标志?
我已经在我的某个存储库中使用 CLion 一段时间了。突然(或者可能不是突然,但我无法找出原因),我在 CMake 控制台中收到此错误消息:
Cannot generate into /path/to/the/project/dir
It is already used for unknown project
Please either delete it manually or select another generation directory
Run Code Online (Sandbox Code Playgroud)
我尝试了几件事:
...但没有效果。但是,将存储库克隆到新文件夹中不会导致这种情况。
造成这个问题的原因可能是什么?
笔记:
我找不到解决方案来管理如何使用标准 MSVC 2019 编译器在 Windows 上的 CMake 项目中使用语言 CUDA。
\n我正在尝试配置和编译此hello-cmake-cuda存储库(也在本博客文章中进行了描述)。
CMakeLists.txt文件内容:
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)\nproject(hello LANGUAGES CXX CUDA)\nenable_language(CUDA)\nadd_executable(hello hello.cu)\nRun Code Online (Sandbox Code Playgroud)\ncmake ..以下是从构建目录中运行的命令的输出:
PS C:\\GitRepo\\cuda_hello\\build> cmake ..\n-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.22000.\nCMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeDetermineCUDACompiler.cmake:311 (message):\n CMAKE_CUDA_ARCHITECTURES must be valid if set.\nCall Stack (most recent call first):\n CMakeLists.txt:5 (project)\n\n\n-- Configuring incomplete, errors occurred!\nSee also "C:/GitRepo/cuda_hello/build/CMakeFiles/CMakeOutput.log".\nSee also "C:/GitRepo/cuda_hello/build/CMakeFiles/CMakeError.log".\nRun Code Online (Sandbox Code Playgroud)\n这意味着architectures_testedfromCMakeDetermineCUDACompiler.cmake:311为空...
如何让 …
我正在开发一个Mac应用程序,并准备将其提交给Mac AppStore.
我也想在同一时间将它分发到我的网站上.
由于我使用Sparkle框架来管理AppStore外部版本的更新,因此不能对应用程序进行沙盒处理.
我知道我可以使用多个构建目标完成此操作,但是同步的两个目标太重了,因为唯一不同的是沙箱.
所以我创建了一个构建配置,我的配置列表如下:
如何仅为MacAppStore配置启用Sandbox ?
我可以将构建配置从调试更改为发布(或我创建的其他调试配置),但是当我更改回调试时,Visual Studio会冻结.内存使用量不断攀升和攀升,直到Visual Studio在一小时左右后自动重启.
我相信我会在某个时候得到解决.作为临时解决方案,我希望通过更改.suo文件来更改启动时选择的配置.但是,这似乎是一个二进制文件,我认为没有简单的方法来编辑它.除了删除.suo文件之外,还有另一种方法可以选择在启动时选择哪个配置吗?还是建议避免挂?我尝试过轻量级解决方案加载,它没有任何区别.
我删除了.suo文件,并且正如预期的那样,重新创建了一个新文件.新的.suo是6kb大.旧的.suo文件大13MB.