Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7b7fcd8

Browse files
committed
Add openleetcode.sh for UNIX-like OS
1 parent 8fb9116 commit 7b7fcd8

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

‎README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ cmake --install build --config Debug
1111
```
1212

1313
### Run
14+
#### Windows Terminal
1415
```cmd
1516
./problem_builds/openleetcode --problem_builds_dir ./problem_builds --language cpp --problem TwoSum
1617
```
18+
#### Unix
19+
```bash
20+
./problem_builds/openleetcode.sh --problem_builds_dir ./problem_builds --language cpp --problem TwoSum
21+
```
1722

1823
## How To Use
1924
The above example runs **TwoSum** problem using **C++**.

‎data/languages/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ endif()
2121
project(solution
2222
DESCRIPTION "Open Source version of LeetCode"
2323
LANGUAGES CXX
24-
)
24+
)
2525

2626
include(FetchContent)
2727

‎src/app/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,29 @@ set(WINDOWS_SCRIPTS
99
openleetcode.bat
1010
)
1111

12+
set(UNIX_SCRIPTS
13+
openleetcode.sh
14+
)
15+
1216
if (WIN32)
1317
foreach(WINDOWS_SCRIPT IN LISTS WINDOWS_SCRIPTS)
1418
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${WINDOWS_SCRIPT} ${PROJECT_BUILDS_DIR}/${WINDOWS_SCRIPT} COPYONLY)
1519
endforeach()
20+
elseif (UNIX)
21+
foreach(UNIX_SCRIPT IN LISTS UNIX_SCRIPTS)
22+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${UNIX_SCRIPT} ${PROJECT_BUILDS_DIR}/${UNIX_SCRIPT} COPYONLY)
23+
endforeach()
24+
25+
add_custom_target(
26+
make_openleetcode_executable ALL
27+
DEPENDS ${PROJECT_BUILDS_DIR}/openleetcode.sh
28+
)
29+
30+
add_custom_command(
31+
TARGET make_openleetcode_executable
32+
POST_BUILD
33+
COMMAND chmod +x ${PROJECT_BUILDS_DIR}/openleetcode.sh
34+
)
1635
endif()
1736

1837
foreach(PYTHON_SCRIPT IN LISTS PYTHON_SCRIPTS)

‎src/app/openleetcode.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
python3 "$(dirname "0ドル")/openleetcode.py" "$@"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /