-
Notifications
You must be signed in to change notification settings - Fork 1.4k
chore: add CMake support for MinGW-w64 environment #393
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| cmake_minimum_required(VERSION 3.15) | ||
|
|
||
| # Common compiler flags | ||
| # 设置 C 语言标准为 C17 | ||
| set(CMAKE_C_STANDARD 17) | ||
| # 确保要求该标准为必须 | ||
| # set(CMAKE_C_STANDARD_REQUIRED ON) | ||
| # 默认情况下禁用 GNU 扩展 | ||
| set(CMAKE_C_EXTENSIONS OFF) | ||
| # 设置 C++ 语言标准为 C++17 | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| # set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
|
||
| # 集成vcpkg | ||
| set(VCPKG_TARGET_TRIPLET "x64-mingw-static" CACHE STRING "Vcpkg target triplet") | ||
| set(VCPKG_HOST_TRIPLET "x64-mingw-static" CACHE STRING "Vcpkg host triplet") | ||
| set(VCPKG_MANIFEST_MODE ON CACHE BOOL "Enable manifest mode") | ||
|
|
||
| if(DEFINED ENV{VCPKG_ROOT}) | ||
| set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") | ||
| else() | ||
| set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") | ||
| endif() | ||
|
|
||
| # include(FetchContent) | ||
| # include(ExternalProject) | ||
|
|
||
| project(WeChatFerry LANGUAGES C CXX) | ||
|
|
||
| add_compile_options( | ||
| -Wall | ||
| -Wextra | ||
| -fPIC | ||
| ) | ||
|
|
||
| add_link_options( | ||
| -static | ||
| ) | ||
|
|
||
| # Include directories | ||
| include_directories( | ||
| ${CMAKE_SOURCE_DIR}/com | ||
| ${CMAKE_SOURCE_DIR}/rpc | ||
| ${CMAKE_SOURCE_DIR}/rpc/nanopb | ||
| ${CMAKE_SOURCE_DIR}/rpc/proto | ||
| ${CMAKE_SOURCE_DIR}/sdk | ||
| ${CMAKE_SOURCE_DIR}/spy | ||
| ${CMAKE_SOURCE_DIR}/smc | ||
| ) | ||
|
|
||
| # Add subdirectories | ||
|
|
||
| add_subdirectory(sdk) | ||
| add_subdirectory(spy) | ||
|
|
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # SDK project - dynamic library | ||
| project(SDK LANGUAGES C CXX) | ||
|
|
||
| find_package(spdlog REQUIRED) | ||
|
|
||
| add_library(sdk SHARED | ||
| dllmain.cpp | ||
| injector.cpp | ||
| injector.h | ||
| sdk.cpp | ||
| sdk.h | ||
| sdk.def | ||
|
|
||
| # Common files | ||
| ${CMAKE_SOURCE_DIR}/com/util.cpp | ||
| ${CMAKE_SOURCE_DIR}/com/util.h | ||
| ) | ||
|
|
||
| target_link_libraries(sdk PRIVATE | ||
| version | ||
| shlwapi | ||
| spdlog::spdlog | ||
| c++ | ||
| ) | ||
|
|
||
| # Set compiler definitions | ||
| target_compile_definitions(sdk PRIVATE | ||
| SDK_EXPORTS | ||
| _WINDOWS | ||
| _USRDLL | ||
| ) | ||
|
|
||
| # add_compile_options( | ||
| # # -Wall | ||
| # -fPIC | ||
| # # -fms-extensions | ||
| # ) | ||
| # Set output name for debug builds | ||
| set_target_properties(sdk PROPERTIES | ||
| DEBUG_POSTFIX "d" | ||
| ) | ||
|
|
||
| # # Post-build copy commands | ||
| # add_custom_command(TARGET sdk POST_BUILD | ||
| # COMMAND ${CMAKE_COMMAND} -E copy | ||
| # $<TARGET_FILE:sdk> | ||
| # ${CMAKE_SOURCE_DIR}/Out | ||
| # COMMAND ${CMAKE_COMMAND} -E copy | ||
| # $<TARGET_FILE:sdk> | ||
| # ${CMAKE_SOURCE_DIR}/../clients/python/wcferry | ||
| # COMMAND ${CMAKE_COMMAND} -E copy | ||
| # ${CMAKE_SOURCE_DIR}/DISCLAIMER.md | ||
| # ${CMAKE_SOURCE_DIR}/Out | ||
| # COMMAND ${CMAKE_COMMAND} -E copy | ||
| # ${CMAKE_SOURCE_DIR}/DISCLAIMER.md | ||
| # ${CMAKE_SOURCE_DIR}/../clients/python/wcferry | ||
| # ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| EXPORTS | ||
| EXPORTS | ||
| WxInitSDK | ||
| WxDestroySDK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| #pragma once | ||
|
|
||
| int WxInitSDK(bool debug, int port); | ||
| int WxDestroySDK(); | ||
| extern "C" { | ||
| __declspec(dllexport) int WxInitSDK(bool debug, int port); | ||
| __declspec(dllexport) int WxDestroySDK(); | ||
| } |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.