Skip to content

Commit 75aa425

Browse files
docs: Update README.md
1 parent 2cf7aac commit 75aa425

2 files changed

Lines changed: 22 additions & 52 deletions

File tree

README.md

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,15 @@ target_link_libraries(hello_original PRIVATE original)
4545
```
4646
方法二 使用Cmake本地构建、安装:
4747

48-
在该项目文件夹下新建文件夹`build`并进入
48+
在本项目文件夹下运行下列命令
4949
```shell
50-
mkdir build
51-
cd build
50+
cmake -P install.cmake
5251
```
53-
利用cmake构建库:
54-
```shell
55-
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF
56-
cmake --build . --config Debug
57-
cmake --install . --config Debug
58-
```
59-
将生成的`build``install`文件夹复制到项目`hello_original`中。
52+
将生成的`original`文件夹复制到项目`hello_original`中。
6053

6154
复制后项目的结构如下:
6255
```text
63-
├─build
64-
├─install
56+
├─original
6557
├─CMakeLists.txt
6658
└─main.cpp
6759
```
@@ -72,15 +64,13 @@ cmake_minimum_required(VERSION 3.30)
7264
project(hello_original)
7365
7466
set(CMAKE_CXX_STANDARD 20)
67+
set(CMAKE_CXX_STANDARD_REQUIRED True)
7568
76-
set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/install/cmake")
77-
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/install/cmake/original")
78-
69+
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/original")
7970
find_package(original REQUIRED)
8071
8172
add_executable(hello_original main.cpp)
82-
83-
target_link_libraries(hello_original PRIVATE "${ORIGINAL_LIBRARIES}")
73+
target_link_libraries(hello_original PRIVATE original)
8474
```
8575

8676
接下来展示测试Demo:
@@ -90,27 +80,22 @@ target_link_libraries(hello_original PRIVATE "${ORIGINAL_LIBRARIES}")
9080
#include <iostream>
9181
#include "original.h"
9282

93-
9483
int main() {
95-
std::cout << "Hello, Original!" << std::endl;
96-
auto a1 = original::array({"Hello, Original!"});
97-
std::cout << a1 << std::endl;
98-
printf("%s\n", static_cast<const char*>(a1));
84+
const original::array a = {"hello world!"};
85+
std::cout << a << std::endl;
9986
return 0;
10087
}
10188
```
10289
输出:
10390
```text
104-
Hello, original!
105-
array("Hello, original!")
106-
array("Hello, original!")
91+
array("hello world!")
10792
```
10893

10994
## 模块进度
11095

11196
#### Core
11297

113-
正在实现中。已实现部分:
98+
包含基本算法、容器等工具。
11499

115100
##### 容器:
116101

docs/index.md

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,15 @@ target_link_libraries(hello_original PRIVATE original)
5454
```
5555
方法二 使用Cmake本地构建、安装:
5656

57-
在该项目文件夹下新建文件夹`build`并进入
57+
在本项目文件夹下运行下列命令
5858
```shell
59-
mkdir build
60-
cd build
59+
cmake -P install.cmake
6160
```
62-
利用cmake构建库:
63-
```shell
64-
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF
65-
cmake --build . --config Debug
66-
cmake --install . --config Debug
67-
```
68-
将生成的`build``install`文件夹复制到项目`hello_original`中。
61+
将生成的`original`文件夹复制到项目`hello_original`中。
6962

7063
复制后项目的结构如下:
7164
```text
72-
├─build
73-
├─install
65+
├─original
7466
├─CMakeLists.txt
7567
└─main.cpp
7668
```
@@ -81,15 +73,13 @@ cmake_minimum_required(VERSION 3.30)
8173
project(hello_original)
8274
8375
set(CMAKE_CXX_STANDARD 20)
76+
set(CMAKE_CXX_STANDARD_REQUIRED True)
8477
85-
set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/install/cmake")
86-
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/install/cmake/original")
87-
78+
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/original")
8879
find_package(original REQUIRED)
8980
9081
add_executable(hello_original main.cpp)
91-
92-
target_link_libraries(hello_original PRIVATE "${ORIGINAL_LIBRARIES}")
82+
target_link_libraries(hello_original PRIVATE original)
9383
```
9484

9585
接下来展示测试Demo:
@@ -99,27 +89,22 @@ target_link_libraries(hello_original PRIVATE "${ORIGINAL_LIBRARIES}")
9989
#include <iostream>
10090
#include "original.h"
10191

102-
10392
int main() {
104-
std::cout << "Hello, Original!" << std::endl;
105-
auto a1 = original::array({"Hello, Original!"});
106-
std::cout << a1 << std::endl;
107-
printf("%s\n", static_cast<const char*>(a1));
93+
const original::array a = {"hello world!"};
94+
std::cout << a << std::endl;
10895
return 0;
10996
}
11097
```
11198
输出:
11299
```text
113-
Hello, original!
114-
array("Hello, original!")
115-
array("Hello, original!")
100+
array("hello world!")
116101
```
117102

118103
## 模块进度
119104

120105
#### Core
121106

122-
正在实现中。已实现部分:
107+
包含基本算法、容器等工具。
123108

124109
##### 容器:
125110

0 commit comments

Comments
 (0)