mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Toolchain: Allow building using CMake on macOS
This commit is contained in:
parent
617655db0d
commit
a1e1aa96fb
Notes:
sideshowbarker
2024-07-19 04:53:04 +09:00
Author: https://github.com/Pagghiu 🔰 Commit: https://github.com/SerenityOS/serenity/commit/a1e1aa96fbd Pull-request: https://github.com/SerenityOS/serenity/pull/2750 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/bugaevc
3 changed files with 32 additions and 5 deletions
|
@ -126,6 +126,22 @@ set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}ranlib)
|
|||
set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}strip)
|
||||
set(CMAKE_AR ${TOOLCHAIN_PREFIX}ar)
|
||||
|
||||
foreach(lang ASM C CXX OBJC OBJCXX)
|
||||
unset(CMAKE_${lang}_OSX_COMPATIBILITY_VERSION_FLAG)
|
||||
unset(CMAKE_${lang}_OSX_CURRENT_VERSION_FLAG)
|
||||
unset(CMAKE_${lang}_LINK_FLAGS)
|
||||
unset(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS)
|
||||
unset(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS)
|
||||
unset(CMAKE_SHARED_MODULE_LOADER_${lang}_FLAG )
|
||||
unset(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG)
|
||||
unset(CMAKE_${lang}_SYSROOT_FLAG)
|
||||
unset(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG)
|
||||
endforeach()
|
||||
|
||||
set(CMAKE_INSTALL_NAME_TOOL "true")
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared")
|
||||
|
||||
#FIXME: -fstack-protector
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -Wno-sized-deallocation -fno-sized-deallocation -fno-exceptions -fno-rtti -Wno-address-of-packed-member -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-nonnull-compare -Wno-deprecated-copy -Wno-expansion-to-defined")
|
||||
|
|
|
@ -54,10 +54,15 @@ set(ELF_SOURCES ${ELF_SOURCES} ../LibELF/Arch/i386/plt_trampoline.S)
|
|||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSERENITY_LIBC_BUILD")
|
||||
|
||||
find_program(INSTALL_COMMAND ginstall)
|
||||
if(NOT INSTALL_COMMAND)
|
||||
set(INSTALL_COMMAND install)
|
||||
endif()
|
||||
|
||||
add_library(crt0 STATIC crt0.cpp)
|
||||
add_custom_command(
|
||||
TARGET crt0
|
||||
COMMAND install -D $<TARGET_OBJECTS:crt0> ${CMAKE_INSTALL_PREFIX}/usr/lib/crt0.o
|
||||
COMMAND ${INSTALL_COMMAND} -D $<TARGET_OBJECTS:crt0> ${CMAKE_INSTALL_PREFIX}/usr/lib/crt0.o
|
||||
)
|
||||
|
||||
set(SOURCES ${LIBC_SOURCES} ${AK_SOURCES} ${ELF_SOURCES})
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
shopt -s globstar
|
||||
# This file will need to be run in bash, for now.
|
||||
|
||||
|
||||
|
@ -24,6 +23,12 @@ NPROC="nproc"
|
|||
# It seems that Travis starts having trouble at 35 entries, so I think this is a good amount.
|
||||
KEEP_CACHE_COUNT=8
|
||||
|
||||
if command -v ginstall &>/dev/null; then
|
||||
INSTALL=ginstall
|
||||
else
|
||||
INSTALL=install
|
||||
fi
|
||||
|
||||
if [ "$(uname -s)" = "OpenBSD" ]; then
|
||||
MAKE=gmake
|
||||
MD5SUM="md5 -q"
|
||||
|
@ -230,11 +235,12 @@ pushd "$DIR/Build/"
|
|||
pushd "$BUILD"
|
||||
CXXFLAGS="-DBUILDING_SERENITY_TOOLCHAIN" cmake ..
|
||||
cmake --build . --target LibC
|
||||
install -D Libraries/LibC/libc.a Libraries/LibM/libm.a Root/usr/lib/
|
||||
"$INSTALL" -D Libraries/LibC/libc.a Libraries/LibM/libm.a Root/usr/lib/
|
||||
SRC_ROOT=$(realpath "$DIR"/..)
|
||||
for header in "$SRC_ROOT"/Libraries/Lib{C,M}/**/*.h; do
|
||||
FILES=$(find "$SRC_ROOT"/Libraries/LibC "$SRC_ROOT"/Libraries/LibM -name '*.h' -print)
|
||||
for header in $FILES; do
|
||||
target=$(echo "$header" | sed -e "s@$SRC_ROOT/Libraries/LibC@@" -e "s@$SRC_ROOT/Libraries/LibM@@")
|
||||
install -D "$header" "Root/usr/include/$target"
|
||||
$INSTALL -D "$header" "Root/usr/include/$target"
|
||||
done
|
||||
unset SRC_ROOT
|
||||
popd
|
||||
|
|
Loading…
Reference in a new issue