Old 24th November 2003, 20:39   #1
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,098
Question Compile Time Commands

How could i do this(@ Compile time)?

code:

!define SetupMode "1"
...
!if ${SetupMode}=="1"
!insertmacro DoSomething
!else
!insertmacro DoTheOtherThing
!endif

Anders is offline   Reply With Quote
Old 24th November 2003, 20:44   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
If you can get to http://nsis.sf.net/ then you can find the answer in the FAQ on that page. If it's lagging for you too see StrCmp, StrCpy and IntCmp in the manual. Some examples in the Examples directory use those, so you can look at them for usage example.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 24th November 2003, 21:04   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,098
Isnt StrCmp, StrCpy and IntCmp RunTime only?

What I want is to !include a file only if a define is defined to a certain(sp?) value...
Anders is offline   Reply With Quote
Old 24th November 2003, 21:11   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Oh sorry, didn't read that right... I have no ideas for that at the moment, but something with !system would probably do the trick.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 24th November 2003, 21:20   #5
eccles
NSIS Dev
 
eccles's Avatar
 
Join Date: Sep 2001
Location: Leicester, UK
Posts: 193
Here's a trick I've used:
code:
!define SetupMode "1"
...
!define SetupModeIs${SetupMode}
!ifdef SetupModeIs1
!insertmacro DoSomething
!else
!insertmacro DoTheOtherThing
!endif
!undef SetupModeIs${SetupMode}

eccles is offline   Reply With Quote
Old 24th November 2003, 21:26   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,098
From Help File:
Quote:
!system: This command will execute 'command' using a call to system()
i dont know what 'system()' is and the only example i could find was in makensis.nsi:
Quote:
!system '"${NSISDIR}\Bin\InstallCVSData.exe" nooverwrite'
!echo "Compiling CVS Data Setup..."
!system '"${NSISDIR}\makensis.exe" /V1 cvsdata.nsi' = 0
dont know what those lines do but it looks to me like they call an external program...

what I need is a C preprocessor like command...

from a normal StdAfx.h file:
Quote:
#if _MSC_VER > 1000 <--This is what I need
#pragma once
#endif // _MSC_VER > 1000
I'm guessing that this is currently not possible, but could support be added 4 this in the future??
Anders is offline   Reply With Quote
Old 25th November 2003, 14:42   #7
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
It's currently not possible, but if you give more details we might be able to help you with other solutions.
Joost Verburg is offline   Reply With Quote
Old 26th November 2003, 20:56   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,098
i guess i have to hack nsis myself then, script.cpp would be the right place to do it right?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 26th November 2003, 21:00   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Yes, but why not use eccle's method?

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 26th November 2003, 21:08   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,098
because i want to use stuff like !if ${somedefine} > 4...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 26th November 2003, 21:14   #11
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
OK, good luck. Submit a patch if you get it working. If you don't you can use !system to call anotehr program that will do this, like perl for example. You can get the program to write a NSH file which you would !include and use.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 26th November 2003, 21:27   #12
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,098
what im trying do is create a script file that makes it real easy to create a setup...

this is all i need to create the setup for one of my apps:
code:

!define APP_NAME "YourApp"
!define APP_COMPANY "Nullsoft Fan =)"
!define APPFILE_MAIN_SRCTREEPATH "..\Source\ReleaseU\${APPFILE_MAIN_BINNAME}"

!include "nsw.nsh"



This script will:
-Install ${APPFILE_MAIN_SRCTREEPATH} in $PROGRAMFILES\${APP_NAME}
-Create a uninstaller and register this in the registry.
-Show The License page
-Copy the license file to $InstDir
-AutoCreate Shortcut for the main program file in: (Can be disabled on the componentpage (Classic & Modern GUI))
--The Desktop
--The QuickLaunch area
Anders is offline   Reply With Quote
Old 26th November 2003, 22:50   #13
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
A worthy goal indeed

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd September 2004, 19:23   #14
azerger
Junior Member
 
Join Date: Nov 2003
Posts: 16
Joost or kichik,
Has this feature ever been added to nsis? It was posted over a year ago and I am trying to do the same thing.

http://forums.winamp.com/showthread....61#post1477361

Its seems straight forward to add just a binary compare equals to the compile time !ifdef APP_COMP == "sdfsd" to nsis. Can this be done?
Was it done?
Thanks,
art
azerger is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump