SetCompiler: Set compiler executable for current script: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.) |
m (Updated author links.) |
||
Line 1: | Line 1: | ||
{|align=right | |||
|<small>Author: [[{{ns:2}}:Afrow UK|Afrow UK]] ([[{{ns:3}}:Afrow UK|talk]], [[{{ns:-1}}:Contributions/Afrow UK|contrib]])</small> | |||
|} | |||
<br style="clear:both;"> | |||
== Description == | == Description == | ||
This sets the compiler executable for the current script. It's a bit of a dodgy 'hack' but it works. The only problem is that the Test Installer button remains disabled after compiling has completed.<hr />Save the below code as SetCompiler.nsh in your NSIS Include folder... | This sets the compiler executable for the current script. It's a bit of a dodgy 'hack' but it works. The only problem is that the Test Installer button remains disabled after compiling has completed.<hr />Save the below code as SetCompiler.nsh in your NSIS Include folder... | ||
Line 70: | Line 74: | ||
-Stu | -Stu | ||
Revision as of 03:03, 30 April 2005
Author: Afrow UK (talk, contrib) |
Description
This sets the compiler executable for the current script. It's a bit of a dodgy 'hack' but it works. The only problem is that the Test Installer button remains disabled after compiling has completed.
Save the below code as SetCompiler.nsh in your NSIS Include folder...
The Script
!verbose 0 !macro SetCompiler Path !verbose 0 !ifndef "Compiler_Set" !define "Compiler_${Path}" !ifndef "Compiler_" & "Compiler_Default" !system 'IF EXIST "${Path}" echo !define "Compiler_Exists" \ >"%TEMP%\SetCompiler.nsh"' !system 'IF NOT EXIST "${Path}" echo. >"%TEMP%\SetCompiler.nsh"' !include "$%TEMP%\SetCompiler.nsh" !system 'del "%TEMP%\SetCompiler.nsh"' !ifdef "Compiler_Exists" !verbose 4 !echo "Compiler set to: ${Path}" !verbose 0 !execute '"${Path}" /D"Compiler_Set" "${__FILE__}"' !error "" !else !verbose 4 !error "${Path} compiler does not exist!" !verbose 0 !endif !else !verbose 4 !echo "Compiler set to: Default" !verbose 0 !undef "Compiler_${Path}" !endif !else !undef "Compiler_Set" !endif !verbose 4 !macroend !define SetCompiler "!insertmacro SetCompiler" !verbose 4
Then place this in your script...
!include SetCompiler.nsh ${SetCompiler} "${NSISDIR}\makensis_8192.exe"
This sets the compiler to makensis_8192.exe (a copy of a [../download/specialbuilds MakeNSIS special build]).
If you want to use the default compiler (makensis.exe) just use...
${SetCompiler} Default
It also checks if the compiler executable exists before continuing.
-Stu