From b1ff6caae21dbaf6b8940780253266edaeac945c Mon Sep 17 00:00:00 2001
From: sola.lu <sola.lu@greentest.com.cn>
Date: 周五, 11 4月 2025 15:16:01 +0800
Subject: [PATCH] greentest revision

---
 .gitignore     |    5 +++++
 vcpkg.json     |    7 +++++++
 CMakeLists.txt |   44 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index ab2dd72..1ca19bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,8 @@
 *.gcno
 *.gcda
 *.gcov
+
+*.idx
+
+build/
+.vscode/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..a2093b1
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,44 @@
+cmake_minimum_required(VERSION 3.21)
+project(libscpi VERSION 2.1.0 LANGUAGES C)
+
+file(GLOB_RECURSE SRC_FILES
+    libscpi/inc/*.h
+    libscpi/src/*.c
+)
+
+add_library(scpi_static STATIC ${SRC_FILES})
+
+target_include_directories(scpi_static
+    PUBLIC
+        "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libscpi/inc>"
+)
+
+add_library(scpi SHARED ${SRC_FILES})
+
+target_include_directories(scpi
+    PUBLIC
+        "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libscpi/inc>"
+)
+
+enable_testing()
+find_package(unofficial-cunit CONFIG REQUIRED)
+
+file(GLOB_RECURSE TEST_FILES
+    libscpi/test/*.c
+)
+foreach(test_file IN LISTS TEST_FILES)
+    cmake_path(GET test_file FILENAME test_name)
+
+    add_executable(${test_name} ${test_file})
+
+    target_link_libraries(${test_name} 
+        PRIVATE 
+            scpi_static
+            unofficial::cunit::cunit
+    )
+
+    add_test(
+        NAME "${test_name}"
+        COMMAND ${test_name}
+    )
+endforeach()
diff --git a/vcpkg.json b/vcpkg.json
new file mode 100644
index 0000000..3453109
--- /dev/null
+++ b/vcpkg.json
@@ -0,0 +1,7 @@
+{
+    "name": "scpi-parser",
+    "version": "2.1.0",
+    "dependencies": [
+        "cunit"
+    ]
+}
\ No newline at end of file

--
Gitblit v1.9.1