diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84660bd8..eaa5dd21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,7 +105,8 @@ jobs: cp D:/a/Millennium/Millennium/Python-3.11.8/PCbuild/win32/python311.dll D:/a/env/python311.dll cp /d/a/Millennium/Millennium/build/user32.dll D:/a/env/user32.dll mkdir D:/a/env/ext/bin - cp /d/a/Millennium/Millennium/build/cli/millennium.exe D:/a/env/ext/bin/millennium.exe + # Disable Millennium CLI for now, as it keeps get false positive detections for no apparent reason + # cp /d/a/Millennium/Millennium/build/cli/millennium.exe D:/a/env/ext/bin/millennium.exe - name: Upload Build Artifact uses: actions/upload-artifact@v4 diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index 132d3719..3615e5a1 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -5,9 +5,9 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Optimize for size -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -ffunction-sections -fdata-sections -fno-rtti") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s -static -Wl,--gc-sections") -set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -ffunction-sections -fdata-sections -fno-rtti") +# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s -static -Wl,--gc-sections") +# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") @@ -42,13 +42,25 @@ add_executable(CLI ${SOURCES}) set_target_properties(CLI PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") target_compile_options (CLI PRIVATE -m32 ) +find_program(WINDRES windres) +if (WINDRES) + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/version-cli.o + COMMAND ${WINDRES} -i ${CMAKE_SOURCE_DIR}/scripts/cli.version.rc -o ${CMAKE_BINARY_DIR}/version-cli.o + DEPENDS ${CMAKE_SOURCE_DIR}/scripts/cli.version.rc + ) + + add_custom_target(resource-cli DEPENDS ${CMAKE_BINARY_DIR}/version-cli.o) + add_dependencies(CLI resource-cli) +endif() + install(TARGETS CLI DESTINATION /usr/local/bin) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -ffunction-sections -fdata-sections") + # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -ffunction-sections -fdata-sections") # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} Wl,--gc-sections -s") endif() -target_link_libraries(CLI PRIVATE CLI11::CLI11 CURL::libcurl) +target_link_libraries(CLI PRIVATE CLI11::CLI11 CURL::libcurl ${CMAKE_BINARY_DIR}/version-cli.o) set_target_properties(CLI PROPERTIES OUTPUT_NAME "millennium") \ No newline at end of file diff --git a/cli/main.cc b/cli/main.cc index 6490aa2c..2f473dca 100644 --- a/cli/main.cc +++ b/cli/main.cc @@ -176,7 +176,7 @@ class Millennium { int main(int argc, char* argv[]) { #ifdef _WIN32 - SetEnvironmentVariable("SteamPath", GetSteamPathFromRegistry().c_str()); + //SetEnvironmentVariable("SteamPath", GetSteamPathFromRegistry().c_str()); #endif std::unique_ptr millennium = std::make_unique(); diff --git a/scripts/cli.version.rc b/scripts/cli.version.rc new file mode 100644 index 00000000..ee60a8bd --- /dev/null +++ b/scripts/cli.version.rc @@ -0,0 +1,48 @@ +#include + +#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD +#define VER_PRERELEASE VS_FF_PRERELEASE + +#define VER_COMPANYNAME_STR "Steam Homebrew\0" +#define VER_FILEDESCRIPTION_STR "A CLI utility for interacting with Millennium for Steam\0" +#define VER_INTERNALNAME_STR "millennium.exe\0" +#define VER_ORIGINALFILENAME_STR "millennium.exe\0" +#define VER_LEGALCOPYRIGHT_STR "Steam Homebrew 2024\0" +#define VER_LEGALTRADEMARKS1_STR "All Rights Reserved\0" +#define VER_LEGALTRADEMARKS2_STR "\0" +#define VER_PRODUCTNAME_STR "Millennium\0" + +#ifndef DEBUG +#define VER_DEBUG 0 +#else +#define VER_DEBUG VS_FF_DEBUG +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS (VER_PRIVATEBUILD | VER_PRERELEASE | VER_DEBUG) + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", VER_COMPANYNAME_STR + VALUE "FileDescription", VER_FILEDESCRIPTION_STR + VALUE "InternalName", VER_INTERNALNAME_STR + VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR + VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR + VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR + VALUE "ProductName", VER_PRODUCTNAME_STR + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END