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
|
- uses: actions/checkout@v6
|
||||||
- name: Get the version and date
|
- name: Get the version and date
|
||||||
run: |
|
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
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||||
ver="PR-${{ github.event.number }}"
|
ver="PR-${{ github.event.number }}"
|
||||||
git_commit_hash="${{ github.event.pull_request.head.sha }}"
|
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
|
- name: Get the version and date on Ubuntu and macOS
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
run: |
|
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
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||||
ver="PR-${{ github.event.number }}"
|
ver="PR-${{ github.event.number }}"
|
||||||
git_commit_hash="${{ github.event.pull_request.head.sha }}"
|
git_commit_hash="${{ github.event.pull_request.head.sha }}"
|
||||||
@ -79,10 +79,7 @@ jobs:
|
|||||||
$ver = "PR" + $prNumber
|
$ver = "PR" + $prNumber
|
||||||
$git_commit_hash = "${{ github.event.pull_request.head.sha }}"
|
$git_commit_hash = "${{ github.event.pull_request.head.sha }}"
|
||||||
} else {
|
} else {
|
||||||
$versionContent = Get-Content version.inc -Raw
|
$ver = (Get-Content version_number.txt -First 1).Trim()
|
||||||
if ($versionContent -match 'set\(SoftFever_VERSION "(.*?)"\)') {
|
|
||||||
$ver = $matches[1]
|
|
||||||
}
|
|
||||||
$ver = "V$ver"
|
$ver = "V$ver"
|
||||||
$git_commit_hash = ""
|
$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 ----------
|
# ---------- version & commit ----------
|
||||||
cd "$PROJECT_ROOT"
|
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
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
VER="V${VER_PURE}"
|
VER="V${VER_PURE}"
|
||||||
@ -228,4 +228,4 @@ echo "Install with:"
|
|||||||
echo " flatpak install --user ${BUNDLE_NAME}"
|
echo " flatpak install --user ${BUNDLE_NAME}"
|
||||||
|
|
||||||
elapsed=$SECONDS
|
elapsed=$SECONDS
|
||||||
printf "\nBuild completed in %dh %dm %ds\n" $((elapsed/3600)) $((elapsed%3600/60)) $((elapsed%60))
|
printf "\nBuild completed in %dh %dm %ds\n" $((elapsed/3600)) $((elapsed%3600/60)) $((elapsed%60))
|
||||||
|
|||||||
@ -365,6 +365,8 @@ modules:
|
|||||||
path: ../../LICENSE.txt
|
path: ../../LICENSE.txt
|
||||||
- type: file
|
- type: file
|
||||||
path: ../../version.inc
|
path: ../../version.inc
|
||||||
|
- type: file
|
||||||
|
path: ../../version_number.txt
|
||||||
- type: file
|
- type: file
|
||||||
path: ../run_gettext.sh
|
path: ../run_gettext.sh
|
||||||
dest: scripts
|
dest: scripts
|
||||||
|
|||||||
@ -38,8 +38,12 @@ CBaseException::CBaseException(HANDLE hProcess, WORD wPID, LPCTSTR lpSymbolPath,
|
|||||||
std::string log_filename = crash_log_path.string();
|
std::string log_filename = crash_log_path.string();
|
||||||
output_file->open(log_filename, std::ios::out | std::ios::app);
|
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
|
const std::string build_info = std::string(SLIC3R_APP_NAME) + " " + SoftFever_VERSION + " Build " + GIT_COMMIT_HASH;
|
||||||
OutputString(_T("%s\n\n"), _T(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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,4 +394,4 @@ void CBaseException::ShowExceptionInformation()
|
|||||||
ShowRegistorInformation(m_pEp->ContextRecord);
|
ShowRegistorInformation(m_pEp->ContextRecord);
|
||||||
|
|
||||||
ShowCallstack(GetCurrentThread(), m_pEp->ContextRecord);
|
ShowCallstack(GetCurrentThread(), m_pEp->ContextRecord);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,16 @@ if(NOT DEFINED ORCA_CHECK_GCODE_PLACEHOLDERS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libslic3r_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/libslic3r_version.h @ONLY)
|
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)
|
if (MINGW)
|
||||||
add_compile_options(-Wa,-mbig-obj)
|
add_compile_options(-Wa,-mbig-obj)
|
||||||
@ -539,6 +549,7 @@ if (MSVC AND "${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") # 32 bit MSVC workaround
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
encoding_check(libslic3r)
|
encoding_check(libslic3r)
|
||||||
|
target_sources(libslic3r PRIVATE "${LIBSLIC3R_VERSION_CPP}")
|
||||||
|
|
||||||
target_compile_definitions(libslic3r PUBLIC -DUSE_TBB -DTBB_USE_CAPTURED_EXCEPTION=0)
|
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})
|
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_NAME "@SLIC3R_APP_NAME@"
|
||||||
#define SLIC3R_APP_KEY "@SLIC3R_APP_KEY@"
|
#define SLIC3R_APP_KEY "@SLIC3R_APP_KEY@"
|
||||||
#define SLIC3R_VERSION "@SLIC3R_VERSION@"
|
#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
|
#ifndef GIT_COMMIT_HASH
|
||||||
#define GIT_COMMIT_HASH "0000000" // 0000000 means uninitialized
|
#define GIT_COMMIT_HASH "0000000" // 0000000 means uninitialized
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1208,12 +1208,12 @@ std::string string_printf(const char *format, ...)
|
|||||||
|
|
||||||
std::string header_slic3r_generated()
|
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()
|
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()
|
unsigned get_current_pid()
|
||||||
|
|||||||
@ -189,7 +189,8 @@ Http::priv::priv(const std::string &url)
|
|||||||
set_timeout_max(DEFAULT_TIMEOUT_MAX);
|
set_timeout_max(DEFAULT_TIMEOUT_MAX);
|
||||||
::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, log_trace);
|
::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_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());
|
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer.front());
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
::curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_MAX_TLSv1_2);
|
::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)
|
if(NOT DEFINED BBL_INTERNAL_TESTING)
|
||||||
set(BBL_INTERNAL_TESTING "0")
|
set(BBL_INTERNAL_TESTING "0")
|
||||||
endif()
|
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]+)"
|
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)"
|
||||||
SoftFever_VERSION_MATCH ${SoftFever_VERSION})
|
SoftFever_VERSION_MATCH ${SoftFever_VERSION})
|
||||||
set(ORCA_VERSION_MAJOR ${CMAKE_MATCH_1})
|
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