Skip to content

Commit

Permalink
Fix build with recent Xcode
Browse files Browse the repository at this point in the history
IB-7888

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Nov 29, 2023
1 parent 8a28362 commit acf2a17
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 25 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ jobs:
run: |
brew update
brew install doxygen boost xsd || brew link --overwrite xsd
brew unlink xerces-c [email protected] [email protected]
brew unlink xerces-c
brew unlink [email protected] || true
brew unlink [email protected] || true
brew unlink [email protected] || true
- name: Cache
uses: actions/cache@v3
id: cache
Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 3.16)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/cmake/modules/VersionInfo.cmake)
message(FATAL_ERROR "cmake submodule directory empty, did you 'git clone --recursive'?")
endif()

if(POLICY CMP0122)
cmake_policy(SET CMP0122 NEW)
cmake_policy(SET CMP0122 NEW)
endif()
project(libdigidocpp VERSION 3.17.0)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
Expand Down
2 changes: 1 addition & 1 deletion examples/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.2'
classpath 'com.android.tools.build:gradle:8.1.4'
}
}

Expand Down
67 changes: 48 additions & 19 deletions prepare_osx_build_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,43 @@ function xerces {
rm -rf ${XERCES_DIR}
tar xf ${XERCES_DIR}.tar.xz
cd ${XERCES_DIR}
sed -ie 's!SUBDIRS = doc src tests samples!SUBDIRS = src!' Makefile.in
./configure --prefix=${TARGET_PATH} ${CONFIGURE} --enable-transcoder-iconv --disable-netaccessor-curl
make -s
sudo make install
sed -ie 's!add_subdirectory(doc)!!' CMakeLists.txt
sed -ie 's!add_subdirectory(tests)!!' CMakeLists.txt
sed -ie 's!add_subdirectory(samples)!!' CMakeLists.txt
case "${ARGS}" in
*android*)
cmake -S . \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=${API} \
-DANDROID_ABI=${ARCH_ABI} \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=NO
;;
*ios*|*simulator*)
cmake -S . \
-DCMAKE_OSX_SYSROOT=${SYSROOT} \
-DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=NO \
-Dtranscoder=iconv \
-Dnetwork-accessor=socket
;;
*)
cmake -S . \
-DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=YES \
-DCMAKE_MACOSX_RPATH=NO \
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=YES \
-DCMAKE_INSTALL_NAME_DIR=${TARGET_PATH}/lib \
-Dtranscoder=iconv \
-Dnetwork-accessor=socket
;;
esac
cmake --build . && sudo cmake --install .
cd -
}

Expand All @@ -131,44 +164,40 @@ function xalan {
mv tmp src/xalanc/CMakeLists.txt
case "${ARGS}" in
*android*)
cmake \
cmake -S . \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=${API} \
-DANDROID_ABI=${ARCH_ABI} \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_FIND_ROOT_PATH=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=NO \
. && make -s MsgCreator
&& cmake --build . --target MsgCreator
cp ../patches/MsgCreator src/xalanc/Utils/MsgCreator
make -s && sudo make install
;;
*ios*|*simulator*)
cmake \
cmake -S . \
-DCMAKE_OSX_SYSROOT=${SYSROOT} \
-DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=NO \
. && make -s MsgCreator
&& cmake --build . --target MsgCreator
cp ../patches/MsgCreator src/xalanc/Utils/MsgCreator
make -s && sudo make install
;;
*)
cmake \
-DCMAKE_MACOSX_RPATH=NO \
cmake -S . \
-DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=YES \
. && make -s && sudo make install
sudo install_name_tool -id ${TARGET_PATH}/lib/libxalanMsg.112.dylib \
${TARGET_PATH}/lib/libxalanMsg.*.0.dylib
sudo install_name_tool -id ${TARGET_PATH}/lib/libxalan-c.112.dylib \
-change libxalanMsg.112.dylib ${TARGET_PATH}/lib/libxalanMsg.112.dylib \
${TARGET_PATH}/lib/libxalan-c.*.0.dylib
-DCMAKE_MACOSX_RPATH=NO \
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=YES \
-DCMAKE_INSTALL_NAME_DIR=${TARGET_PATH}/lib \
-Dtranscoder=default
;;
esac
cmake --build . && sudo cmake --install .
cd -
}

Expand All @@ -187,7 +216,7 @@ function xml_security {
CXXFLAGS="${CXXFLAGS} -fvisibility=hidden -fvisibility-inlines-hidden" \
xerces_CFLAGS="-I${TARGET_PATH}/include" xerces_LIBS="-L${TARGET_PATH}/lib -lxalanMsg -lxalan-c -lxerces-c" \
openssl_CFLAGS="-I${TARGET_PATH}/include" openssl_LIBS="-L${TARGET_PATH}/lib -lcrypto" \
./configure --prefix=${TARGET_PATH} ${CONFIGURE} --with-xalan=${TARGET_PATH}
./configure --prefix=${TARGET_PATH} ${CONFIGURE} --with-xalan=${TARGET_PATH} --without-nss lt_cv_apple_cc_single_mod=yes
sed -ie 's!PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)!PROGRAMS = !; s!bin_PROGRAMS = $(am__EXEEXT_2)!bin_PROGRAMS = !' xsec/Makefile
make -s
sudo make install
Expand Down
3 changes: 0 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ if(NOT MINIZIP_FOUND)
target_compile_options(minizip PRIVATE $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-unused-parameter -Wno-unused-value>)
set_target_properties(minizip PROPERTIES COMPILE_DEFINITIONS "NOUNCRYPT;NOCRYPT" POSITION_INDEPENDENT_CODE YES)
target_link_libraries(minizip ZLIB::ZLIB)
if(ANDROID)
set_property(SOURCE minizip/ioapi.c APPEND PROPERTY COMPILE_DEFINITIONS IOAPI_NO_64)
endif()
else()
add_library(minizip INTERFACE)
target_link_libraries(minizip INTERFACE PkgConfig::MINIZIP)
Expand Down

0 comments on commit acf2a17

Please sign in to comment.