diff --git a/SerialPrograms/CMakeLists.txt b/SerialPrograms/CMakeLists.txt index fb18da53f..6761568db 100644 --- a/SerialPrograms/CMakeLists.txt +++ b/SerialPrograms/CMakeLists.txt @@ -34,20 +34,11 @@ set(CMAKE_AUTOUIC ON) add_custom_target(build-time-make-directory ALL COMMAND ${CMAKE_COMMAND} -E make_directory Assembly/) -# Determine if this is an internal repo and normalize REPO_ROOT_DIR -# CMAKE_CURRENT_SOURCE_DIR: the full path to this CmakeLists.txt -# Find if "Arduino-Source-Internal" is in the path and store the find result to internal_repo_position -string(FIND "${CMAKE_CURRENT_SOURCE_DIR}" "Arduino-Source-Internal" internal_repo_position) -if(internal_repo_position EQUAL -1) # no "Arduino-Source-Internal" in the path - # We are building the public repo, CMakeLists.txt is one level deep in the root repo dir - set(REPO_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../") -else() - # We are building the internal repo, CMakeLists.txt is three levels deep in the root repo dir - set(REPO_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../") -endif() +# Internal repo or not, we're always building from the SerialPrograms folder +set(REPO_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../") # Determine environment -if(DEFINED ENV{GITHUB_ACTIONS}) +if(DEFINED ENV{GITHUB_ACTIONS} OR DEFINED IS_AZURE_BUILD) message(STATUS "Detected CI environment, skipping qt deployment") set(QT_DEPLOY_FILES FALSE) else() @@ -169,6 +160,7 @@ target_link_libraries( # Add source code exclusive to the internal repo and add C++ macro of official release if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../Internal/SerialPrograms/Internal0.cpp") + message(STATUS "Building internal SerialPrograms") target_compile_definitions(SerialProgramsLib PRIVATE PA_OFFICIAL) target_compile_definitions(SerialPrograms PRIVATE PA_OFFICIAL) target_sources(SerialProgramsLib PRIVATE ../../Internal/SerialPrograms/NintendoSwitch_TestPrograms.cpp) @@ -177,6 +169,22 @@ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../Internal/SerialPrograms/Internal0. target_sources(SerialProgramsLib PRIVATE ../../Internal/SerialPrograms/Internal1.cpp) endif() +if (IS_AZURE_BUILD) + target_compile_definitions(SerialProgramsLib PRIVATE + PA_VERSION_MAJOR=${VERSION_MAJOR} + PA_VERSION_MINOR=${VERSION_MINOR} + PA_VERSION_PATCH=${VERSION_PATCH} + PA_IS_BETA=${IS_BETA} + ) + + target_compile_definitions(SerialPrograms PRIVATE + PA_VERSION_MAJOR=${VERSION_MAJOR} + PA_VERSION_MINOR=${VERSION_MINOR} + PA_VERSION_PATCH=${VERSION_PATCH} + PA_IS_BETA=${IS_BETA} + ) +endif() + # Function to apply common properties to both library and executable targets function(apply_common_target_properties target_name) set_target_properties(${target_name} PROPERTIES LINKER_LANGUAGE CXX) @@ -614,8 +622,10 @@ if (WIN32) ) add_custom_target(run_windeployqt DEPENDS $) else() - message(WARNING "windeployqt not found, skipping Qt deployment.") + add_custom_target(run_windeployqt COMMENT "Skipping windeployqt (not found)") endif() + else() + add_custom_target(run_windeployqt COMMENT "Skipping windeployqt (CI environment)") endif() # Copy Discord SDK DLL @@ -651,7 +661,7 @@ if (WIN32) COMMAND ${CMAKE_COMMAND} -E copy_if_different "$,${DPP_DEBUG_DLL},${DPP_RELEASE_DLL}>" "${WIN_DEPLOY_DIR}/dpp.dll" -) + ) # Extract OpenCV debug DLL if missing if (NOT EXISTS "${OPENCV_DEBUG_DLL}") diff --git a/SerialPrograms/Source/CommonFramework/Globals.cpp b/SerialPrograms/Source/CommonFramework/Globals.cpp index 64b67f611..c93e7b3f5 100644 --- a/SerialPrograms/Source/CommonFramework/Globals.cpp +++ b/SerialPrograms/Source/CommonFramework/Globals.cpp @@ -23,10 +23,26 @@ namespace PokemonAutomation{ // misleading version information. // -const bool IS_BETA_VERSION = true; -const int PROGRAM_VERSION_MAJOR = 0; -const int PROGRAM_VERSION_MINOR = 62; -const int PROGRAM_VERSION_PATCH = 1; +#ifndef PA_IS_BETA +#define PA_IS_BETA true +#endif + +#ifndef PA_VERSION_MAJOR +#define PA_VERSION_MAJOR 0 +#endif + +#ifndef PA_VERSION_MINOR +#define PA_VERSION_MINOR 62 +#endif + +#ifndef PA_VERSION_PATCH +#define PA_VERSION_PATCH 1 +#endif + +const bool IS_BETA_VERSION = PA_IS_BETA; +const int PROGRAM_VERSION_MAJOR = PA_VERSION_MAJOR; +const int PROGRAM_VERSION_MINOR = PA_VERSION_MINOR; +const int PROGRAM_VERSION_PATCH = PA_VERSION_PATCH; const std::string PROGRAM_VERSION_BASE = "v" + std::to_string(PROGRAM_VERSION_MAJOR) +