Skip to content

Commit 5cfa669

Browse files
authored
Merge pull request #679 from sanpeqf/feat-port
Feat port
2 parents 335aaac + 6d8df22 commit 5cfa669

4 files changed

Lines changed: 108 additions & 38 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: build default on generic arm gcc
2+
3+
on:
4+
repository_dispatch:
5+
workflow_dispatch:
6+
push:
7+
pull_request:
8+
schedule:
9+
- cron: '0 */2 * * *'
10+
11+
env:
12+
BUILD_TYPE: Release
13+
14+
jobs:
15+
build:
16+
name: Test on ${{matrix.os}}
17+
runs-on: ${{matrix.os}}
18+
strategy:
19+
matrix:
20+
os: [ubuntu-22.04]
21+
22+
steps:
23+
- name: checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: install dependencies
29+
run: |
30+
sudo apt update
31+
sudo apt install cmake make \
32+
gcc gcc-arm-none-eabi
33+
34+
- name: configure cmake
35+
run: |
36+
cmake -B ${{github.workspace}}/build \
37+
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install \
38+
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
39+
-D CMAKE_C_COMPILER=arm-none-eabi-gcc \
40+
-D CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \
41+
-D CMAKE_SYSTEM_NAME=Generic \
42+
-D HOST_C_COMPILER=gcc \
43+
-D BFDEV_STRICT=ON \
44+
-D BFDEV_BUILD_SHARED=OFF
45+
46+
- name: make
47+
run: |
48+
cmake --build ${{github.workspace}}/build \
49+
--config ${{env.BUILD_TYPE}}
50+
51+
- name: install
52+
run: |
53+
cmake --build ${{github.workspace}}/build \
54+
--config ${{env.BUILD_TYPE}} -- install

CMakeLists.txt

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ option(BFDEV_DEVEL "Enable development mode" OFF)
5555
option(BFDEV_STRICT "Enable strict compilation" OFF)
5656
option(BFDEV_EXAMPLES "Build examples" OFF)
5757
option(BFDEV_TESTSUITE "Build testsuite" OFF)
58-
option(BFDEV_DOCS "Install Documentation" OFF)
58+
59+
option(BFDEV_BUILD_STATIC "Build Static Library" ON)
60+
option(BFDEV_BUILD_SHARED "Build Shared Library" ON)
61+
option(BFDEV_INSTALL_HEADERS "Install Headers" ON)
62+
option(BFDEV_INSTALL_DOCS "Install Documentation" OFF)
5963

6064
option(BFDEV_ASAN "Enable Address Sanitizer" OFF)
6165
option(BFDEV_UBSAN "Enable Undefined Behaviour Sanitizer" OFF)
@@ -75,7 +79,7 @@ if(BFDEV_DEVEL)
7579
set(BFDEV_STRICT ON)
7680
set(BFDEV_EXAMPLES ON)
7781
set(BFDEV_TESTSUITE ON)
78-
set(BFDEV_DOCS ON)
82+
set(BFDEV_INSTALL_DOCS ON)
7983
set(BFDEV_ASAN ON)
8084
set(BFDEV_UBSAN ON)
8185
set(BFDEV_GCOV ON)
@@ -158,43 +162,59 @@ if(BFDEV_TESTSUITE)
158162
endif()
159163

160164
if(${CMAKE_PROJECT_NAME} STREQUAL "bfdev")
161-
add_library(bfdev_static STATIC ${BFDEV_LIBRARY})
162-
add_library(bfdev_shared SHARED ${BFDEV_LIBRARY})
165+
if(BFDEV_BUILD_STATIC)
166+
add_library(bfdev_static STATIC ${BFDEV_LIBRARY})
167+
bfdev_dependencies(bfdev_static)
168+
169+
set_target_properties(bfdev_static
170+
PROPERTIES
171+
OUTPUT_NAME ${PROJECT_NAME}
172+
LINKER_LANGUAGE C
173+
)
163174

164-
bfdev_dependencies(bfdev_static)
165-
bfdev_dependencies(bfdev_shared)
175+
install(TARGETS
176+
bfdev_static
177+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
178+
)
179+
endif()
166180

167-
set_target_properties(bfdev_static
168-
PROPERTIES
169-
OUTPUT_NAME ${PROJECT_NAME}
170-
LINKER_LANGUAGE C
171-
)
181+
if(BFDEV_BUILD_SHARED)
182+
add_library(bfdev_shared SHARED ${BFDEV_LIBRARY})
183+
bfdev_dependencies(bfdev_shared)
184+
185+
set_target_properties(bfdev_shared
186+
PROPERTIES
187+
OUTPUT_NAME ${PROJECT_NAME}
188+
VERSION ${PROJECT_VERSION}
189+
SOVERSION ${PROJECT_VERSION_MAJOR}
190+
LINKER_LANGUAGE C
191+
MACOSX_RPATH ON
192+
)
172193

173-
set_target_properties(bfdev_shared
174-
PROPERTIES
175-
OUTPUT_NAME ${PROJECT_NAME}
176-
VERSION ${PROJECT_VERSION}
177-
SOVERSION ${PROJECT_VERSION_MAJOR}
178-
LINKER_LANGUAGE C
179-
MACOSX_RPATH ON
180-
)
194+
install(TARGETS
195+
bfdev_shared
196+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
197+
)
198+
endif()
181199

182-
install(FILES
183-
${BFDEV_CONFIGURE}
184-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/bfdev
185-
)
200+
if(BFDEV_INSTALL_HEADERS)
201+
install(FILES
202+
${BFDEV_CONFIGURE}
203+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/bfdev
204+
)
186205

187-
install(FILES
188-
${BFDEV_EXPORT_PATH}/bfdev.h
189-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
190-
)
206+
install(FILES
207+
${BFDEV_EXPORT_PATH}/bfdev.h
208+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
209+
)
191210

192-
install(DIRECTORY
193-
${BFDEV_EXPORT_PATH}/bfdev
194-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
195-
)
211+
install(DIRECTORY
212+
${BFDEV_EXPORT_PATH}/bfdev
213+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
214+
)
215+
endif()
196216

197-
if(BFDEV_DOCS)
217+
if(BFDEV_INSTALL_DOCS)
198218
install(FILES
199219
${PROJECT_SOURCE_DIR}/README.md
200220
${PROJECT_SOURCE_DIR}/AUTHORS
@@ -208,10 +228,4 @@ if(${CMAKE_PROJECT_NAME} STREQUAL "bfdev")
208228
DESTINATION ${CMAKE_INSTALL_DOCDIR}
209229
)
210230
endif()
211-
212-
install(TARGETS
213-
bfdev_static bfdev_shared
214-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
215-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
216-
)
217231
endif()

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ bfdev is a high-performance, aesthetically pleasing, and portable infrastructure
1818
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-aarch64-gcc.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-aarch64-gcc.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-aarch64-gcc.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-aarch64-gcc.yml?query=branch%3Adevel) | Cross build AArch64 default on Ubuntu GCC |
1919
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips-gcc.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips-gcc.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips-gcc.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips-gcc.yml?query=branch%3Adevel) | Cross build MIPS default on Ubuntu GCC |
2020
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips64-gcc.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips64-gcc.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips64-gcc.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips64-gcc.yml?query=branch%3Adevel) | Cross build MIPS64 default on Ubuntu GCC |
21+
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/generic-arm-gcc.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/generic-arm-gcc.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/generic-arm-gcc.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/generic-arm-gcc.yml?query=branch%3Adevel) | Cross build ARM default on Generic GCC |
2122
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml?query=branch%3Adevel) | Code analyse on codeql |
2223

2324
## Why Choose

port/posix/build.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ check_symbol_and_exit("stdlib.h" "abort")
3535

3636
# string
3737
check_symbol_and_exit("string.h" "memcpy")
38+
check_symbol_and_exit("string.h" "memmove")
3839
check_symbol_and_exit("string.h" "memset")
3940
check_symbol_and_exit("string.h" "memcmp")
4041
check_symbol_and_exit("string.h" "strcmp")

0 commit comments

Comments
 (0)