summaryrefslogtreecommitdiff
path: root/Toolchain
diff options
context:
space:
mode:
authorGunnar Beutner <gunnar@beutner.name>2021-04-15 13:22:24 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-16 19:04:24 +0200
commitc6c1e2037b819ffec0a91a6a2ec3f9c7e1a5a0e3 (patch)
tree0074c35d54aa49b69e054f2f552ad38bb4277b34 /Toolchain
parent73dd293ec4ffcfefae9db8e10eaaa84d4a4be4a8 (diff)
downloadserenity-c6c1e2037b819ffec0a91a6a2ec3f9c7e1a5a0e3.zip
Toolchain: Add platform definition for CMake
This also ensures that pkg-config finds packages in /usr/local and changes the install prefix to /usr/local.
Diffstat (limited to 'Toolchain')
-rw-r--r--Toolchain/CMake/Platform/SerenityOS.cmake18
-rw-r--r--Toolchain/CMakeToolchain.txt8
2 files changed, 25 insertions, 1 deletions
diff --git a/Toolchain/CMake/Platform/SerenityOS.cmake b/Toolchain/CMake/Platform/SerenityOS.cmake
new file mode 100644
index 0000000000..ddf5c4a1ad
--- /dev/null
+++ b/Toolchain/CMake/Platform/SerenityOS.cmake
@@ -0,0 +1,18 @@
+set(CMAKE_DL_LIBS "dl")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+
+# Initialize C 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_C_FLAGS "-Wl,-Bstatic")
+ set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+endforeach()
+
+include(Platform/UnixPaths)
diff --git a/Toolchain/CMakeToolchain.txt b/Toolchain/CMakeToolchain.txt
index 84e4efd7d8..43d0538a9c 100644
--- a/Toolchain/CMakeToolchain.txt
+++ b/Toolchain/CMakeToolchain.txt
@@ -1,4 +1,4 @@
-set(CMAKE_SYSTEM_NAME Generic)
+set(CMAKE_SYSTEM_NAME SerenityOS)
if (NOT DEFINED ENV{SERENITY_ARCH})
message(FATAL_ERROR "SERENITY_ARCH not set.")
@@ -8,6 +8,10 @@ if (NOT DEFINED ENV{SERENITY_ROOT})
message(FATAL_ERROR "SERENITY_ROOT not set.")
endif()
+set(SERENITYOS 1)
+
+set(CMAKE_SYSTEM_PROCESSOR "$ENV{SERENITY_ARCH}")
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
set(SERENITY_BUILD_DIR $ENV{SERENITY_ROOT}/Build/$ENV{SERENITY_ARCH})
@@ -25,3 +29,5 @@ 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 ONLY)
+
+list(APPEND CMAKE_MODULE_PATH "$ENV{SERENITY_ROOT}/Toolchain/CMake")