Move version number to separate file so CMake doesn't reconfigure when it changes
This commit is contained in:
2
.github/workflows/build_all.yml
vendored
2
.github/workflows/build_all.yml
vendored
@ -142,7 +142,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Get the version and date
|
||||
run: |
|
||||
ver_pure=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
|
||||
ver_pure=$(cat version_number.txt)
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
ver="PR-${{ github.event.number }}"
|
||||
git_commit_hash="${{ github.event.pull_request.head.sha }}"
|
||||
|
||||
7
.github/workflows/build_orca.yml
vendored
7
.github/workflows/build_orca.yml
vendored
@ -53,7 +53,7 @@ jobs:
|
||||
- name: Get the version and date on Ubuntu and macOS
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
ver_pure=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
|
||||
ver_pure=$(cat version_number.txt)
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
ver="PR-${{ github.event.number }}"
|
||||
git_commit_hash="${{ github.event.pull_request.head.sha }}"
|
||||
@ -79,10 +79,7 @@ jobs:
|
||||
$ver = "PR" + $prNumber
|
||||
$git_commit_hash = "${{ github.event.pull_request.head.sha }}"
|
||||
} else {
|
||||
$versionContent = Get-Content version.inc -Raw
|
||||
if ($versionContent -match 'set\(SoftFever_VERSION "(.*?)"\)') {
|
||||
$ver = $matches[1]
|
||||
}
|
||||
$ver = (Get-Content version_number.txt -First 1).Trim()
|
||||
$ver = "V$ver"
|
||||
$git_commit_hash = ""
|
||||
}
|
||||
|
||||
25
cmake/GenerateSoftFeverVersion.cmake
Normal file
25
cmake/GenerateSoftFeverVersion.cmake
Normal file
@ -0,0 +1,25 @@
|
||||
if(NOT DEFINED INPUT)
|
||||
message(FATAL_ERROR "INPUT is required")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED OUTPUT)
|
||||
message(FATAL_ERROR "OUTPUT is required")
|
||||
endif()
|
||||
|
||||
file(STRINGS "${INPUT}" SOFTFEVER_VERSION LIMIT_COUNT 1)
|
||||
string(STRIP "${SOFTFEVER_VERSION}" SOFTFEVER_VERSION)
|
||||
|
||||
set(CONTENT [=[
|
||||
#include "libslic3r_version.h"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
const char* softfever_version()
|
||||
{
|
||||
return "@SOFTFEVER_VERSION@";
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
]=])
|
||||
string(CONFIGURE "${CONTENT}" CONTENT @ONLY)
|
||||
file(WRITE "${OUTPUT}" "${CONTENT}")
|
||||
@ -77,9 +77,9 @@ esac
|
||||
# ---------- version & commit ----------
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
VER_PURE=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
|
||||
VER_PURE=$(cat version_number.txt)
|
||||
if [ -z "$VER_PURE" ]; then
|
||||
echo "Error: could not extract version from version.inc" >&2
|
||||
echo "Error: could not extract version from version_number.txt" >&2
|
||||
exit 1
|
||||
fi
|
||||
VER="V${VER_PURE}"
|
||||
|
||||
@ -365,6 +365,8 @@ modules:
|
||||
path: ../../LICENSE.txt
|
||||
- type: file
|
||||
path: ../../version.inc
|
||||
- type: file
|
||||
path: ../../version_number.txt
|
||||
- type: file
|
||||
path: ../run_gettext.sh
|
||||
dest: scripts
|
||||
|
||||
@ -38,8 +38,12 @@ CBaseException::CBaseException(HANDLE hProcess, WORD wPID, LPCTSTR lpSymbolPath,
|
||||
std::string log_filename = crash_log_path.string();
|
||||
output_file->open(log_filename, std::ios::out | std::ios::app);
|
||||
|
||||
// Output app build info in crash log so we could look for the correct PDB files
|
||||
OutputString(_T("%s\n\n"), _T(SLIC3R_APP_NAME " " SoftFever_VERSION " Build " GIT_COMMIT_HASH));
|
||||
const std::string build_info = std::string(SLIC3R_APP_NAME) + " " + SoftFever_VERSION + " Build " + GIT_COMMIT_HASH;
|
||||
#ifdef UNICODE
|
||||
OutputString(_T("%S\n\n"), build_info.c_str());
|
||||
#else
|
||||
OutputString(_T("%s\n\n"), build_info.c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,16 @@ if(NOT DEFINED ORCA_CHECK_GCODE_PLACEHOLDERS)
|
||||
endif()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libslic3r_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/libslic3r_version.h @ONLY)
|
||||
set(LIBSLIC3R_VERSION_CPP "${CMAKE_CURRENT_BINARY_DIR}/libslic3r_version.cpp")
|
||||
add_custom_command(
|
||||
OUTPUT "${LIBSLIC3R_VERSION_CPP}"
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DINPUT=${SOFTFEVER_VERSION_FILE}"
|
||||
"-DOUTPUT=${LIBSLIC3R_VERSION_CPP}"
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/GenerateSoftFeverVersion.cmake"
|
||||
DEPENDS "${SOFTFEVER_VERSION_FILE}" "${CMAKE_SOURCE_DIR}/cmake/GenerateSoftFeverVersion.cmake"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
if (MINGW)
|
||||
add_compile_options(-Wa,-mbig-obj)
|
||||
@ -539,6 +549,7 @@ if (MSVC AND "${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") # 32 bit MSVC workaround
|
||||
endif ()
|
||||
|
||||
encoding_check(libslic3r)
|
||||
target_sources(libslic3r PRIVATE "${LIBSLIC3R_VERSION_CPP}")
|
||||
|
||||
target_compile_definitions(libslic3r PUBLIC -DUSE_TBB -DTBB_USE_CAPTURED_EXCEPTION=0)
|
||||
target_include_directories(libslic3r PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
#define SLIC3R_APP_NAME "@SLIC3R_APP_NAME@"
|
||||
#define SLIC3R_APP_KEY "@SLIC3R_APP_KEY@"
|
||||
#define SLIC3R_VERSION "@SLIC3R_VERSION@"
|
||||
#define SoftFever_VERSION "@SoftFever_VERSION@"
|
||||
namespace Slic3r { const char* softfever_version(); }
|
||||
#define SoftFever_VERSION (Slic3r::softfever_version())
|
||||
#ifndef GIT_COMMIT_HASH
|
||||
#define GIT_COMMIT_HASH "0000000" // 0000000 means uninitialized
|
||||
#endif
|
||||
|
||||
@ -1208,12 +1208,12 @@ std::string string_printf(const char *format, ...)
|
||||
|
||||
std::string header_slic3r_generated()
|
||||
{
|
||||
return std::string(SLIC3R_APP_NAME " " SoftFever_VERSION);
|
||||
return std::string(SLIC3R_APP_NAME) + " " + SoftFever_VERSION;
|
||||
}
|
||||
|
||||
std::string header_gcodeviewer_generated()
|
||||
{
|
||||
return std::string(GCODEVIEWER_APP_NAME " " SoftFever_VERSION);
|
||||
return std::string(GCODEVIEWER_APP_NAME) + " " + SoftFever_VERSION;
|
||||
}
|
||||
|
||||
unsigned get_current_pid()
|
||||
|
||||
@ -189,7 +189,8 @@ Http::priv::priv(const std::string &url)
|
||||
set_timeout_max(DEFAULT_TIMEOUT_MAX);
|
||||
::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, log_trace);
|
||||
::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); // curl makes a copy internally
|
||||
::curl_easy_setopt(curl, CURLOPT_USERAGENT, SLIC3R_APP_NAME "/" SoftFever_VERSION);
|
||||
const std::string user_agent = std::string(SLIC3R_APP_NAME) + "/" + SoftFever_VERSION;
|
||||
::curl_easy_setopt(curl, CURLOPT_USERAGENT, user_agent.c_str());
|
||||
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer.front());
|
||||
#ifdef __WINDOWS__
|
||||
::curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_MAX_TLSv1_2);
|
||||
|
||||
@ -7,7 +7,9 @@ set(SLIC3R_APP_KEY "OrcaSlicer")
|
||||
if(NOT DEFINED BBL_INTERNAL_TESTING)
|
||||
set(BBL_INTERNAL_TESTING "0")
|
||||
endif()
|
||||
set(SoftFever_VERSION "1.0.5")
|
||||
set(SOFTFEVER_VERSION_FILE "${CMAKE_CURRENT_LIST_DIR}/version_number.txt")
|
||||
file(STRINGS "${SOFTFEVER_VERSION_FILE}" SoftFever_VERSION LIMIT_COUNT 1)
|
||||
string(STRIP "${SoftFever_VERSION}" SoftFever_VERSION)
|
||||
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)"
|
||||
SoftFever_VERSION_MATCH ${SoftFever_VERSION})
|
||||
set(ORCA_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
|
||||
1
version_number.txt
Normal file
1
version_number.txt
Normal file
@ -0,0 +1 @@
|
||||
1.0.9
|
||||
Reference in New Issue
Block a user