Skip to content

Commit

Permalink
Fixes for iOS build
Browse files Browse the repository at this point in the history
Tested:
- Windows build
- Android (Old Arch) build on Windows
- iOS (Old Arch) build

Presumably works:
- Android (Old Arch) build on Ubuntu
- Android (New Arch) build on Ubuntu

Broken:
- Android (New Arch) build on Windows; but I believe, it is due to
  bugs in React Native itself, at least I found and filed a bug in
  Codegen: facebook/react-native#36475
  and even with that bug fix, the build still fails later, seemingly,
  due to some other bugs in RN (New Arch) on Windows build host.

To be tested:

- iOS (New Arch) build
  • Loading branch information
birdofpreyru committed Mar 14, 2023
1 parent e6184f2 commit b3b9a3b
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 233 deletions.
26 changes: 23 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project(rn-static-server C)
cmake_minimum_required(VERSION 3.7.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)

# This prevents CMake from complaining that INSTALL(..) directives in
# Lighttpd CMakeLists.txt miss BUNDLE DESTINATION.
Expand All @@ -23,20 +23,40 @@ if(CMAKE_SYSTEM_NAME MATCHES "Android")
-DANDROID_STL=${ANDROID_STL}
-GNinja
)
elseif(CMAKE_SYSTEM_NAME MATCHES "iOS")
set(
EXTRA_BUILD_ARGS
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=${CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH}
-DCMAKE_IOS_INSTALL_COMBINED=${CMAKE_IOS_INSTALL_COMBINED}
-GXcode
)
set(PCRE2_TARGETS pcre2-8-static)
endif()

if(CMAKE_SYSTEM_NAME MATCHES "Android|Windows")
set(EXTRA_BUILD_ARGS ${EXTRA_BUILD_ARGS} -DBUILD_SHARED_LIBS=ON)
set(PCRE2_TARGETS pcre2-8-shared)
endif()

execute_process(
COMMAND cmake ${CMAKE_CURRENT_SOURCE_DIR}/pcre2
-B ${CMAKE_BINARY_DIR}/pcre2
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/sysroot
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
${EXTRA_BUILD_ARGS}
COMMAND_ERROR_IS_FATAL ANY
)

execute_process(
COMMAND cmake --build ${CMAKE_BINARY_DIR}/pcre2
--config Release
--target ${PCRE2_TARGETS}
)

execute_process(COMMAND cmake --build ${CMAKE_BINARY_DIR}/pcre2 --config Release)
execute_process(COMMAND cmake --install ${CMAKE_BINARY_DIR}/pcre2)

# Copies shared PCRE2 library into the folder from where Gradle automatically
Expand Down
4 changes: 2 additions & 2 deletions dr-pogodin-react-native-static-server.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ Pod::Spec.new do |s|
-DBUILD_LIBRARY=1 \
-GXcode
cmake --build ${TARGET_TEMP_DIR} --config ${CONFIGURATION} \
--target pcre2-8-static mod_indexfile mod_dirlisting mod_staticfile \
--target mod_indexfile mod_dirlisting mod_staticfile \
lighttpd
cp ${TARGET_TEMP_DIR}/lighttpd1.4/build/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/*.a \
${TARGET_TEMP_DIR}/pcre2/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/*.a \
${TARGET_TEMP_DIR}/pcre2/Release${EFFECTIVE_PLATFORM_NAME}/*.a \
${BUILT_PRODUCTS_DIR}
CMD
}
Expand Down
Loading

0 comments on commit b3b9a3b

Please sign in to comment.