Default c++ project which is setup using autoconf - autoconf

I know this is not a programming question so someone might close this but I am struggling hard in setting up a simple c++11 project using autoconf. I want a src and obj directory for source and object files. I also want a recursive directory structure. Went through many links but facing a hard time on this. What I wana achieve is have a Project directory then a src and obj directory in that Project directory which will have sub directories for each components. Just thought of asking if there exists some default project which I can download and then use it for my purpose. Thanks.

You can't do that with automake. It doesn't let you choose where the object files go.
Instead you can configure and build in a parallel tree. That is what many GNU developers do. This way the sources and objects are separated.

Related

How to skip certain files when running `cookiecutter --replay`?

If I make a change to my cookiecutter template I like to use cookiecutter --replay (or --replay-file) to update my existing projects with the new template changes. When doing this, how can I skip certain files?
For example one thing my template contains is a requirements/ directory containing Python requirements files:
requirements/
main.in
main.txt
tests.in
tests.txt
It's useful for the template to output a starter set of requirements files when generating a new project. But the project will almost certainly modify these files whenever it adds or upgrades requirements so when replaying the template I would not want to overwrite the requirements files with the original starter ones. That would just delete any dependencies that've been added to the project since its inception.
I'm aware of --skip-if-file-exists but I don't want to skip all existing files, only the ones in the requirements/ dir.
The only solution that comes to mind immediately is to omit the requirements dir from the project template and use a post-generate hook to write out the starter requirements files only if they don't already exist.
But I wonder if there's a way to get cookiecutter to do this for me, without having to write it in Python myself?
For example is there some way to give cookiecutter --replay a list of files and directories to skip if they already exist?

MonoDevelop: Any way to override resources / classes using projects?

Consider a solution has 2 projects: ProjectA and ProjectB (both are MonoTouch apps) and ProjectBase. ProjectBase contains the whole application, but Main.cs file (with the entry point) is located in ProjectA and ProjectB (which reference ProjectBase). This way, running any of A/B projects will boot up the application from ProjectBase.
Now, I want to override something for ProjectA only (it might be XIB file, image or a .NET class). Is there any way I can setup the solution so that the code and resources, produced by ProjectBase, are merged with the ones from ProjectA/ProjectB and the latter wins?
I found (probably a quirky and kinda-undefined-behavior-driven way) of overriding XIBs: I just put a XIB into ProjectA and ProjectB, name it the same as it was named in ProjectBase and them exclude it from ProjectBase. Although MonoDevelop compiles all items, it seems that the startup project's XIBs get priority, so that I see ProjectA-specific XIBs when I launch ProjectA and ProjectB-specific XIBs when I launch ProjectB. However, I am not sure it is the way it should behave, plus, from what I can see from build log, ALL projects get built yielding resources at the end.
P.S. I'm sorry if this has been asked previously, but I was not able to find the similar question on SO.
I was once trying to do this for a bunch of apps. I would have thought build order would be ProjectBase and then ProjectA, and the content copy system would be the same... Guess this means we are wrong.
You could do a few things.
A) Build your own program to copy resources which are marked for content. Would not be very hard, just need to read the .csproj files. XML parsing is easy enough in .NET. Run this program on post build. Would just have to be careful when doing builds such as to zip or to the device as I am not sure how it handles post-build events.
B) [This is what I did instead] If I expect to also make ProjectC, ProjectD ... ProjectN I instead made a program to generate my program... (Programception).
What it does, has ProjectBase, and ProjectTempalte. You enter your new project name into this program, say, "MyNewProject" and it will create the correct folder structure, write the correct csproj files, and update SLN file. ProjectTemplate has various placeholders in .csproj files like {PLACEHOLDER} which Programception would just go through and find/replace with my project name. Image files (and in your case XIB) are then only kept within ProjectA (B..C..N) unless I do not expect to try and override them in which case they would stay in ProjectBase. This is a lot easier with a XIBless application I would assume. I never use XIB's anyway.
Hope that helps!

Visual C++ link generated objs from referenced project

I have multiple native C++ projects, one of them is a dll project, and I want to test it.
The problem is that the generated .lib file only contains the definitions for the public interface of the dll, but I would like to test the projects internals.
Since referencing the project does not work (it only works for static libraries) is there a way to add the the generated objs directly in my testing project ?
Also I know that I could include all the source code files in the referenced project. But is there a way to do this considering that the referenced project might change. I would like a method that does not force me to mange each file manually.
I have done some research and I found some answers like in this question:
Reusing object files in Visual Studio 2005
but since I have many small classes exposing all the classes is a bit to tedious.
I found that I can set a Pre Link Event in the Build Event menu.
This allows me to use the following command:
lib -out:"../Debug/tempAllDllObjects.lib" "../MyDLLProject/Debug/*.obj"
now, even if my project is a DLL project I have an additional .lib file that contains all the objects in my project. All I have to do is reference the newly created lib file. This way I can link with all the objects in my DLL project even if they are not in the public interface.
As a note the command can also be set on the DLL project as a Postbuild Event this will increase the efficiency since now the lib file is only generated when changes occur.

Shared Object Files

I have two projects within one solution. Both projects contain some files that are the same. For instance, Project1 contains shared.cpp and so does Project2. However, when I edit shared.cpp and build both projects, is there any way I can make VC++ compile the source file once, then use the single object file in the linking of the two projects, rather than compiling it twice? The obvious purpose being to decrease build time.
Put shared.cpp in a separate project in the same solution and make it build as a library. Then add that project as a dependency to project1 and project2.

how to add directory to SupportFiles in InstallShield

Is there a possibility to add directory (with sub directories) to SupportFiles section in installshield. I have dynamically created content (list of files changes constantly) that I use to support my installation.
Is there any other method to add dynamically whole directory to installation package. I need files from this directory only during installation process. At the end of the installation I want IS to remove these files automatically ?
The ISSetupFile table ( which drives the Support Files pattern ) only supports extracting files to a single directory. There is no way in the UI to tell it to be dynamic although you could have a build automation step that reflects the contents of a directory and wires it up to the table using the automation interface. This still couldn't do sub directories though.
What you probably want to do is creating a self-extracting zip of the files you need as part of your build and add that EXE to Support Files. Then write custom actions that call the EXE to extract the payload to Support Files and another CA to clean it up. Look for the custom action ISSetupFilesExtract and ISSetupFilesCleanup to figure out the best way to do this.
Although I'm late to the party: #BuvinJ mentioned in a comment that you can add directories to "Advanced Files" under "Disk1." In this case, they do appear in the temporary directory (support directory), eg. SUPPORTDIR\Disk1
SUPPORTDIR is a temporary location where the installer dumps files, and cleans them up afterward. An example is C:\Users\<your user name>\AppData\Local\Temp\2\{F6B9B2D6-2A5A-4146-9297-E80A199CB0CB}.
This could be a quicker/cheaper/faster solution to writing custom actions and/or packaging up files by hand in, say, a self-extracting zip file.

Resources