mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #805 from acemod/extensionVersioning
Extension versioning
This commit is contained in:
commit
5e2ac81c59
@ -25,6 +25,34 @@ file(GLOB ACE_COMMON_SOURCES common/*.h common/*.hpp common/*.c common/*.cpp)
|
||||
add_library(ace_common STATIC ${ACE_COMMON_SOURCES})
|
||||
include_directories(AFTER "common")
|
||||
|
||||
string(TIMESTAMP ACE_BUILDSTAMP "%Y-%m-%dT%H:%M:%SZ")
|
||||
set(ACE_VERSION_MAJOR 3)
|
||||
set(ACE_VERSION_MINOR 0)
|
||||
set(ACE_VERSION_REVISION 1)
|
||||
EXECUTE_PROCESS(COMMAND git rev-parse --verify HEAD
|
||||
OUTPUT_VARIABLE T_ACE_VERSION_BUILD
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(SUBSTRING ${T_ACE_VERSION_BUILD} 0 7 ACE_VERSION_BUILD )
|
||||
|
||||
message("Building for: " ${ACE_VERSION_MAJOR}.${ACE_VERSION_MINOR}.${ACE_VERSION_REVISION}-${ACE_VERSION_BUILD})
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/common/ace_version.hpp.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/common/ace_version.hpp"
|
||||
@ONLY)
|
||||
|
||||
if(MSVC)
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/common/ace_version_win32.rc.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/common/ace_version_win32.rc"
|
||||
@ONLY)
|
||||
set(GLOBAL_RC ${CMAKE_CURRENT_BINARY_DIR}/common/ace_version_win32.rc)
|
||||
endif()
|
||||
|
||||
include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/common)
|
||||
set(GLOBAL_SOURCES ${GLOBAL_RC})
|
||||
|
||||
# Add extensions to build here
|
||||
add_subdirectory(fcs)
|
||||
add_subdirectory(breakLine)
|
||||
|
@ -19,8 +19,6 @@
|
||||
#define STD_AIR_DENSITY_ICAO 1.22498
|
||||
#define STD_AIR_DENSITY_ASM 1.20885
|
||||
|
||||
static char version[] = "1.0";
|
||||
|
||||
struct Bullet {
|
||||
double airFriction;
|
||||
double caliber;
|
||||
@ -242,7 +240,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
||||
{
|
||||
if (!strcmp(function, "version"))
|
||||
{
|
||||
int n = sprintf_s(output, outputSize, "%s", version);
|
||||
int n = sprintf_s(output, outputSize, "%s", ACE_FULL_VERSION_STR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
set(ACE_EXTENSION_NAME "ace_advanced_ballistics")
|
||||
|
||||
file(GLOB SOURCES *.h *.hpp *.c *.cpp)
|
||||
add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES})
|
||||
add_library( ${ACE_EXTENSION_NAME} SHARED ${GLOBAL_SOURCES} ${SOURCES})
|
||||
add_dependencies(${ACE_EXTENSION_NAME} ace_common)
|
||||
SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
set(ACE_EXTENSION_NAME "ace_breakLine")
|
||||
|
||||
file(GLOB SOURCES *.h *.hpp *.c *.cpp)
|
||||
add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES})
|
||||
add_library( ${ACE_EXTENSION_NAME} SHARED ${GLOBAL_SOURCES} ${SOURCES})
|
||||
add_dependencies(${ACE_EXTENSION_NAME} ace_common)
|
||||
SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
#define MAXCHARACTERS 14
|
||||
|
||||
static char VERSION[] = "1.0";
|
||||
|
||||
extern "C" {
|
||||
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
};
|
||||
@ -39,8 +37,8 @@ std::vector<std::string> splitString(const std::string & input) {
|
||||
|
||||
std::string addLineBreaks(const std::vector<std::string> &words) {
|
||||
std::stringstream sstream;
|
||||
int numChar = 0;
|
||||
int i = 0;
|
||||
size_t numChar = 0;
|
||||
size_t i = 0;
|
||||
|
||||
while (i < words.size()) {
|
||||
if (numChar == 0) {
|
||||
@ -68,7 +66,7 @@ std::string addLineBreaks(const std::vector<std::string> &words) {
|
||||
|
||||
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||
if (!strcmp(function, "version")) {
|
||||
strncpy(output, VERSION, outputSize);
|
||||
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
||||
} else {
|
||||
strncpy(output, addLineBreaks(splitString(function)).c_str(), outputSize);
|
||||
output[outputSize - 1] = '\0';
|
||||
|
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#include "ace_version.hpp"
|
||||
|
4
extensions/common/ace_version.hpp.in
Normal file
4
extensions/common/ace_version.hpp.in
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#define ACE_VERSION_STR "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@"
|
||||
#define ACE_FULL_VERSION_STR "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@"
|
47
extensions/common/ace_version_win32.rc.in
Normal file
47
extensions/common/ace_version_win32.rc.in
Normal file
@ -0,0 +1,47 @@
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef DEBUG
|
||||
#define VER_DEBUG 0
|
||||
#else
|
||||
#define VER_DEBUG VS_FF_DEBUG
|
||||
#endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION @ACE_VERSION_MAJOR@, @ACE_VERSION_MINOR@, @ACE_VERSION_REVISION@
|
||||
PRODUCTVERSION @ACE_VERSION_MAJOR@, @ACE_VERSION_MINOR@, @ACE_VERSION_REVISION@
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS (VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE|VER_DEBUG)
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "ACE3 Team"
|
||||
VALUE "FileDescription", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@"
|
||||
VALUE "FileVersion", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@"
|
||||
VALUE "ProductName", "ACE3"
|
||||
VALUE "ProductVersion", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@"
|
||||
VALUE "Build Date", "@ACE_BUILDSTAMP@"
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
/* The following line should only be modified for localized versions. */
|
||||
/* It consists of any number of WORD,WORD pairs, with each pair */
|
||||
/* describing a language,codepage combination supported by the file. */
|
||||
/* */
|
||||
/* For example, a file might have values "0x409,1252" indicating that it */
|
||||
/* supports English language (0x409) in the Windows ANSI codepage (1252). */
|
||||
|
||||
VALUE "Translation", 0x409, 1252
|
||||
|
||||
END
|
||||
END
|
||||
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
set(ACE_EXTENSION_NAME "ace_fcs")
|
||||
|
||||
file(GLOB SOURCES *.h *.hpp *.c *.cpp)
|
||||
add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES})
|
||||
add_library( ${ACE_EXTENSION_NAME} SHARED ${GLOBAL_SOURCES} ${SOURCES})
|
||||
add_dependencies(${ACE_EXTENSION_NAME} ace_common)
|
||||
SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
|
@ -25,8 +25,6 @@
|
||||
#define PRECISION 0.1
|
||||
#define RADIANS(X) (X / (180 / M_PI))
|
||||
|
||||
static char version[] = "1.0";
|
||||
|
||||
extern "C" {
|
||||
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
};
|
||||
@ -104,7 +102,7 @@ double getSolution(double initSpeed, double airFriction, double angleTarget, dou
|
||||
|
||||
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||
if (!strcmp(function, "version")) {
|
||||
strncpy(output, version, outputSize);
|
||||
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
||||
} else {
|
||||
std::vector<std::string> argStrings = splitString(function);
|
||||
double initSpeed = std::stod(argStrings[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user