2021-09-07 11:21:36 +03:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "@SERENITY_SOURCE_DIR@/Toolchain/CMake")
|
|
|
|
|
|
|
|
set(CMAKE_SYSTEM_NAME SerenityOS)
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR "@SERENITY_ARCH@")
|
|
|
|
|
|
|
|
set(SERENITYOS 1)
|
|
|
|
set(triple @SERENITY_ARCH@-pc-serenity)
|
|
|
|
set(TOOLCHAIN_PATH @SERENITY_SOURCE_DIR@/Toolchain/Local/@SERENITY_ARCH@/bin)
|
|
|
|
set(TOOLCHAIN_PREFIX ${TOOLCHAIN_PATH}/${triple}-)
|
|
|
|
|
|
|
|
# where to read from/write to
|
|
|
|
set(CMAKE_SYSROOT @SERENITY_BUILD_DIR@/Root)
|
|
|
|
set(CMAKE_STAGING_PREFIX @SERENITY_BUILD_DIR@/Root/usr/local)
|
2021-10-18 17:08:37 +03:00
|
|
|
set(CMAKE_INSTALL_PREFIX /usr/local)
|
|
|
|
set(CMAKE_INSTALL_DATAROOTDIR share)
|
2021-09-07 11:21:36 +03:00
|
|
|
|
|
|
|
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
|
|
|
|
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
|
|
|
|
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}gcc)
|
|
|
|
set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}ld)
|
|
|
|
set(CMAKE_AR ${TOOLCHAIN_PREFIX}gcc-ar)
|
2022-02-19 22:51:19 +03:00
|
|
|
set(CMAKE_NM ${TOOLCHAIN_PREFIX}gcc-nm)
|
2021-09-07 11:21:36 +03:00
|
|
|
set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy)
|
2022-02-19 22:51:19 +03:00
|
|
|
set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}gcc-ranlib)
|
|
|
|
set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}strip)
|
2021-09-01 05:38:34 +03:00
|
|
|
set(SERENITY_CXXFILT ${TOOLCHAIN_PREFIX}c++filt)
|
2021-09-07 11:21:36 +03:00
|
|
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack,-z,max-page-size=0x1000,-z,separate-code")
|
|
|
|
|
|
|
|
# FIXME: We could eliminate this setting by building LibC and support asm files (crti.o, crtn.o)
|
|
|
|
# in a separate build stage before the main build to ensure that LibC is available
|
|
|
|
# for the try_compile check for the main build.
|
2021-11-01 13:42:30 +03:00
|
|
|
# Note that `set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)` is not a suitable replacement,
|
|
|
|
# since applications might try and use `try_compile()` to detect which library a symbol is in,
|
|
|
|
# which doesn't work when using static linking.
|
|
|
|
# Instead, just tell CMake directly that the compiler works fine, so that it doesn't have to run
|
|
|
|
# a compile check before the build.
|
|
|
|
set(CMAKE_C_COMPILER_WORKS TRUE)
|
|
|
|
set(CMAKE_CXX_COMPILER_WORKS TRUE)
|
2021-09-07 11:21:36 +03:00
|
|
|
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
|