Skip to content

Commit f95c4ac

Browse files
authored
Merge pull request #3 from hardingadonis/feature/cmake
Enhance: Implement CMake and more to your project
2 parents 14cf30b + 7d53141 commit f95c4ac

File tree

16 files changed

+445
-187
lines changed

16 files changed

+445
-187
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: windows-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup MSVC Developer Command Prompt
20+
uses: TheMrMilchmann/setup-msvc-dev@v3
21+
with:
22+
arch: x64
23+
24+
- name: Install ninja-build tool
25+
uses: seanmiddleditch/gha-setup-ninja@v5
26+
27+
- name: Build project
28+
run: |
29+
mkdir build
30+
cd build
31+
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel
32+
cmake --build . --target install --config MinSizeRel
33+
34+
- name: Zip the build
35+
run: |
36+
cd install
37+
7z a ../Operating-System-Project.x64.zip *
38+
39+
- name: GH Release
40+
uses: softprops/action-gh-release@v2
41+
with:
42+
name: Operating-System-Project
43+
tag_name: 1.0.0
44+
files: |
45+
Operating-System-Project.x64.zip

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Ẩn tất cả các file có đuôi .exe (file thực thi)
2-
# *.exe -> Phiên bản mới: Cho phép tải về file thực thi
2+
*.exe
33

44
# Ẩn thư mục .vscode
5-
# .vscode/ -> Phiên bản mới: Cho phép tải về thư mục .vscode
5+
.vscode/
66

77
# Ẩn file lịch sử và mọi thứ liên quan
88
history.txt
@@ -12,4 +12,8 @@ hello.txt
1212
.image/
1313

1414
# Ẩn thư mục Private
15-
Private/
15+
Private/
16+
17+
build/
18+
out/
19+
install/

.vscode/c_cpp_properties.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 0 additions & 120 deletions
This file was deleted.

.vscode/tasks.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cmake_minimum_required(VERSION 3.10.2)
2+
3+
project(Operating-System-Project VERSION 1.0.0)
4+
5+
set(CMAKE_CXX_STANDARD 17)
6+
set(CMAKE_CXX_STANDARD_REQUIRED True)
7+
8+
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
9+
10+
add_executable(Operating-System-Project main.cpp)
11+
add_definitions(-DNOMINMAX)
12+
13+
install(TARGETS Operating-System-Project RUNTIME DESTINATION .)
14+
15+
add_subdirectory(Process)
16+
17+
install(DIRECTORY Testcase/ DESTINATION Testcase FILES_MATCHING PATTERN "*")
18+
19+
install(DIRECTORY Document/ DESTINATION Document FILES_MATCHING PATTERN "*")

Process/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cmake_minimum_required(VERSION 3.10.2)
2+
3+
file(GLOB PROCESS_SOURCES *.cpp *.c)
4+
5+
foreach(SOURCE_FILE ${PROCESS_SOURCES})
6+
get_filename_component(EXECUTABLE_NAME ${SOURCE_FILE} NAME_WE)
7+
8+
add_executable(${EXECUTABLE_NAME} ${SOURCE_FILE})
9+
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
10+
11+
install(TARGETS ${EXECUTABLE_NAME} RUNTIME DESTINATION Process)
12+
endforeach()
13+
14+
set_target_properties(countdown PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")

Process/child.exe

-130 KB
Binary file not shown.

Process/countdown.exe

-256 KB
Binary file not shown.

Process/counter.exe

-55 KB
Binary file not shown.

0 commit comments

Comments
 (0)