Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持使用 CMake 与 MinGW 构建 HMCLauncher #3011

Merged
merged 11 commits into from
Sep 23, 2024
3 changes: 2 additions & 1 deletion HMCLauncher/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Debug
Release
.vs
*.APS
*.APS
cmake-build-*/
17 changes: 17 additions & 0 deletions HMCLauncher/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions HMCLauncher/HMCL/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down