Raised This Month: $32 Target: $400
 8% 

SM Ext & VS: Compiling specific files only for specific profiles


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-18-2011 , 09:55   SM Ext & VS: Compiling specific files only for specific profiles
Reply With Quote #1

Is there an (easy) way to have Visual Studio (2k8 or 2k10) only compile specific files for specific profiles?

SourceMod's default extension project has different profiles for different game engines, and I only want specific files included for specific versions of the engine.

Normally I wouldn't care, but if I don't do this, I get errors because I declare the same SourceHook in different files that have the same parent class:

Code:
Error    1    error LNK2005: "int __cdecl __SourceHook_FHAddIServerGameClientsClientCommand(void *,enum SourceHook::ISourceHook::AddHookMode,bool,class fastdelegate::FastDelegate2<struct edict_t *,class CCommand const &,void>)" (?__SourceHook_FHAddIServerGameClientsClientCommand@@YAHPAXW4AddHookMode@ISourceHook@SourceHook@@_NV?$FastDelegate2@PAUedict_t@@ABVCCommand@@X@fastdelegate@@@Z) already defined in BuiltinVoteStyle_L4D_Base.obj    BuiltinVoteStyle_TF2.obj    sdk
(and other errors, but I figured I'd show one)

Moving the declaration gets me errors about not finding the function when I try actually hooking it:
Code:
Error    1    error C3861: '__SourceHook_FHAddIServerGameClientsClientCommand': identifier not found    d:\projects\sourcemod\libs\sourcemod\public\builtinvotes\builtinvotestyle_l4d_base.cpp    38    sdk
unless I move it to the parent class, in which I get the already defined bit again.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-18-2011 at 11:24.
Powerlord is offline
BAILOPAN
Join Date: Jan 2004
Old 10-18-2011 , 15:20   Re: SM Ext & VS: Compiling specific files only for specific profiles
Reply With Quote #2

You can #ifdef an entire file - you could also open the project file with a text editor and try to see if it's possible manually.
__________________
egg
BAILOPAN is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-18-2011 , 15:33   Re: SM Ext & VS: Compiling specific files only for specific profiles
Reply With Quote #3

Quote:
Originally Posted by BAILOPAN View Post
You can #ifdef an entire file - you could also open the project file with a text editor and try to see if it's possible manually.
I was hoping to avoid ifdefing the entire thing, but I suppose I could do that if I must. I know for Linux I was intending to adjust the list of .cpp files the Makefile uses for various profiles.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
psychonic

BAFFLED
Join Date: May 2008
Old 10-18-2011 , 15:57   Re: SM Ext & VS: Compiling specific files only for specific profiles
Reply With Quote #4

In Visual Studio 2010 (maybe earlier versions as well?), you can right-click the file and choose properties, and then select "Yes" for "Excluded From Build". The setting is configuration-specific.
psychonic is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-18-2011 , 16:22   Re: SM Ext & VS: Compiling specific files only for specific profiles
Reply With Quote #5

Quote:
Originally Posted by psychonic View Post
In Visual Studio 2010 (maybe earlier versions as well?), you can right-click the file and choose properties, and then select "Yes" for "Excluded From Build". The setting is configuration-specific.
I like this solution a lot better than ifdef'ing.

I'll have to check later if 2008 also supports it.

I tried Googling to see if this feature existed, but apparently my Googlefu was weak.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-19-2011 , 10:34   Re: SM Ext & VS: Compiling specific files only for specific profiles
Reply With Quote #6

Quote:
Originally Posted by psychonic View Post
In Visual Studio 2010 (maybe earlier versions as well?), you can right-click the file and choose properties, and then select "Yes" for "Excluded From Build". The setting is configuration-specific.
It does indeed work with 2008.

Although I accidentally chose Exclude From Project on the dropdown first (whoops, properties page first to get the correct Exclude).

I'm already using #ifdef to decide which to include in extension.cpp and which object to instantiate, so this *should* in theory work. I'll test it after I've written the other classes to find out.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-19-2011 at 10:36.
Powerlord is offline
Reply


Thread Tools
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


All times are GMT -4. The time now is 19:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode