Revamp: Transition HarmonyLink to C++ with DLL support
This transformative commit marks the evolution of HarmonyLink from a Rust-based server-side application to a C++ implemented, C-compatible dynamic link library (DLL). We've restructured the codebase to streamline integration into games, eliminating the need for a server setup by end-users. Key Changes: - Introduced .gitattributes and .gitmodules to manage new dependencies and collaborations. - Replaced the GitHub workflow files with CMake configurations to support the new C++ build system. - Introduced a comprehensive set of header and implementation files defining the core functionality, platform-specific utilities, and cross-platform compatibility layers. - Removed all Rust-specific files (Cargo.toml, Cargo.lock, etc.) and references to ensure a clean transition to the C++ environment. - Implemented new testing mechanisms within HarmonyLinkTest to ensure robustness and reliability of the DLL. - Excised previous server-side components and models to focus on the DLL's direct integration into consumer applications. This update is a direct response to community feedback, showcasing our commitment to adaptability and innovation. HarmonyLink 2.0 is now more accessible, efficient, and tailored for diverse gaming environments, providing developers with an unparalleled level of hardware-software harmony. Please refer to the updated README for more details on the new structure and how to integrate HarmonyLink 2.0 into your projects.
This commit is contained in:
parent
d13fc728df
commit
6bf68eb298
60 changed files with 1629 additions and 2389 deletions
129
HarmonyLinkLib/CMakeLists.txt
Normal file
129
HarmonyLinkLib/CMakeLists.txt
Normal file
|
@ -0,0 +1,129 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
project(HarmonyLinkLib VERSION 2.0.0)
|
||||
|
||||
# Find the current Git branch and the last commit timestamp
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} log -1 --format=%ct
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_TIMESTAMP
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else()
|
||||
set(GIT_BRANCH_NAME "Unknown")
|
||||
set(GIT_COMMIT_TIMESTAMP "Unknown")
|
||||
endif()
|
||||
|
||||
configure_file(include/Version.h.in Version.generated.h)
|
||||
|
||||
# Specify the C++ standard
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
# Explicitly list source files
|
||||
set(COMMON_SOURCES
|
||||
"src/Platform/IPlatformUtilities.cpp"
|
||||
"src/HarmonyLinkLib.cpp"
|
||||
"src/Version.cpp"
|
||||
"src/dllmain.cpp"
|
||||
"src/Platform/WineUtilities.cpp"
|
||||
)
|
||||
|
||||
# Explicitly list include files
|
||||
set(COMMON_INCLUDES
|
||||
"include/Core.h"
|
||||
"include/Structs/FBattery.h"
|
||||
"include/Structs/FOSVerInfo.h"
|
||||
"include/Structs/FDevice.h"
|
||||
"include/Structs/FCPUInfo.h"
|
||||
|
||||
"include/Enums/EDevice.h"
|
||||
"include/Enums/EPlatform.h"
|
||||
|
||||
"include/FString.h"
|
||||
"include/HarmonyLinkLib.h"
|
||||
"include/Version.h"
|
||||
|
||||
"src/Platform/IPlatformUtilities.h"
|
||||
"src/Platform/WineUtilities.h"
|
||||
)
|
||||
|
||||
set(WINDOWS_SOURCES
|
||||
"src/Platform/Windows/WindowsUtilities.cpp"
|
||||
)
|
||||
|
||||
set(WINDOWS_INCLUDES
|
||||
"src/Platform/Windows/WindowsUtilities.h"
|
||||
)
|
||||
|
||||
set(LINUX_SOURCES
|
||||
"src/Platform/Unix/Linux/LinuxUtilities.cpp"
|
||||
"src/Platform/Unix/UnixUtilities.cpp"
|
||||
)
|
||||
|
||||
set(LINUX_INCLUDES
|
||||
"src/Platform/Unix/Linux/LinuxUtilities.h"
|
||||
"src/Platform/Unix/UnixUtilities.h"
|
||||
)
|
||||
|
||||
set(MAC_SOURCES
|
||||
"src/Platform/Unix/Mac/MacUtilities.cpp"
|
||||
"src/Platform/Unix/UnixUtilities.cpp"
|
||||
)
|
||||
|
||||
set(MAC_INCLUDES
|
||||
"src/Platform/Unix/Mac/MacUtilities.h"
|
||||
"src/Platform/Unix/UnixUtilities.h"
|
||||
)
|
||||
|
||||
# Platform-specific definitions
|
||||
if(WIN32)
|
||||
message(STATUS "Compiling for Windows...")
|
||||
list(APPEND LIB_SOURCES ${COMMON_SOURCES} ${WINDOWS_SOURCES})
|
||||
list(APPEND LIB_INCLUDES ${COMMON_INCLUDES} ${WINDOWS_INCLUDES})
|
||||
elseif(UNIX)
|
||||
message(STATUS "Compiling for Unix-based systems...")
|
||||
if(APPLE)
|
||||
message(STATUS "Compiling for Mac...")
|
||||
list(APPEND LIB_SOURCES ${COMMON_SOURCES} ${MAC_SOURCES})
|
||||
list(APPEND LIB_INCLUDES ${COMMON_INCLUDES} ${MAC_INCLUDES})
|
||||
else()
|
||||
message(STATUS "Compiling for Linux...")
|
||||
list(APPEND LIB_SOURCES ${COMMON_SOURCES} ${LINUX_SOURCES})
|
||||
list(APPEND LIB_INCLUDES ${COMMON_INCLUDES} ${LINUX_INCLUDES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Add library
|
||||
add_library(HarmonyLinkLib SHARED ${LIB_SOURCES} ${LIB_INCLUDES})
|
||||
|
||||
target_include_directories(HarmonyLinkLib
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/src"
|
||||
PUBLIC
|
||||
"${PROJECT_BINARY_DIR}"
|
||||
"${PROJECT_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
target_compile_definitions(HarmonyLinkLib PRIVATE HARMONYLINKLIB_EXPORTS)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
target_compile_definitions(HarmonyLinkLib PRIVATE "DEBUG_MODE")
|
||||
endif()
|
||||
|
||||
# Set output directories for all build types
|
||||
foreach(TYPE IN ITEMS DEBUG RELEASE)
|
||||
string(TOUPPER ${TYPE} TYPE_UPPER)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY_${TYPE_UPPER} "${CMAKE_BINARY_DIR}/bin/${TYPE}/${PROJECT_NAME}"
|
||||
LIBRARY_OUTPUT_DIRECTORY_${TYPE_UPPER} "${CMAKE_BINARY_DIR}/lib/${TYPE}/${PROJECT_NAME}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_${TYPE_UPPER} "${CMAKE_BINARY_DIR}/archive/${TYPE}/${PROJECT_NAME}"
|
||||
)
|
||||
endforeach()
|
Loading…
Add table
Add a link
Reference in a new issue