SetCompiler: Set compiler executable for current script: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library) |
m (Updated author and download links, and changed format of some pages.) |
||
Line 71: | Line 71: | ||
-Stu | -Stu | ||
Page author: Afrow UK | Page author: [[User:Afrow UK|Afrow UK]] |
Revision as of 12:40, 23 April 2005
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
Page author: Afrow UK