SetCompiler: Set compiler executable for current script: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.) |
m (Adding new author and category links.) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|Afrow UK}} | |||
== 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 74: | Line 72: | ||
-Stu | -Stu | ||
[[Category:Compile-Time Macros]] |
Latest revision as of 13:48, 24 June 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