From ea9999a1f93d0adc4f471872bf5ea2d65a84f100 Mon Sep 17 00:00:00 2001 From: YSXX1013 <77004108+YSXX1013@users.noreply.github.com> Date: Tue, 24 Sep 2024 02:51:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8=20CMake=20?= =?UTF-8?q?=E4=B8=8E=20MinGW=20=E6=9E=84=E5=BB=BA=20HMCLauncher=20(#3011)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 尝试性的为HMCLauncher添加cmake及gcc支持 * 完善cmake及gcc支持 * 尝试支持Github Actions * 尝试支持Github Actions-2 * 尝试支持Github Actions-3 * 尝试支持Github Actions-4 * 尝试支持Github Actions-5 * update --------- Co-authored-by: Glavo --- HMCLauncher/.gitignore | 3 ++- HMCLauncher/CMakeLists.txt | 17 +++++++++++++++++ HMCLauncher/HMCL/main.cpp | 4 ++-- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 HMCLauncher/CMakeLists.txt diff --git a/HMCLauncher/.gitignore b/HMCLauncher/.gitignore index df5a7f68f..3b5cac370 100644 --- a/HMCLauncher/.gitignore +++ b/HMCLauncher/.gitignore @@ -1,4 +1,5 @@ Debug Release .vs -*.APS \ No newline at end of file +*.APS +cmake-build-*/ diff --git a/HMCLauncher/CMakeLists.txt b/HMCLauncher/CMakeLists.txt new file mode 100644 index 000000000..c7afc7f3b --- /dev/null +++ b/HMCLauncher/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.25) +project(HMCLauncher) +if(MSVC) + add_compile_options(/utf-8 /D_UNICODE /W4) + add_link_options(/ENTRY:wWinMainCRTStartup) +else() + add_compile_options(-municode -Wall -Wextra -Wpedantic) + add_link_options(-municode) +endif() +OPTION(ENABLE_MINGW_STATIC_LINK_LIBSTDCXX "Link the C++ standard library statically to the executable file(mingw only)." ON) +if(ENABLE_MINGW_STATIC_LINK_LIBSTDCXX AND MINGW) + add_link_options(-static) +endif() +set(CMAKE_WIN32_EXECUTABLE ON) +add_executable(HMCLauncher WIN32 HMCL/HMCL.rc HMCL/java.cpp HMCL/main.cpp HMCL/os.cpp HMCL/stdafx.cpp HMCL/Version.cpp) +target_link_libraries(HMCLauncher Version) +install(TARGETS HMCLauncher) \ No newline at end of file diff --git a/HMCLauncher/HMCL/main.cpp b/HMCLauncher/HMCL/main.cpp index 0d589c168..78bdc48f4 100644 --- a/HMCLauncher/HMCL/main.cpp +++ b/HMCLauncher/HMCL/main.cpp @@ -8,8 +8,8 @@ Version J8(TEXT("8")); extern "C" { -_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; -_declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; +__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; +__declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; } LPCWSTR VENDOR_DIRS[] = {