[Update] Build/Debug Info

This commit is contained in:
xiaozhou233 committed 2025-10-20 05:17:25 +08:00
1 parent baac951abf
commit b5042463e3
6 files changed
+54 -1

No files matched your search

+1
View File
@@ -1,4 +1,5 @@
.vscode/*
build/*
debug/*
UserDir/*
CMakeCache.txt
+3
View File
@@ -19,6 +19,9 @@ add_subdirectory(${INCLUDES}/tomlc17)
add_subdirectory(src/utils)
include(cmake/JuiceModule.cmake)
include(cmake/BuildVersion.cmake)
build_version()
# modules
add_juice_module(agent)
+10 -1
View File
@@ -6,7 +6,16 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
"CMAKE_BUILD_TYPE": "Release",
"RELEASE_BUILD": "ON"
}
},
{
"name": "ninja-debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
}
]
+1
View File
@@ -89,6 +89,7 @@ If the injection is successful, EntryClass .EntryMethod() of <EntryJarPath> will
- Java 8+
- MinGW
- CMake
- Ninja
```
git clone https://github.com/xiaozhou233/JuiceAgent.git
cd JuiceAgent
+36
View File
@@ -0,0 +1,36 @@
# BuildVersion.cmake
# function to get and set the build version
function(build_version)
set(VERSION_FILE "${CMAKE_SOURCE_DIR}/version.txt")
file(READ "${VERSION_FILE}" VERSION_CONTENT)
# VERSION_MAJOR
string(REGEX MATCH "VERSION_MAJOR=([0-9]+)" _ ${VERSION_CONTENT})
set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
# VERSION_MINOR
string(REGEX MATCH "VERSION_MINOR=([0-9]+)" _ ${VERSION_CONTENT})
set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_1})
# BUILD_NUMBER
string(REGEX MATCH "BUILD_NUMBER=([0-9]+)" _ ${VERSION_CONTENT})
set(PROJECT_BUILD_NUMBER ${CMAKE_MATCH_1})
if(RELEASE_BUILD)
math(EXPR PROJECT_BUILD_NUMBER "${PROJECT_BUILD_NUMBER} + 1")
file(WRITE "${VERSION_FILE}"
"VERSION_MAJOR=${PROJECT_VERSION_MAJOR}\n"
"VERSION_MINOR=${PROJECT_VERSION_MINOR}\n"
"BUILD_NUMBER=${PROJECT_BUILD_NUMBER}\n"
)
endif()
set(PROJECT_VERSION_STRING "v${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}-b${PROJECT_BUILD_NUMBER}")
message(STATUS "Build version: ${PROJECT_VERSION_STRING}")
add_compile_definitions(
PROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
PROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR}
PROJECT_BUILD_NUMBER=${PROJECT_BUILD_NUMBER}
PROJECT_VERSION_STRING=\"${PROJECT_VERSION_STRING}\")
endfunction()
+3
View File
@@ -0,0 +1,3 @@
VERSION_MAJOR=1
VERSION_MINOR=0
BUILD_NUMBER=19