Skip to content

Commit 17ae532

Browse files
committed
Update build-aux setup scripts.
修改: .github/workflows/test.yml 修改: CMakeLists.txt 修改: setup.cmd 修改: setup.sh
1 parent d477996 commit 17ae532

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,22 @@ jobs:
2121
sudo apt-get update
2222
sudo apt-get install gcc cmake -y
2323
24+
- name: Setup build-aux
25+
run: |
26+
./setup.sh
27+
2428
#--------------------------------------------build--------------------------------------------
2529
- name: Build
2630
run : |
27-
mkdir build
31+
mkdir -p build
2832
cd build
2933
cmake .. -DENABLE_EXTRA=ON -DENABLE_TEST=ON
34+
cmake --build .
3035
3136
#--------------------------------------------test--------------------------------------------
3237
- name: Test
3338
run : |
34-
ctest --verbose --output-on-failure
35-
39+
ctest --verbose
3640
3741
test-macos:
3842

@@ -46,7 +50,7 @@ jobs:
4650
run: |
4751
brew install cmake -y
4852
49-
- name: Setup repos
53+
- name: Setup build-aux
5054
run : |
5155
./setup.sh
5256
@@ -56,8 +60,9 @@ jobs:
5660
mkdir build
5761
cd build
5862
cmake .. -DENABLE_EXTRA=ON -DENABLE_TEST=ON
63+
cmake --build .
5964
6065
#--------------------------------------------test--------------------------------------------
6166
- name: Test
6267
run : |
63-
ctest --verbose --output-on-failure
68+
ctest --verbose

CMakeLists.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,19 @@ option(ENABLE_EXTRA "Enable extra encodings and features." OFF)
2424
# Set C++ standard
2525
set(CMAKE_CXX_STANDARD 11)
2626

27-
include("${CMAKE_SOURCE_DIR}/build-aux/cmake/cppp.cmake")
27+
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/build-aux")
28+
set(BUILD_AUX "${CMAKE_CURRENT_SOURCE_DIR}/build-aux")
29+
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../build-aux")
30+
set(BUILD_AUX "${CMAKE_CURRENT_SOURCE_DIR}/../build-aux")
31+
else()
32+
message(FATAL_ERROR "CMake build-aux directory is not exists, try to execute 'setup.cmd' or './setup.sh' to get it.")
33+
endif()
34+
set(AUX_DIR "${BUILD_AUX}/cmake")
35+
36+
message(STATUS "Using '${BUILD_AUX}' for C++ Plus build-aux directory.")
37+
add_subdirectory("${BUILD_AUX}")
38+
39+
include("${AUX_DIR}/cppp.cmake")
2840

2941
check_have_visibility()
3042

setup.cmd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ if exist ..\build-aux (
3131
)
3232

3333
echo Notice: '..\build-aux' for C++ Plus are not exists, cloning it......
34-
echo Notice: It will be cloned to '.\build-aux' and ignored by '.gitignore', if you 'git clean' this project, The '.\build-aux' may be deleted, and you will need to rerun this script to adapt to your environment at that time.
3534
git clone https://github.com/cppp-project/build-aux
3635
if %errorlevel%==0 (
3736
echo Success: '.\build-aux' cloned successfully, please don't remove it, and you can develop this package normally.

setup.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ then
4848
fi
4949

5050
text_out 0 "Notice" "'../build-aux' for C++ Plus are not exists, cloning it......"
51-
text_out 0 "Notice" "It will be cloned to './build-aux' and ignored by '.gitignore', if you 'git clean' this project, The './build-aux' may be deleted, and you will need to rerun this script to adapt to your environment at that time."
5251
execute "git clone https://github.com/cppp-project/build-aux"
5352
if [ $? -eq 0 ]
5453
then

0 commit comments

Comments
 (0)