writing c++ installer files - linux

My have written a function definition in c++ which I want to use in other c++ projects. In a typical way we include .hpp files in the header
#include "my_fun.hpp"
I don't want to copy each time this file to the right location. What I want is to install this .hpp on my linux machine so that I can type
#include <my_fun>
How to write installer files on linux for c++ project? You know, not just on my machine, but any other person equipped with those files can install and use my function (like a library).

Just copy your header to /usr/local/include. That way it will be included by default, and it will not get mixed in with the headers installe by your package manager to /usr/include.

Related

How to import DLL libraries in Visual Studio 2012?

I would like to use an external precompiled library for Fast Fourier Transform.
The files provided are all .dll files with corresponding .def files. In the instructions, it writes that I should create a .lib import library file with lines like:
lib /def:libfftw3f-3.def
Should I just copy the statements in a txt file and rename it to lib? And where I should put this .lib file? And how do I include in my project? Would I still need to state "#include <XXX.dll>" or would the lib file do?
Also, the dll seems to be in C language, would I be able to call its functions in C++?
Thank you very much!
Command prompt: FAQ is a good place to start. You need a .h header file as well as the resulting link .lib, or you can use the .h header file and then use LoadLibrary/GetProcessAddress. See MSDN

Is it possible to define a macro for major minor build revision?

I am building a C++ DLL in Visual C++ and would like to append the file version number from the resource file to the resulting DLL name to allow multiple DLL versions to exist in a single folder. i.e.:
MyDLL.1.0.3.44.dll
MyDLL.1.0.3.45.dll
I can't seem to find a macro for the version and therefore cannot programmatically set the output file name.
Is this possible and if so, how?

(How) does a cmake configuration differ conceptually from a Visual-C++ project file?

To get from C++ sourcecode to a binary module, the process is roughly as follows:
set_of_source_files[a.cpp, b.cpp, ...] // conceptually, it doesn't matter where these are
||
|| Compiler <- [compiler_settings]
\/
set_of_object_files
||
|| Linker <- [linker_settings]
\/
binary module (dynamic library or executable)
Now, I know Visual Studio projects, they
Define a set of source files (directory structure and layout basically doesn't matter / is defined inside the project file)
Define the compiler settings for all (optionally each) of the source files
Define the linker settings
Define where to put generated output files
I don't know cmake, but apparently(?), the info one configures with cmake differs slightly from the info one puts into vc[x]proj files.
Is a "cmake configuration" just a differently formatted "vcproj file" or is there a conceptual difference? (Except for the obvious one (I assume) that the info I put into a cmake configuration is platform independent.)
An alternative twist to this question would be to answer -- in the context of above -- why/if(?) one would switch to cmake when only compiling for Windows with Visual-C++.
Cmake is a cross-platform make -- it starts from a set of source files and a relatively abstract set of directions about what to do with them. Based on those, it generates a set of platform-specific files. If you specify Windows/Visual Studio as the target, it can/will generate a vx[x]proj file for you to use.
Even if you're only using Visual C++ on Windows, it's possible you could benefit from cmake. The obvious possibility would be if you want to target a number of different versions of Visual Studio, and be able to directly generate the correct files for each, instead of generating files for the oldest version you want to support, and then depend on Visual Studio's upgrade feature to convert those to the target version.
Based on my experience with VS's upgrade capability (not particularly great), I'd say that could/would be a reasonable and valid use.

Getting a List of #define Symbols in VC++

Is it possible to obtain a list of preprocessor #define'd symbols in VC++? I know GCC has similar options to dump all effective #define symbols for the supplied .cpp/.h source files, but I am not sure if VC++ support this?
I am using a Mozilla open source project in Windows. There are a lots of irrelevant #define for the UNIX build env causing the source code very unreadable. I want to eliminate the irrelevant #define from the source code. The project uses Mozilla specific build scripts (automake, configure, Makefile, python scripts, and etc) to supply the symbol definitions to the compiler dynamically. Also each source file add its own #define at different #ifdef branches making manually pre-determining the complete list of symbols for a specific build impractical.
Check out Macros and Constants list in the View => Class View menu.

How do I build two different installers from the same script in Inno Setup?

I want to make a "standard" install for external use, but I also want to use the same script and tell it (with a command line param perhaps?) to include another set of files (PDB files for debugging) for our lab installations. (And make a totally different install exe)
How can I do this? Is it possible?
I don't see how to set this in the [Files] section (conditionally add files based on some value/param)
Note – this is not for allowing the user an option DURING the install. I want a build-time option to set in my hudson build or batch file.
I suppose I can just create a separate installer for the pdbs, but I'd rather just have one file to do everything.
You can simply use
#ifdef DebugVersion
File: *.pdb ...
#endif
and then call the Inno compiler like this:
iscc.exe -DDebugVersion ...
I'd also add something like this so you get different output file names:
#ifdef DebugVersion
OutputBaseFileName=mysetup-dbg
#else
OutputBaseFileName=mysetup
#endif
Note that you'll probably need the InnoSetup precompiler for this, which, for some inexplicable reason, is not part of the default InnoSetup package. The easiest way to get it is to get the "Quick Start Pack" from the InnoSetup download page.
The answer is simple: create two files for each release, but put the common stuff in a third file and #include it in the other two.
http://rickborup.blogspot.com/2006/09/inno-setup-include-directive.html

Resources