Skip to content

Commit 50a1939

Browse files
guestnoneBearishSun
authored andcommitted
Build: Versioning and resource file improvements
- Adds the autogenerated classes for getting the version of the framework and engine/editor from the C# side and exposes the engine/editor version macros on C++ side. - fixes the problem introduced after the script revamp when Mono script runtime resource file would be linked with the Banshee executables, while it should only linked with the bs::f one.
1 parent 477d035 commit 50a1939

File tree

9 files changed

+82
-14
lines changed

9 files changed

+82
-14
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ indent_size = 4
66
max_line_length=125
77

88
[*.cs]
9+
indent_style = space
10+
11+
[*.cs.in]
912
indent_style = space

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ BsEngineConfig.h
3232
BsFrameworkConfig.h
3333
Source/Scripting/bsfSharp/bsfSharpCore.csproj
3434
Source/Scripting/bsfSharp/MBansheeEngine.csproj
35-
35+
Source/Scripting/bsfSharp/EngineVersion.cs
36+
Source/Scripting/bsfSharp/FrameworkVersion.cs

Source/CMake/BsEngineConfig.h.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,12 @@ static constexpr const char* BINARIES_PATH = "@CMAKE_RUNTIME_OUTPUT_DIRECTORY_MI
2222
#elif BS_CONFIG == BS_CONFIG_RELEASE
2323
static constexpr const char* BINARIES_PATH = "@CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE@";
2424
#endif
25+
26+
/** Banshee 3D related version stuff*/
27+
#if BS_IS_BANSHEE3D
28+
#define BS_B3D_VERSION_MAJOR @BS_B3D_VERSION_MAJOR@
29+
#define BS_B3D_VERSION_MINOR @BS_B3D_VERSION_MINOR@
30+
#define BS_B3D_VERSION_PATCH @BS_B3D_VERSION_PATCH@
31+
#define BS_B3D_CURRENT_RELEASE_YEAR @BS_B3D_CURRENT_RELEASE_YEAR@
32+
#define BS_B3D_VERSION_STRING _MKSTR(BS_B3D_VERSION_MAJOR) "." _MKSTR(BS_B3D_VERSION_MINOR) "." _MKSTR(BS_B3D_VERSION_PATCH) ".0"
33+
#endif

Source/Scripting/bsfMono/CMakeSources.cmake

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,9 @@ set(BS_MONO_SRC_NOFILTER
2323
"BsMonoArray.cpp"
2424
)
2525

26-
if(WIN32)
27-
set(BS_MONO_WIN32RES
28-
"BsMonoWin32Resource.rc"
29-
)
30-
else()
31-
set(BS_MONO_WIN32RES )
32-
endif()
33-
34-
source_group("" FILES ${BS_MONO_INC_NOFILTER} ${BS_MONO_SRC_NOFILTER} ${BS_MONO_WIN32RES})
26+
source_group("" FILES ${BS_MONO_INC_NOFILTER} ${BS_MONO_SRC_NOFILTER})
3527

3628
set(BS_MONO_SRC
3729
${BS_MONO_INC_NOFILTER}
3830
${BS_MONO_SRC_NOFILTER}
39-
${BS_MONO_WIN32RES}
4031
)

Source/Scripting/bsfMono/BsMonoWin32Resource.rc renamed to Source/Scripting/bsfScript/BsScriptWin32Resource.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
FILEVERSION BS_VERSION_MAJOR,BS_VERSION_MINOR,BS_VERSION_PATCH,0
99
PRODUCTVERSION BS_VERSION_MAJOR,BS_VERSION_MINOR,BS_VERSION_PATCH,0
1010
FILEOS VOS__WINDOWS32
11-
FILETYPE VFT_DLL
11+
FILETYPE VFT_APP
1212
BEGIN
1313
BLOCK "StringFileInfo"
1414
BEGIN
1515
BLOCK "040904b0"
1616
BEGIN
1717
VALUE "CompanyName", "Marko Pintera and contributors"
18-
VALUE "FileDescription", "Mono script runtime plugin for bs::framework"
18+
VALUE "FileDescription", "C#/Mono script code runtime for bs::framework applications"
1919
VALUE "FileVersion", BS_VERSION_STRING
2020
VALUE "ProductName", "bs::framework"
2121
VALUE "Licence", "Released under the MIT License"

Source/Scripting/bsfScript/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ target_link_libraries(bsfScript bsfMono bsf)
3232
# Runtime executable
3333
if(NOT BS_IS_BANSHEE3D)
3434
# Target for running framework scripting assemblies
35-
add_executable(bsfSharp WIN32 BsScriptExec.cpp)
35+
add_executable(bsfSharp WIN32 BsScriptExec.cpp BsScriptWin32Resource.rc)
3636
target_link_libraries(bsfSharp bsfScript bsfMono bsf)
3737

3838
set_property(TARGET bsfSharp PROPERTY FOLDER Script)

Source/Scripting/bsfSharp/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Generate the CS version information class for framework and engine
2+
if(BS_IS_BANSHEE3D)
3+
configure_file("${BSF_SOURCE_DIR}/Scripting/bsfSharp/EngineVersion.cs.in" "${BSF_SOURCE_DIR}/Scripting/bsfSharp/EngineVersion.cs")
4+
endif()
5+
configure_file("${BSF_SOURCE_DIR}/Scripting/bsfSharp/FrameworkVersion.cs.in" "${BSF_SOURCE_DIR}/Scripting/bsfSharp/FrameworkVersion.cs")
6+
17
# Generate the CS project file
28
if(BS_IS_BANSHEE3D)
39
set(BS_CS_ASSEMBLY_NAME "MBansheeEngine")
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Autogenerated file, please do not edit!
2+
3+
using System;
4+
5+
namespace bs
6+
{
7+
/// <summary>
8+
/// Provides version information about the engine/editor.
9+
/// </summary>
10+
public static class EngineVersion
11+
{
12+
/// <summary>
13+
/// Returns the version of the engine as a text in MAJOR.MINOR.PATCH format.
14+
/// </summary>
15+
public static string GetFullVersionString()
16+
{
17+
return verMajor.ToString() + "." + verMinor.ToString() + "." + verPatch.ToString();
18+
}
19+
public static int GetMajorVersionNumber() { return verMajor; }
20+
public static int GetMinorVersionNumber() { return verMinor; }
21+
public static int GetPatchVersionNumber() { return verPatch; }
22+
public static int GetCurrentReleaseYearNumber() { return currRelYear; }
23+
24+
private const int verMajor = @BS_B3D_VERSION_MAJOR@;
25+
private const int verMinor = @BS_B3D_VERSION_MINOR@;
26+
private const int verPatch = @BS_B3D_VERSION_PATCH@;
27+
private const int currRelYear = @BS_B3D_CURRENT_RELEASE_YEAR@;
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Autogenerated file, please do not edit!
2+
3+
using System;
4+
5+
namespace bs
6+
{
7+
/// <summary>
8+
/// Provides version information about the framework.
9+
/// </summary>
10+
public static class FrameworkVersion
11+
{
12+
/// <summary>
13+
/// Returns the version of the framework as a text in MAJOR.MINOR.PATCH format.
14+
/// </summary>
15+
public static string GetFullVersionString()
16+
{
17+
return verMajor.ToString() + "." + verMinor.ToString() + "." + verPatch.ToString();
18+
}
19+
public static int GetMajorVersionNumber() { return verMajor; }
20+
public static int GetMinorVersionNumber() { return verMinor; }
21+
public static int GetPatchVersionNumber() { return verPatch; }
22+
public static int GetCurrentReleaseYearNumber() { return currRelYear; }
23+
24+
private const int verMajor = @BS_FRAMEWORK_VERSION_MAJOR@;
25+
private const int verMinor = @BS_FRAMEWORK_VERSION_MINOR@;
26+
private const int verPatch = @BS_FRAMEWORK_VERSION_PATCH@;
27+
private const int currRelYear = @BS_FRAMEWORK_CURRENT_RELEASE_YEAR@;
28+
}
29+
}

0 commit comments

Comments
 (0)