mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 03:39:43 -06:00
SerenityOS: Add Platform module
Add an initial Platform module for SerenityOS [1]. This module is a mix of the platform module currently used to build the Serenity Kernel and Userspace applications and libraries, and the platform module included in the CMake Port [2] which still has some work to do on the system before its other patches could be considered for upstream. As such, the platform module is currently only useful when used with a suitably patched GCC or LLVM cross-compiler toolchain. [1] https://github.com/SerenityOS/serenity [2] https://github.com/SerenityOS/serenity/tree/master/Ports/cmake/patches Issue: #23589
This commit is contained in:
2
Modules/Platform/SerenityOS-Clang-ASM.cmake
Normal file
2
Modules/Platform/SerenityOS-Clang-ASM.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(Platform/SerenityOS-GNU)
|
||||
__serenity_compiler_gnu(ASM)
|
||||
2
Modules/Platform/SerenityOS-Clang-C.cmake
Normal file
2
Modules/Platform/SerenityOS-Clang-C.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(Platform/SerenityOS-GNU)
|
||||
__serenity_compiler_gnu(C)
|
||||
2
Modules/Platform/SerenityOS-Clang-CXX.cmake
Normal file
2
Modules/Platform/SerenityOS-Clang-CXX.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(Platform/SerenityOS-GNU)
|
||||
__serenity_compiler_gnu(CXX)
|
||||
2
Modules/Platform/SerenityOS-GNU-ASM.cmake
Normal file
2
Modules/Platform/SerenityOS-GNU-ASM.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(Platform/SerenityOS-GNU)
|
||||
__serenity_compiler_gnu(ASM)
|
||||
2
Modules/Platform/SerenityOS-GNU-C.cmake
Normal file
2
Modules/Platform/SerenityOS-GNU-C.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(Platform/SerenityOS-GNU)
|
||||
__serenity_compiler_gnu(C)
|
||||
2
Modules/Platform/SerenityOS-GNU-CXX.cmake
Normal file
2
Modules/Platform/SerenityOS-GNU-CXX.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(Platform/SerenityOS-GNU)
|
||||
__serenity_compiler_gnu(CXX)
|
||||
24
Modules/Platform/SerenityOS-GNU.cmake
Normal file
24
Modules/Platform/SerenityOS-GNU.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
# This module is shared by multiple languages; use include blocker.
|
||||
include_guard()
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack,-z,separate-code,-z,max-page-size=0x1000")
|
||||
|
||||
macro(__serenity_compiler_gnu lang)
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,")
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_${lang}_FLAG "-Wl,-rpath-link,")
|
||||
set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-soname,")
|
||||
set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-dynamic")
|
||||
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared -Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack,-z,separate-code")
|
||||
|
||||
# Initialize link type selection flags. These flags are used when
|
||||
# building a shared library, shared module, or executable that links
|
||||
# to other libraries to select whether to use the static or shared
|
||||
# versions of the libraries.
|
||||
foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
|
||||
set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic")
|
||||
set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
|
||||
endforeach()
|
||||
|
||||
endmacro()
|
||||
12
Modules/Platform/SerenityOS.cmake
Normal file
12
Modules/Platform/SerenityOS.cmake
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
set(SERENITYOS 1)
|
||||
|
||||
set(CMAKE_DL_LIBS "-ldl")
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
|
||||
|
||||
# Shared libraries with no builtin soname may not be linked safely by
|
||||
# specifying the file path.
|
||||
set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
|
||||
|
||||
include(Platform/UnixPaths)
|
||||
Reference in New Issue
Block a user