diff options
author | Adam <Adam@anope.org> | 2015-03-12 11:14:59 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2015-03-12 11:20:18 -0400 |
commit | 4266d17e8c0bbcc5cb8422c2af142c4c8af9d768 (patch) | |
tree | 5ab9fc1ad9c4626dc5b7ef9832d4b40196142319 /src | |
parent | 8d3fa47ab2ec9719cbbdda55c95af962aaf5138e (diff) |
Update cmake version parsing code to deal with recent build version changes
Update Config.cs to no longer hardcode VS generators, it seems no longer necessary.
Fix new version system, cannot return C++ types from extern C functions
Diffstat (limited to 'src')
-rw-r--r-- | src/module.cpp | 5 | ||||
-rw-r--r-- | src/modulemanager.cpp | 2 | ||||
-rw-r--r-- | src/win32/Config.cs | 67 |
3 files changed, 23 insertions, 51 deletions
diff --git a/src/module.cpp b/src/module.cpp index 96fa24f6f..3266c955f 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -105,8 +105,11 @@ void Module::Prioritize() { } -ModuleVersion::ModuleVersion(int maj, int min, int pa) : version_major(maj), version_minor(min), version_patch(pa) +ModuleVersion::ModuleVersion(const ModuleVersionC &ver) { + version_major = ver.version_major; + version_minor = ver.version_minor; + version_patch = ver.version_patch; } int ModuleVersion::GetMajor() const diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 98342b08e..b6df3578a 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -287,7 +287,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) ModuleVersion ModuleManager::GetVersion(void *handle) { dlerror(); - ModuleVersion (*func)() = function_cast<ModuleVersion (*)()>(dlsym(handle, "AnopeVersion"));; + ModuleVersionC (*func)() = function_cast<ModuleVersionC (*)()>(dlsym(handle, "AnopeVersion"));; if (!func) { Log() << "No version function found, not an Anope module"; diff --git a/src/win32/Config.cs b/src/win32/Config.cs index 03308fde1..4f611a129 100644 --- a/src/win32/Config.cs +++ b/src/win32/Config.cs @@ -27,7 +27,7 @@ namespace Config {
class Config
{
- static string ExecutablePath, InstallDirectory, VSVersion, VSShortVer, ExtraIncludeDirs, ExtraLibDirs, ExtraArguments;
+ static string ExecutablePath, InstallDirectory, ExtraIncludeDirs, ExtraLibDirs, ExtraArguments;
static bool UseNMake = true, BuildDebug = false;
static bool CheckResponse(string InstallerResponse)
@@ -62,10 +62,6 @@ namespace Config ExtraLibDirs = value;
else if (name == "EXTRAARGS")
ExtraArguments = value;
- else if (name == "VSVERSION")
- VSVersion = value;
- else if (name == "VSSHORTVER")
- VSShortVer = value;
}
return true;
@@ -87,8 +83,6 @@ namespace Config tw.WriteLine("EXTRAINCLUDE={0}", ExtraIncludeDirs);
tw.WriteLine("EXTRALIBS={0}", ExtraLibDirs);
tw.WriteLine("EXTRAARGS={0}", ExtraArguments);
- tw.WriteLine("VSVERSION={0}", VSVersion);
- tw.WriteLine("VSSHORTVER={0}", VSShortVer);
}
}
@@ -103,18 +97,15 @@ namespace Config Console.Write("[{0}] ", UseNMake ? "yes" : "no");
return UseNMake ? "yes" : "no";
case 2:
- Console.Write("[{0}] ", VSShortVer);
- return VSShortVer;
- case 3:
Console.Write("[{0}] ", BuildDebug ? "yes" : "no");
return BuildDebug ? "yes" : "no";
- case 4:
+ case 3:
Console.Write("[{0}] ", ExtraIncludeDirs);
return ExtraIncludeDirs;
- case 5:
+ case 4:
Console.Write("[{0}] ", ExtraLibDirs);
return ExtraLibDirs;
- case 6:
+ case 5:
Console.Write("[{0}] ", ExtraArguments);
return ExtraArguments;
default:
@@ -247,15 +238,14 @@ namespace Config if (!DoQuick)
{
List<string> InstallerQuestions = new List<string>()
- {
- "Where do you want Anope to be installed?",
- "Would you like to build using NMake instead of using Visual Studio?\r\nNOTE: If you decide to use NMake, you must be in an environment where\r\nNMake can function, such as the Visual Studio command line. If you say\r\nyes to this while not in an environment that can run NMake, it can\r\ncause the CMake configuration to enter an endless loop. [y/n]",
- "Are you using Visual Studio 2008, 2010, or 2012? You can leave this blank\nand have CMake try and auto detect it, but this usually doesn't\nwork correctly. [2008/2010/2012]",
- "Would you like to build a debug version of Anope? [y/n]",
- "Are there any extra include directories you wish to use?\nYou may only need to do this if CMake is unable to locate missing dependencies without hints.\nSeparate directories with semicolons and use slashes (aka /) instead of backslashes (aka \\).\nIf you need no extra include directories, enter NONE in all caps.",
- "Are there any extra library directories you wish to use?\nYou may only need to do this if CMake is unable to locate missing dependencies without hints.\nSeparate directories with semicolons and use slashes (aka /) instead of backslashes (aka \\).\nIf you need no extra library directories, enter NONE in all caps.",
- "Are there any extra arguments you wish to pass to CMake?\nIf you need no extra arguments to CMake, enter NONE in all caps."
- };
+ {
+ "Where do you want Anope to be installed?",
+ "Would you like to build using NMake instead of using Visual Studio?\r\nNOTE: If you decide to use NMake, you must be in an environment where\r\nNMake can function, such as the Visual Studio command line. If you say\r\nyes to this while not in an environment that can run NMake, it can\r\ncause the CMake configuration to enter an endless loop. [y/n]",
+ "Would you like to build a debug version of Anope? [y/n]",
+ "Are there any extra include directories you wish to use?\nYou may only need to do this if CMake is unable to locate missing dependencies without hints.\nSeparate directories with semicolons and use slashes (aka /) instead of backslashes (aka \\).\nIf you need no extra include directories, enter NONE in all caps.",
+ "Are there any extra library directories you wish to use?\nYou may only need to do this if CMake is unable to locate missing dependencies without hints.\nSeparate directories with semicolons and use slashes (aka /) instead of backslashes (aka \\).\nIf you need no extra library directories, enter NONE in all caps.",
+ "Are there any extra arguments you wish to pass to CMake?\nIf you need no extra arguments to CMake, enter NONE in all caps."
+ };
for (int i = 0; i < InstallerQuestions.Count; ++i)
{
@@ -269,8 +259,8 @@ namespace Config if (!string.IsNullOrWhiteSpace(CacheResponse) && string.IsNullOrWhiteSpace(InstallerResponse))
InstallerResponse = CacheResponse;
- // Question 5-7 are optional
- if (i < 4 && string.IsNullOrWhiteSpace(InstallerResponse))
+ // Question 4+ are optional
+ if (i < 3 && string.IsNullOrWhiteSpace(InstallerResponse))
{
Console.WriteLine("Invalid option");
--i;
@@ -309,38 +299,21 @@ namespace Config ++i;
break;
case 2:
- if (InstallerResponse == "2012")
- {
- VSVersion = "-G\"Visual Studio 11\" ";
- VSShortVer = "2012";
- }
- else if (InstallerResponse == "2010")
- {
- VSVersion = "-G\"Visual Studio 10\" ";
- VSShortVer = "2010";
- }
- else if (InstallerResponse == "2008")
- {
- VSVersion = "-G\"Visual Studio 9 2008\" ";
- VSShortVer = "2008";
- }
- break;
- case 3:
BuildDebug = CheckResponse(InstallerResponse);
break;
- case 4:
+ case 3:
if (InstallerResponse == "NONE")
ExtraIncludeDirs = null;
else
ExtraIncludeDirs = InstallerResponse;
break;
- case 5:
+ case 4:
if (InstallerResponse == "NONE")
ExtraLibDirs = null;
else
ExtraLibDirs = InstallerResponse;
break;
- case 6:
+ case 5:
if (InstallerResponse == "NONE")
ExtraArguments = null;
else
@@ -355,10 +328,6 @@ namespace Config Console.WriteLine("Anope will be compiled with the following options:");
Console.WriteLine("Install directory: {0}", InstallDirectory);
Console.WriteLine("Use NMake: {0}", UseNMake ? "Yes" : "No");
- if (!string.IsNullOrWhiteSpace(VSShortVer))
- Console.WriteLine("Using Visual Studio: {0}", VSShortVer);
- else
- Console.WriteLine("Using Visual Studio: No");
Console.WriteLine("Build debug: {0}", BuildDebug ? "Yes" : "No");
Console.WriteLine("Anope Version: {0}", AnopeVersion);
Console.WriteLine("Extra Include Directories: {0}", ExtraIncludeDirs);
@@ -385,7 +354,7 @@ namespace Config InstallDirectory = "-DINSTDIR:STRING=\"" + InstallDirectory.Replace('\\', '/') + "\" ";
string NMake = UseNMake ? "-G\"NMake Makefiles\" " : "";
string Debug = BuildDebug ? "-DCMAKE_BUILD_TYPE:STRING=DEBUG " : "-DCMAKE_BUILD_TYPE:STRING=RELEASE ";
- string cMake = InstallDirectory + NMake + Debug + VSVersion + ExtraIncludeDirs + ExtraLibDirs + ExtraArguments + "\"" + ExecutablePath.Replace('\\', '/') + "\"";
+ string cMake = InstallDirectory + NMake + Debug + ExtraIncludeDirs + ExtraLibDirs + ExtraArguments + "\"" + ExecutablePath.Replace('\\', '/') + "\"";
RunCMake(cMake);
return 0;
|