How to set option for compiler in premake4? - premake

How can I set option that is available for particular compiler in premake4?
For instance only in Visual Studio set "Whole Program Optimization"?
This option is not available in GCC...

If you are using the development version of Premake, you can set the link-time optimization flag:
flags { "LinkTimeOptimization" }
If you are using the stable version, you can get the same effect by setting the command line flag explicitly for Visual Studio:
configuration "vs*"
buildoptions { "/GL" }

Related

Uninstall flow or callback in Qt Installer Framework 3.0.2

Is there any way to call a windows cmd command at uninstall process (maintainancetool.exe) of Qt installer framework? I tried to connect the
installer.uninstallationFinished signal but no results.
+1 Bancha's answer. Also if you are executing the windows command as part of uninstalling a component, it might be better to use the UNDOEXECUTE component of the Execute operation since it will execute along with the other uninstall operations for the component.
example:
component.addOperation("Execute", "touch", "test.txt", "UNDOEXECUTE", "rm", "test.txt")
You can check whether you are in the uninstall mode by installer.isUninstaller()
Below code snippet, may give you a clue.
function Controller() {
if(installer.isUninstaller()) {
installer.uninstallationFinished.connect(this, this.uninstallationFinished);
}
}
Controller.prototype.uninstallationFinished = function() {
//Put you cmd that need to execute after uninstalling finish here
}
installer QML Type
Controller Script

How to create an environment variable in Qt Installer framework regardless of OS

How can I add a new Environment Variable to the Qt installer. I know that it should go in the .qs script something like the following:
var path = installer.environmentVariable("PATH") + ";" + installer.value("TargetDir");
component.addElevatedOperation("EnvironmentVariable","PATH",path,true);
I'm trying the above on Linux, but it's complaining about EnvironmentVariable not existing when I install my program.
Well this operation is only supported on windows, but you can try do this:
component.addElevatedOperation("AppendFile", "/etc/environment", "export PATH=\"$PATH;#TargetDir#\"\n");
Warning: do this only on installation process
if (installer.isInstaller()) {
[...]
}
If this runs on unistallation, maybe can delete other things of /etc/environment

Installing terminator on cygwin

After going through a lot of sites about best terminal for system admins I was trying to install on Cygwin. Unfortunately, I did not find any good site with instruction about how to do it.
Is anyone done this before? Please help me with steps and packages that I need to install.
Also is there any terminals I can try (like Cygwin)?
I don't know since what version, but now you can install terminator just from the Cygwin installer. And runs great
Regards
If you don't want to use cygwinports, you can actually install all of terminator's dependencies from the cygwin installer, except for terminator itself.
In the cygwin installer select and install:
python-dbus
python-gobject
python-gtk2.0
python-vte (under GNOME tab for some reason)
GConf2
Then, pull down the latest terminator tarball from https://launchpad.net/terminator/+download and extract it somewhere. In a administrator terminal just run python setup.py install and as long as you have a running X server just running terminator will work perfectly.
The sources about how to install terminator are a bit obscures. What I did, and may help you, was this: (although I'm still having segmentation faults errors)
Update your Cygwin to the latest
Open a Cygwin terminal and run: (if you have the x86 version use that. The idea of this step is to use Cygwin Ports)
cygstart -- /your/cygwin/path/setup-x86_64.exe -K http://cygwinports.org/ports.gpg
In the section Choose A Download Site:
Add "http://downloads.sourceforge.net/cygwin-ports"
Add " ftp://ftp.cygwinports.org/pub/cygwinports"
Select another mirror close to you
Check that you have a total of three URLs selected
It may show you warning about not loading the .ini configuration but ignore them (Note: I looked for different port URLs but the official ones threw me errors and I could not pass this step, that's why I used alternatives URLs)
First, you need to install the packages for the X Window:
http://x.cygwin.com/docs/ug/setup.html
Basically they are:
xorg-server (required, the Cygwin/X X Server)
xinit (required, scripts for starting the X server: xinit, startx, startwin (and a shortcut on the Start Menu to run it), startxdmcp.bat )
xorg-docs (optional, man pages)
Also search and select the terminator package
It takes quite a while before it finishes.
Go to Start->All Programs->Cygwin-X->X Win Server (windows tool bar)
A xterm window should open. Type:
terminator
You should know have terminator with Cygwin.
Note: After I run terminator I get this error:
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::sm-connect after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::show-crash-dialog after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::display after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::default-icon after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
Warning: python-keybinder is not installed. This means the hide_window shortcut will be unavailable
Unable to bind hide_window key, another instance/window has it.
Segmentation fault (core dumped)
I've looking to fix this issue but sadly I couldn't find anything. If you use Cygwin x86 your outcome can be different.
Hope this can help you.

Which Xcode macros can be used to check the OS version of the compiling computer?

Building an iOS application using Xcode 4: 2 developers, one with 10.6.8 and one with 10.7. In 10.7 the NSURLConnectionDelegate interface is explicit: it is defined and can be added to the interface declaration. In 10.6.8 however, it isn't defined and a compile error is generated (NSURLConnectionDelegate: cannot find protocol declaration). This error can be fixed by simply removing the declaration. I'm looking for a compiler macro that identifies which OS version the code is being built on so I can modify the code to be compatible with both OS versions. Something like:
#if _CURRENT_OS_X_IS_10_7_OR_HIGHER
#interface appDelegate : NSObject<UIApplicationDelegate, NSURLConnectionDelegate> {
#else
#interface appDelegate : NSObject<UIApplicationDelegate> {
#endif
You should be able to use NSAppKitVersionNumber and/or NSFoundationVersionNumber17_0
EDIT
As you compile for iOS, you won't be able to use any macro coming from a Mac OS framework. Your only chance is the Xcode/GCC predefined macros.
You can check them with:
gcc -arch i386 -dM -E - < /dev/null | sort
This seems interesting:
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__

How can I detect what version of JavaDB/Derby I'm using?

I use JavaDB (Derby) as an embedded database in my Java Swing application. I would like to detect and print the version of JavaDB I'm using. I have included derby.jar in my .jar-file for the application.
How can I detect and print the version of my embedded JavaDB?
http://download.oracle.com/javadb/10.6.1.0/javadoc/jdbc3/org/apache/derby/tools/sysinfo.html
String version = sysinfo.getVersionString();
Can also be run from the command line:
java -jar yourjarfile.jar org.apache.derby.tools.sysinfo
If you do not want the compile-time dependency, you can also get the version info from the JDBC DatabaseMetaData:
conn.getMetaData().getDatabaseMajorVersion(); // and friends
You can also detect the product version directly using SQL:
select getdatabaseproductversion() from (values (1)) t (a);

Resources