Skip to content

Commit

Permalink
build: Replace -WIP version suffix with .WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed Jun 5, 2024
1 parent 0e757e5 commit c217b1b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
include("${IMHEX_BASE_FOLDER}/cmake/build_helpers.cmake")

# Setup project
loadVersion(IMHEX_VERSION)
string(REPLACE "-WIP" "" IMHEX_VERSION_PLAIN ${IMHEX_VERSION})
loadVersion(IMHEX_VERSION IMHEX_VERSION_PLAIN)
setVariableInParent(IMHEX_VERSION ${IMHEX_VERSION})
configureCMake()

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.35.0-WIP
1.35.0.WIP
4 changes: 3 additions & 1 deletion cmake/build_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,14 @@ macro(setDefaultBuiltTypeIfUnset)
endif()
endmacro()

function(loadVersion version)
function(loadVersion version plain_version)
set(VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/VERSION")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${VERSION_FILE})
file(READ "${VERSION_FILE}" read_version)
string(STRIP ${read_version} read_version)
string(REPLACE ".WIP" "" read_version_plain ${read_version})
set(${version} ${read_version} PARENT_SCOPE)
set(${plain_version} ${read_version_plain} PARENT_SCOPE)
endfunction()

function(detectBadClone)
Expand Down
6 changes: 6 additions & 0 deletions lib/libimhex/include/hex/api/imhex_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,12 @@ namespace hex {
*/
bool isDebugBuild();

/**
* @brief Checks if this version of ImHex is a nightly build
* @return True if this version is a nightly, false if it's a release
*/
bool isNightlyBuild();

enum class UpdateType {
Stable,
Nightly
Expand Down
4 changes: 4 additions & 0 deletions lib/libimhex/source/api/imhex_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,10 @@ namespace hex {
#endif
}

bool isNightly() {
return getImHexVersion(false).ends_with("WIP");
}

bool updateImHex(UpdateType updateType) {
// Get the path of the updater executable
std::fs::path executablePath;
Expand Down

0 comments on commit c217b1b

Please sign in to comment.