I am developing CMake scripts to generate XCode in Xcode 11. However, there is no syntax highlighting for CMakeLists.txt or .cmake files. Is it possible to enable it?
Editor -> Syntax coloring -> c++
Related
I installed OpenCV 4.5.2 using the Windows installer and when I looked in the apps folder, I couldn't find some apps (create_samples, train_cascade). So, I downloaded the code and I generated visual studio projects using CMake. After I built all those project, again, in the app folder there were no project files to build those apps.
I also run cmake . in an app directory, but this error came out:
CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as
project(ProjectName)
near the top of the file, but after cmake_minimum_required().
CMake is pretending there is a "project(Project)" command on the first
line.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at CMakeLists.txt:4 (ocv_add_application):
Unknown CMake command "ocv_add_application".
-- Configuring incomplete, errors occurred!
See also "C:/opencv/opencv-master/apps/createsamples/CMakeFiles/CMakeOutput.log".
this is the CMakeLists.txt file that I run:
file(GLOB SRCS *.cpp)
ocv_add_application(opencv_createsamples
MODULES opencv_core opencv_imgproc opencv_objdetect opencv_imgcodecs opencv_highgui opencv_calib3d opencv_features2d opencv_videoio
SRCS ${SRCS})
In all honesty, last time that I used CMake was 10 years ago and I really would like an hand to figure this out.
Thanks
STACK:
CMake 3.20.3
OpenCV 4.5.2
Python 3.9.5
Visual Studio 16.10.0
Wndows 10
I found out why this is happening. In opencv 4.5 (I didn't check other versions), the line in the cmake file that generate the solution for traincascade and createsamples, are explicitly commented out. This because building those apps will generate more than 600 errors! Let's hope this problem will be fixed soon.
from https://github.com/opencv/opencv/issues/13231
These apps has been disabled during legacy C API removal. Rewriting them
with C++ API was not an option because it is too easy to break them
and hard to test.
Also modern approaches via DNN provides much better results - just
compare OpenCV face detector with CascadeClassifier and DNN.
I am using Qt version 5.5.1 (but with the 5.6.1 GUI), I am compiling with MSVC++ Compiler 10.0, and I have checked the "Use jom instead of nmake" option in the Options -> Build & Run -> General menu. I am using the latest version of cmake, and the Options -> Build & Run - > Kits -> CMake generator is set to "CodeBlocks - NMake Makefiles". To be honest, I do not know what that last option does, it is just the default.
I am building and running through the QT creator IDE.
If I add -j to the "tool arguments" in Projects -> Build&Run -> Build Steps, then when I try to compile I get the error:
NMAKE:-1: error: U1065: invalid option 'j'
However, I have "Use jom instead of nmake" selected so it should use jom and accept this argument, shouldn't it?
Have I missed out a step?
I cannot find any instructions on how to do this, and the only tutorials I can find to compile using jom are compiling through the command line, which I do not want to do.
edit: This is a different question from How do I utilise all the cores for nmake? as this question is specifically asking why the Jom solution (suggested as an answer in that question) is not working with my set up.
edit 2: I think I may have found out why. This bug report suggests that you need to use the "CodeBlocks - NMake Makefiles JOM" option in the kits -> cmake generator options.This is only supported with QtCreator 4.2.1 and above. However, I have this and it still does not work. I now get the error:
C:\Program Files\CMake\share\cmake-3.8\Modules\CMakeTestCCompiler.cmake:51: error: The C compiler "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/GIT/CorteX/build/Debug/CMakeFiles/CMakeTmp
Nmake file can be natively used by Jom, thus the cmake generator doesn't not need to be changed from the default nmake generator in the build configuration. The cmake generator is what converts your cmake to your native build system format (e.g. make, or nmake).
(i.e. Projects > Manage Kits ... > Build & Runs > Kits. choose your kit. I have my Cmake generator: set to "CodeBlocks - Nmake Makefiles, Platform: , Toolset: " ).
The only change you then need is to add a custom build step to run jom.exe and disable the default build step, as in Qtcreator JOM setup.
N.b. jom.exe must be in your PATH variable for QtCreator to find it.
jom requires that -j , where you set the number of processes, e.g. jom -j4. You can't use just -j without a count.
i have checked out llvm/clang/compiler-rt sources from official git repositories, but i'm having:
MBA-Anton:llvm_34_xcode_build asmirnov$ cmake -G XCode ../llvm_34
CMake Error: Could not create named generator XCode
LLVM sources:
MBA-Anton:llvm_34_xcode_build asmirnov$ ls ../llvm_34
CMakeLists.txt Makefile.common cmake llvm.spec.in
CODE_OWNERS.TXT Makefile.config.in configure projects
CREDITS.TXT Makefile.rules docs test
LICENSE.TXT README.txt examples tools
LLVMBuild.txt autoconf include unittests
Makefile bindings lib utils
Cmake version:
MBA-Anton:llvm_34_xcode_build asmirnov$ cmake -version
cmake version 2.8.11.1
Xcode generator should be supported for this cmake version according to doc and output:
MBA-Anton:llvm_34_xcode_build asmirnov$ cmake --help
...
Generators
The following generators are available on this platform:
Unix Makefiles = Generates standard UNIX makefiles.
Ninja = Generates build.ninja files (experimental).
Xcode = Generate Xcode project files.
CodeBlocks - Ninja = Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles
= Generates Eclipse CDT 4.0 project files.
KDevelop3 = Generates KDevelop 3 project files.
KDevelop3 - Unix Makefiles = Generates KDevelop 3 project files.
Sublime Text 2 - Ninja = Generates Sublime Text 2 project files.
Sublime Text 2 - Unix Makefiles
= Generates Sublime Text 2 project files.
I've never used CMake, but from what I've seen from your question it's just a question of case-sensitivity.
The generator is called Xcode and not XCode.
I also met this problem, it was resolved after I renamed Xcode-beta to Xcode
I'm building a C++ project, how do I add a custom compiler argument that Xcode doesn't have? Like -fwide-exec-charset=UCS-2LE. I searched on the internet but only found the solution to xcode 3.x. I'm using Xcode 4.5.2 and the UI is too different.
PS. It's NOT the commandline argument which used when debugging program, it's the g++ compiler argument which used when compiling the source codes.
I want to write GTK+ programs in Netbeans(version 6.9) in Ubuntu. Now I can compile GTK+ program via gcc compiler. But when write programs in Netbeans IDE, I can't build programs. The compiler sends me this error:
main.cpp:9:17: fatal error: gtk/gtk.h: No such file or directory'
I searched this error in google and pass steps in this site, but still it dose not work. I also pass following steps for solving my problem:
Set ProjectProperties/Build/C(C++) Compiler/additional Options to pkg-config --cflags gtk+-2.0
Set ProjectProperties/Build/Linker/Additional Options to pkg-config gtk+-2.0 --libs
Add ProjectProperties/Build/C(C++) Compiler/Include Directories and Tools/Options/cc++ /Code assistance to following headers:
/usr/include/atk-1.0
/usr/include/pango-1.0
/usr/include/gio-unix-2.0/
/usr/include/glib-2.0
/usr/lib/x86_64-linux-gnu/glib-2.0/include
/usr/include/freetype2
/usr/include/libpng12
/usr/include/gtk-2.0
/usr/lib/gtk-2.0/include
/usr/include/cairo
/usr/include/gdk-pixbuf-2.0
/usr/include/pixman-1
These steps don't solve my problem. IDE also draws a yellow line in the #include <gtk/gtk.h> line of code. How can I solve my problem?
Setup a C GTK+ Project in Netbeans
Create a C Project (not a C++).
Open the Project Properties window.
Go to "Build -> C Compiler".
In "Include Directories", add ALL the paths for GTK+ include requirements:
(assuming The root is in "C:/libs/c++/gtk"):
C:/libs/c++/gtk/include;C:/libs/c++/gtk/include/atk-1.0;C:/libs/c++/gtk/include/cairo;C:/libs/c++/gtk/include/fontconfig;C:/libs/c++/gtk/include/freetype2;C:/libs/c++/gtk/include/gail-1.0;C:/libs/c++/gtk/include/gdk-pixbuf-2.0;C:/libs/c++/gtk/include/gio-win32-2.0;C:/libs/c++/gtk/include/glib-2.0;C:/libs/c++/gtk/include/gtk-2.0;C:/libs/c++/gtk/include/libpng14;C:/libs/c++/gtk/include/pango-1.0;C:/libs/c++/gtk/include/pixman-1;C:/libs/c++/gtk/lib;C:/libs/c++/gtk/lib/glib-2.0/include;C:/libs/c++/gtk/lib/gtk-2.0/include
In "Additional Options", set:
$$(pkg-config --cflags --libs gtk+-2.0)
Go to "Build -> Linker".
In "Additional Library Directories", set the same values as in Point 4 (the "Include Directories" content).
In "Additional Options", set the same as in Point 5 (the "Build -> C Compiler -> Additional Options" content).
After this, your GTK+ project in Netbeans should be Compilable/Runnable. Working in Windows 7, Netbeans 7.3.