Loading .gitignore +5 −2 Original line number Diff line number Diff line build/ .vscode/ __pycache__/ # DLL .vs/ x64/ No newline at end of file .vscode/c_cpp_properties.json 0 → 100644 +24 −0 Original line number Diff line number Diff line { "configurations": [ { "name": "Windows", "configurationProvider": "ms-vscode.cpptools", "intelliSenseMode": "windows-msvc-x64", "includePath": [ "${workspaceFolder}/lib/**", "${workspaceFolder}/MCP2221_DLL/unmanaged/dll/**" ], "windowsSdkVersion": "10.0.22621.0", "compilerPath": "cl.exe", "cStandard": "c17", "cppStandard": "c++20", "browse": { "path": [ "${workspaceFolder}/" ] } } ], "version": 4 } No newline at end of file .vscode/settings.json 0 → 100644 +58 −0 Original line number Diff line number Diff line { "files.associations": { "*.ts": "xml", "*.qrc": "xml", "atomic": "cpp", "bit": "cpp", "cctype": "cpp", "charconv": "cpp", "clocale": "cpp", "cmath": "cpp", "compare": "cpp", "concepts": "cpp", "cstddef": "cpp", "cstdint": "cpp", "cstdio": "cpp", "cstdlib": "cpp", "cstring": "cpp", "ctime": "cpp", "cwchar": "cpp", "exception": "cpp", "format": "cpp", "initializer_list": "cpp", "ios": "cpp", "iosfwd": "cpp", "iostream": "cpp", "istream": "cpp", "iterator": "cpp", "limits": "cpp", "locale": "cpp", "map": "cpp", "memory": "cpp", "new": "cpp", "ostream": "cpp", "stdexcept": "cpp", "streambuf": "cpp", "string": "cpp", "system_error": "cpp", "tuple": "cpp", "type_traits": "cpp", "typeinfo": "cpp", "utility": "cpp", "vector": "cpp", "xfacet": "cpp", "xiosbase": "cpp", "xlocale": "cpp", "xlocbuf": "cpp", "xlocinfo": "cpp", "xlocmes": "cpp", "xlocmon": "cpp", "xlocnum": "cpp", "xloctime": "cpp", "xmemory": "cpp", "xstring": "cpp", "xtr1common": "cpp", "xtree": "cpp", "xutility": "cpp" } } No newline at end of file CMakeLists.txt +44 −29 Original line number Diff line number Diff line cmake_minimum_required(VERSION 3.20) if (NOT UNIX) message(FATAL_ERROR "This project only supports Unix-like systems.") # Function to copy the MCP2221 DLL to the target directory after build function(copy_runtime_dll target) if(WIN32) add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/MCP2221_DLL/unmanaged/dll/mcp2221_dll_um_x64.dll" $<TARGET_FILE_DIR:${target}> COMMENT "Copying MCP2221 DLL to output directory" ) endif() endfunction() # if (NOT UNIX) # message(FATAL_ERROR "This project only supports Unix-like systems.") # endif() option(BUILD_TESTS "Build the tests" ON) project(mcp2221a LANGUAGES C CXX) set(CMAKE_CXX_STANDARD_REQUIRED 20) if (UNIX) include(ExternalProject) set(EXTERNAL_DIR ${CMAKE_CURRENT_BINARY_DIR}/external) ExternalProject_Add( Loading @@ -35,6 +47,9 @@ set(I2C_INCLUDE_DIR ${EXTERNAL_DIR}/i2c-tools/src/include) add_library(i2c STATIC IMPORTED) set_target_properties(i2c PROPERTIES IMPORTED_LOCATION ${I2C_LIB_PATH}) include_directories(${I2C_INCLUDE_DIR}) elseif(WIN32) include_directories(${CMAKE_SOURCE_DIR}/MCP2221_DLL/unmanaged/dll) endif() include_directories(lib) add_subdirectory(lib) Loading CMakePresets.json +16 −1 Original line number Diff line number Diff line Loading @@ -3,13 +3,28 @@ "configurePresets": [ { "name": "default", "hidden": true, "binaryDir": "${sourceDir}/build", "generator": "Unix Makefiles", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_BUILD_TYPE": "Release", "CMAKE_CXX_STANDARD": "20" } }, { "name": "windows", "binaryDir": "${sourceDir}/build", "generator": "Visual Studio 17 2022", "inherits": ["default"], "architecture": { "value": "x64" } }, { "name": "linux", "binaryDir": "${sourceDir}/build", "generator": "Unix Makefiles", "inherits": ["default"] } ] } No newline at end of file Loading
.gitignore +5 −2 Original line number Diff line number Diff line build/ .vscode/ __pycache__/ # DLL .vs/ x64/ No newline at end of file
.vscode/c_cpp_properties.json 0 → 100644 +24 −0 Original line number Diff line number Diff line { "configurations": [ { "name": "Windows", "configurationProvider": "ms-vscode.cpptools", "intelliSenseMode": "windows-msvc-x64", "includePath": [ "${workspaceFolder}/lib/**", "${workspaceFolder}/MCP2221_DLL/unmanaged/dll/**" ], "windowsSdkVersion": "10.0.22621.0", "compilerPath": "cl.exe", "cStandard": "c17", "cppStandard": "c++20", "browse": { "path": [ "${workspaceFolder}/" ] } } ], "version": 4 } No newline at end of file
.vscode/settings.json 0 → 100644 +58 −0 Original line number Diff line number Diff line { "files.associations": { "*.ts": "xml", "*.qrc": "xml", "atomic": "cpp", "bit": "cpp", "cctype": "cpp", "charconv": "cpp", "clocale": "cpp", "cmath": "cpp", "compare": "cpp", "concepts": "cpp", "cstddef": "cpp", "cstdint": "cpp", "cstdio": "cpp", "cstdlib": "cpp", "cstring": "cpp", "ctime": "cpp", "cwchar": "cpp", "exception": "cpp", "format": "cpp", "initializer_list": "cpp", "ios": "cpp", "iosfwd": "cpp", "iostream": "cpp", "istream": "cpp", "iterator": "cpp", "limits": "cpp", "locale": "cpp", "map": "cpp", "memory": "cpp", "new": "cpp", "ostream": "cpp", "stdexcept": "cpp", "streambuf": "cpp", "string": "cpp", "system_error": "cpp", "tuple": "cpp", "type_traits": "cpp", "typeinfo": "cpp", "utility": "cpp", "vector": "cpp", "xfacet": "cpp", "xiosbase": "cpp", "xlocale": "cpp", "xlocbuf": "cpp", "xlocinfo": "cpp", "xlocmes": "cpp", "xlocmon": "cpp", "xlocnum": "cpp", "xloctime": "cpp", "xmemory": "cpp", "xstring": "cpp", "xtr1common": "cpp", "xtree": "cpp", "xutility": "cpp" } } No newline at end of file
CMakeLists.txt +44 −29 Original line number Diff line number Diff line cmake_minimum_required(VERSION 3.20) if (NOT UNIX) message(FATAL_ERROR "This project only supports Unix-like systems.") # Function to copy the MCP2221 DLL to the target directory after build function(copy_runtime_dll target) if(WIN32) add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/MCP2221_DLL/unmanaged/dll/mcp2221_dll_um_x64.dll" $<TARGET_FILE_DIR:${target}> COMMENT "Copying MCP2221 DLL to output directory" ) endif() endfunction() # if (NOT UNIX) # message(FATAL_ERROR "This project only supports Unix-like systems.") # endif() option(BUILD_TESTS "Build the tests" ON) project(mcp2221a LANGUAGES C CXX) set(CMAKE_CXX_STANDARD_REQUIRED 20) if (UNIX) include(ExternalProject) set(EXTERNAL_DIR ${CMAKE_CURRENT_BINARY_DIR}/external) ExternalProject_Add( Loading @@ -35,6 +47,9 @@ set(I2C_INCLUDE_DIR ${EXTERNAL_DIR}/i2c-tools/src/include) add_library(i2c STATIC IMPORTED) set_target_properties(i2c PROPERTIES IMPORTED_LOCATION ${I2C_LIB_PATH}) include_directories(${I2C_INCLUDE_DIR}) elseif(WIN32) include_directories(${CMAKE_SOURCE_DIR}/MCP2221_DLL/unmanaged/dll) endif() include_directories(lib) add_subdirectory(lib) Loading
CMakePresets.json +16 −1 Original line number Diff line number Diff line Loading @@ -3,13 +3,28 @@ "configurePresets": [ { "name": "default", "hidden": true, "binaryDir": "${sourceDir}/build", "generator": "Unix Makefiles", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_BUILD_TYPE": "Release", "CMAKE_CXX_STANDARD": "20" } }, { "name": "windows", "binaryDir": "${sourceDir}/build", "generator": "Visual Studio 17 2022", "inherits": ["default"], "architecture": { "value": "x64" } }, { "name": "linux", "binaryDir": "${sourceDir}/build", "generator": "Unix Makefiles", "inherits": ["default"] } ] } No newline at end of file