cmake find_path/find_library failed check - find

I'm using CMake 2.8.2 version. The project is using lots of external files and custom libraries (unavailable through find_package) and there is a long cascade of elements like the one below:
find_path(XXX_INCLUDE_DIR XXX.h /XXX/include)
if (XXX_INCLUDE_DIR)
message(STATUS "Includes (XXX) found in ${XXX_INCLUDE_DIR}")
else()
message(FATAL_ERROR "Includes (XXX) not found")
endif()
There is over 20 things like this in the script - it doesn't look good. According to the documentation, unfortunately, neither find_path nor find_library have a REQUIRED option which would do the job here (just like it does with find_package - if not found, the script stops). Do you have an idea how can I shorten the CMake script code? Something like
find_path(XXX_INCLUDE_DIR XXX.h /XXX/include REQUIED)
or something similar would be great.

Put them in your custom FindXXX.cmake modules. Read the docs and look at FindPNG.cmake for an example. Put them into <project>/cmake/FindXXX.cmake (or similar), and then add the directory containing these files to the CMAKE_MODULE_PATH and use find_package(), e.g.
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
find_package(XXX REQUIRED)

You probably want to use either a macro or a function.

Related

How to generate the plugin of "Li2018" in Halide on windows and exploit "load_plugin" in other project?

reccently, I want to test how does the autoscheduler "Li2018" work on GPU. Firstly, I need to load the plugin of this autoscheduler into my project with function "load_plugin("gradient_autoscheduler")" like the example: https://github.com/halide/Halide/blob/master/apps/gradient_autoscheduler/test.cpp but the biggest problem is, that I cannot generate the plugin on Windows. I have tried to add the "generate_autoscheduler" into the CMakeList.txt in the /apps folder, but it can not work. To compare with autoscheduler "Admas2019" which in the folder /apps/autoscheduler, "Li2018" need a CMakeList.txt to generate the dll plugin, Does some one know how to generate the plugin of "Li2018" on windows? Thanks in advance!
As you have noticed, we don't have a CMake configuration for Li's autoscheduler, so Windows is not supported yet. I'll put this in my TODO list, but contributions are always welcome. It shouldn't be hard to come up with a CMakeLists.txt based on the Makefile content.

Visual Studio Code includePath subdirectories

I'm struggling with the includePath setting on a bigger project source.
Let's say I have a folder structure like:
/BaseComponent/public
/BaseComponent/include
/BaseComponent/source
/SubComponent1/public
/SubComponent1/include
/SubComponent1/source
/SubComponent1/SubSubComponent/public
/SubComponent1/SubSubComponent/include
/SubComponent1/SubSubComponent/source
/SubComponent2/public
/SubComponent2/include
/SubComponent2/source
I tried to do a configuration like this:
"includePath": [
...
"${workspaceRoot}",
"${workspaceRoot}/*/include",
"${workspaceRoot}/*/public"
],
But this didn't appear to work out. Is there a way to have just all header inside the workspaceRoot used? Something like "include all subfolder"?
OR another way to define a path which is project in dependend?
I believe this is what you are looking for:
"${workspaceFolder}/**"
Assuming all the dirs are inside your working space folder.
That is not yet possible/supported, as mentioned in Microsoft/vscode-cpptools issue 849.
Example of a context illustrating that issue:
The includePath doesn't seem to work with NuGet packages since the directory name includes the version.
For example, if we use package rapidjson 1.0.2 and later upgrade, we'd have to update references to "packages/rapidjson.1.0.2/build/native/include" in this file - in additional to any packages.config files.
It would be nice if we could use wildcards in directory specifiers or some other means of not having to maintain the same information in two different places.
So the alternative is to version a script able to generate the configuration file by updating the IncludePath section with all include folders found.
Note: issue 849 is actually a duplicate of issue 723, which states (Bob Brown, from Microsoft):
A middle wildcard is not currently supported.
I started a branch that would support this a while ago, but I forget what state it was in and now the branch is out of date.
If anyone wants to get it back in sync with master and finish it, we can consider taking it.
I'll reopen this issue since the original request was not actually addressed.

is there a coffeescript auto compile / file watcher for windows?

I'd like to play around with integrating coffeescript into my dev process. But as I see it, I'll have to make a bat file that iterates a set of coffee files and spits out js files. Every time I write a bat file, useful as they may be, I ask myself: is there a better way?
Which makes me wonder: is there an app of some sort for Windows that will watch a directory or a file and spit out one/many js files when a coffee file is saved? I'm thinking of building one but don't want to reinvent the wheel. I looked around and found things that were similar but nothing that elevated it beyond "run this command line" on Windows.
Edit: already marked an answer, but looking at this 10 months later the answer is: grunt. Because it'll do a lot more than just auto-compile your coffeescript and you'll probably need to do more than just that to get your app going.
coffee --watch -o lib -c src
where src is a directory containing your coffee files, and lib is your JavaScript output directory.
See update at bottom of post.
I was hunting for the same thing the other day and came across this: https://github.com/danenania/CoffeePy
It's a simple python script that uses PyV8 to run coffee-script.js.
It doesn't do anything fancy, just watches a folder recursively, and compiles any .coffee files whenever they're changed. It doesn't even have a bare option. These things could be very easily added though!
Edit:
I forked the script and added --bare and --output options.
You can get it here: https://github.com/johtso/CoffeePy
Personally, I prefer using build tools like grunt.js / yeoman or brunch for that purpose.
grunt.js
&
grunt coffee
Mindscape Workbench has a built in compiler/editor for VS 2010. Haven't tried it yet, but it looks like it'd be even better than a watcher/compiler. Scott Hanselman has a post about it here:
http://www.hanselman.com/blog/CoffeeScriptSassAndLESSSupportForVisualStudioAndASPNETWithTheMindscapeWebWorkbench.aspx
I think there is a simplier way just using -w option of coffeescript compiler
coffee -c -w *.coffee
This will compile all coffee files under the folder you are (put more file pathes if needed) each time you change one.
Another possibility: WebStorm 6. They've added a built in file-watcher for a variety of next-gen languages like SASS and Coffescript.
If you want a different way of doing it, this might help:
http://jashkenas.github.com/coffee-script/#scripts
If you include the coffeescript compiler on your page, you can include files with a "text/coffeescript" type and they will get compiled client-side.
Word of warning: Obviously, client-side compilation is not for something serious, but its completely fine for a small project/quick development. It would then be trivial to compile them on the server and change the MIME-type and filename when something a bit quicker is necessary.
CoffeeScript-dotnet does what you want, but it is a command line tool.
Command line tool for compiling CoffeeScript. Includes a file system watcher to automatically recompile CoffeeScripts when they change. Roughly equivalent to the coffee-script node package for linux / mac.
Here is the best way to do it:
Say your work is in "my-project-path" folder.
Go to the parent folder of "my-project-path"
Start a terminal and type coffee -o my-project-path -cw my-project-path
This line will watch and compile anything name as "*.coffee" in "my-project-path" folder, even if it is in "my-project-path/scripts/core" or "my-project-path/test/core".The js file will locate in the save folder as the .coffee file.

How to generate phpDoc documentation for a specific folder in Netbeans IDE?

Due to the fact that we need to integrate the Zend Framework on our project root, and that generating that documentation will be useless and take long time, I would like to generate documentation for all files inside application folder only.
Does anyone know how I can generate documentation for a specific project folder, trough Netbeans 7.0 interface?
Update:
The best I've found so far was to:
Open the terminal window from netbeans, and type:
sudo phpdoc -d public_html/yoursite.dev/application/ -t public_html/yoursite.dev/docs/
Update 2
Let's suppose our Zend library is inside projectrootname/library/Zend we also can try, by going to: Tools > Options > Php > PhpDoc and place the following:
/usr/bin/phpdoc -i library/Zend/ -o HTML:frames:earthli
At least for me, that doesn't seem to work, because, when I try to generate the documentation, I get permission error issues displayed on the output window.
Thanks
The -d/--directory option [1] should be used to highlight the most high-level code directory that you want phpDocumentor to start reading from. If your Zend folder is at or above the level of your application directory, then just using --directory /path/to/application should help you document only your application code.
If your Zend folder is somewhere inside your application (e.g. in your app's ./lib folder), then you can use the -i/--ignore option [2] to tell phpDocumentor about any directories that it will see but should ignore, --ignore *zend*. Just be aware that formatting your ignore value can be tricky, so see the examples in the manual. Also, be aware that as phpDocumentor runs, you will see these ignored folders and files being listed in the output... phpDocumentor "ignores" them by not generating docs for those files. It does, however, still need to parse them, in case those objects are referenced in files that do get documented.
[1] -- http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#using.command-line.directory
[2] -- http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#using.command-line.ignore

Best practices for using Hg with Grails?

What should I check in/not check in? Since many of the files are sometimes auto-generated I'm not entirely sure how to handle this using version control...does it have something to do with tags?
For instance in ANT, I know not to check-in my target/bin directories...but Grails adds another level of confusion to this...since some of code is generated and some of it is not.
(It may become clearer as I go...but it seems to be that there needs to be some way of being able to tell what was just generated and what was modified by a developer so that it needs to be placed in version control)
Here's the .hgignore directory I've got on my most recent grails project (with a couple of project specific things taken out):
syntax: glob
out
target
logs
*.iml
.idea
*.iws
*.war
workspace.xml
lib/build
lib/compile
lib/runtime
lib/test
~$*
stacktrace.log
*.tmproj
*.launch
reports/
*.orig
*.zip
.DS_Store
*/.DS_Store
web-app/WEB-INF/classes
cobertura.ser
The generated code in Grails should be placed under version control. It's not secondary executable code that is generated by the build process like class files, but instead is code that is part of your source. The generated code is intended to be just a starting point for your application and will most likely be modified at some point anyway.
Also check this:
http://www.grails.org/Checking+Projects+into+SVN
and this:
https://stackoverflow.com/questions/4201578