tl-dr: view the Build directory to see. This is intended to replace the project files that we presently maintain so that only a single set is needed instead of multiples. The following setups were used for testing: * Windows 8 and Visual Studio 2013 Desktop Express * Windows 7 and Visual Studio 2012 * Mac OS X Mavericks and Xcode * Ubuntu and makefiles * Fedora 21 and makefiles All three operating systems can generate projects, compile, link, and run. Windows and Mac OS X users will find their compiled binary in the same location as before, but Linux users will be surprised: it goes straight into the root directory, along with a symlinked GtkModules.so as appropriate. There is no more need for a manual symlinking step. Known issues: * At this time, MinGW likely does not work. Extra time will be needed. * The WITH_JPEG option may go away, and we'll just always require it. * Some linux libraries can use the system equivalents, but that is not up yet. For more information, check out the Build directory.
74 lines
2.3 KiB
C++
74 lines
2.3 KiB
C++
/*
|
|
* This program was placed in the public domain by Avery,
|
|
* with some ideas implemented by AJ. Any C++ improvements
|
|
* are made by others.
|
|
*/
|
|
|
|
#include <ctime>
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <string>
|
|
#include <sstream>
|
|
#include "version.hpp"
|
|
|
|
int main(int argc, char *argv[]) {
|
|
if (argc < 2) {
|
|
return 1;
|
|
}
|
|
|
|
std::ifstream versionReadFile("version.bin", std::ios::in);
|
|
|
|
unsigned long build = 0;
|
|
|
|
// try to read the last version seen.
|
|
if (versionReadFile.is_open()) {
|
|
std::string line;
|
|
std::getline(versionReadFile, line);
|
|
if (!line.empty()) {
|
|
// TODO: Use stoul when C++11 is utilized.
|
|
build = std::atol(line.c_str());
|
|
}
|
|
|
|
versionReadFile.close();
|
|
}
|
|
|
|
// increment the build number and write it.
|
|
++build;
|
|
|
|
std::ofstream versionWriteFile("version.bin", std::ios::out);
|
|
|
|
if (versionWriteFile.is_open()) {
|
|
versionWriteFile << build;
|
|
versionWriteFile.close();
|
|
}
|
|
|
|
char strdate[10];
|
|
char strtime[64];
|
|
time_t tm;
|
|
|
|
std::time(&tm);
|
|
|
|
std::strftime(strdate, 15, "%Y%m%d", std::localtime(&tm));
|
|
std::strftime(strtime, 64, "%H:%M:%S %Z", std::localtime(&tm));
|
|
|
|
// zero out the newline.
|
|
strtime[sizeof(strtime) - 1] = 0;
|
|
|
|
std::ofstream versionDataFile(argv[1], std::ios::out);
|
|
if (versionDataFile.is_open()) {
|
|
versionDataFile << "extern unsigned long const version_num = " << build << ";" << std::endl;
|
|
versionDataFile << "extern int const sm_version_major = " << smVersionMajor << ";" << std::endl;
|
|
versionDataFile << "extern int const sm_version_minor = " << smVersionMinor << ";" << std::endl;
|
|
versionDataFile << "extern int const sm_version_patch = " << smVersionPatch << ";" << std::endl;
|
|
versionDataFile << "extern char const * const sm_version_git_hash = \"" << smVersionGitHash << "\";" << std::endl;
|
|
versionDataFile << "extern char const * const sm_version_traditional = \"" << smVersionTraditional << "\";" << std::endl;
|
|
versionDataFile << "extern char const * const version_date = \"" << strdate << "\";" << std::endl;
|
|
versionDataFile << "extern char const * const version_time = \"" << strtime << "\";" << std::endl;
|
|
versionDataFile << "extern char const * const product_version = \"" << smVersionFull << "\";" << std::endl;
|
|
versionDataFile.close();
|
|
}
|
|
|
|
return 0;
|
|
}
|