Add iOS build to CI

This commit is contained in:
Saúl Ibarra Corretgé 2024-04-12 12:24:18 +02:00 committed by GitHub
parent 38fa7d7cf6
commit bb674c0c3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 22 deletions

View file

@ -597,3 +597,15 @@ jobs:
run: | run: |
$ANDROID_HOME/cmake/3.22.1/bin/cmake --build build --target qjs $ANDROID_HOME/cmake/3.22.1/bin/cmake --build build --target qjs
ls -lh build ls -lh build
ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: configure
run: |
cmake -B build -GXcode -DCMAKE_SYSTEM_NAME:STRING=iOS -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL=NO -DBUILD_QJS_LIBC=ON
- name: build
run: |
cmake --build build --config Release --target qjs
ls -lh build

View file

@ -27,7 +27,7 @@ macro(xcheck_add_c_compiler_flag FLAG)
endmacro() endmacro()
xcheck_add_c_compiler_flag(-Wall) xcheck_add_c_compiler_flag(-Wall)
if(NOT MSVC) if(NOT MSVC AND NOT IOS)
xcheck_add_c_compiler_flag(-Werror) xcheck_add_c_compiler_flag(-Werror)
xcheck_add_c_compiler_flag(-Wextra) xcheck_add_c_compiler_flag(-Wextra)
endif() endif()
@ -167,7 +167,7 @@ endif()
add_library(qjs ${qjs_sources}) add_library(qjs ${qjs_sources})
target_compile_definitions(qjs PRIVATE ${qjs_defines}) target_compile_definitions(qjs PRIVATE ${qjs_defines})
if (CMAKE_BUILD_TYPE MATCHES Debug OR DUMP_LEAKS) if(CMAKE_BUILD_TYPE MATCHES Debug OR DUMP_LEAKS)
target_compile_definitions(qjs PRIVATE target_compile_definitions(qjs PRIVATE
DUMP_LEAKS DUMP_LEAKS
) )
@ -328,24 +328,26 @@ endif()
# Install target # Install target
# #
file(STRINGS quickjs.h quickjs_h REGEX QJS_VERSION) if(NOT IOS)
string(REGEX MATCHALL "([0-9])" QJS_VERSION "${quickjs_h}") file(STRINGS quickjs.h quickjs_h REGEX QJS_VERSION)
list(GET QJS_VERSION 0 QJS_VERSION_MAJOR) string(REGEX MATCHALL "([0-9])" QJS_VERSION "${quickjs_h}")
list(GET QJS_VERSION 1 QJS_VERSION_MINOR) list(GET QJS_VERSION 0 QJS_VERSION_MAJOR)
list(GET QJS_VERSION 2 QJS_VERSION_PATCH) list(GET QJS_VERSION 1 QJS_VERSION_MINOR)
set_target_properties(qjs PROPERTIES list(GET QJS_VERSION 2 QJS_VERSION_PATCH)
VERSION ${QJS_VERSION_MAJOR}.${QJS_VERSION_MINOR}.${QJS_VERSION_PATCH} set_target_properties(qjs PROPERTIES
SOVERSION ${QJS_VERSION_MAJOR} VERSION ${QJS_VERSION_MAJOR}.${QJS_VERSION_MINOR}.${QJS_VERSION_PATCH}
) SOVERSION ${QJS_VERSION_MAJOR}
install(FILES quickjs.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) )
if(BUILD_QJS_LIBC) install(FILES quickjs.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES quickjs-libc.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) if(BUILD_QJS_LIBC)
install(FILES quickjs-libc.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
install(TARGETS qjs_exe RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS qjs EXPORT qjsConfig
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT qjsConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/quickjs)
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY examples DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif() endif()
install(TARGETS qjs_exe RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS qjs EXPORT qjsConfig
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT qjsConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/quickjs)
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY examples DESTINATION ${CMAKE_INSTALL_DOCDIR})