From 4d4e578edfde7299cfbebce8af9f34b82b0fbd21 Mon Sep 17 00:00:00 2001 From: Paul Redmond Date: Tue, 26 May 2020 14:20:24 -0400 Subject: [PATCH] Ports: Fix CMake-based ports The SDL port failed to build because the CMake toolchain filed pointed to the old root. Now the toolchain file assumes that the Root is in Build/Root. Additionally, the AK/ and Kernel/ headers need to be installed in the root too. --- AK/CMakeLists.txt | 1 + CMakeLists.txt | 7 ++++--- Kernel/CMakeLists.txt | 2 ++ Toolchain/CMakeToolchain.txt | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 AK/CMakeLists.txt diff --git a/AK/CMakeLists.txt b/AK/CMakeLists.txt new file mode 100644 index 0000000000..b318669ba3 --- /dev/null +++ b/AK/CMakeLists.txt @@ -0,0 +1 @@ +serenity_install_headers(AK) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d671a6a02..2929f2b92a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ add_subdirectory(DevTools/FormCompiler) add_subdirectory(Libraries/LibWeb/CodeGenerators) add_subdirectory(AK/Tests) -function(serenity_lib_headers target_name) +function(serenity_install_headers target_name) file(GLOB_RECURSE headers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h") foreach(header ${headers}) get_filename_component(subdirectory ${header} DIRECTORY) @@ -49,7 +49,7 @@ function(serenity_lib_headers target_name) endfunction() function(serenity_lib target_name fs_name) - serenity_lib_headers(${target_name}) + serenity_install_headers(${target_name}) add_library(${target_name} ${SOURCES} ${GENERATED_SOURCES}) install(TARGETS ${target_name} ARCHIVE DESTINATION usr/lib) set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name}) @@ -63,7 +63,7 @@ function(serenity_lib target_name fs_name) endfunction() function(serenity_libc target_name fs_name) - serenity_lib_headers("") + serenity_install_headers("") add_library(${target_name} ${SOURCES}) install(TARGETS ${target_name} ARCHIVE DESTINATION usr/lib) set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name}) @@ -121,6 +121,7 @@ include_directories(Services) include_directories(${CMAKE_CURRENT_BINARY_DIR}/Services) include_directories(${CMAKE_CURRENT_BINARY_DIR}/Libraries) +add_subdirectory(AK) add_subdirectory(Kernel) add_subdirectory(Libraries) add_subdirectory(Services) diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 19f1637b11..6359825dfe 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -181,4 +181,6 @@ add_custom_command( ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kernel.map DESTINATION res) +serenity_install_headers(Kernel) + add_subdirectory(Modules) diff --git a/Toolchain/CMakeToolchain.txt b/Toolchain/CMakeToolchain.txt index 879b82bd13..85e74162d7 100644 --- a/Toolchain/CMakeToolchain.txt +++ b/Toolchain/CMakeToolchain.txt @@ -7,10 +7,10 @@ endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions") # where to read from/write to -set(CMAKE_SYSROOT $ENV{SERENITY_ROOT}/Root) -set(CMAKE_STAGING_PREFIX $ENV{SERENITY_ROOT}/Root/usr) -set(CMAKE_INSTALL_PREFIX $ENV{SERENITY_ROOT}/Root/usr) -set(CMAKE_INSTALL_DATAROOTDIR $ENV{SERENITY_ROOT}/Root/usr/share) +set(CMAKE_SYSROOT $ENV{SERENITY_ROOT}/Build/Root) +set(CMAKE_STAGING_PREFIX $ENV{SERENITY_ROOT}/Build/Root/usr) +set(CMAKE_INSTALL_PREFIX $ENV{SERENITY_ROOT}/Build/Root/usr) +set(CMAKE_INSTALL_DATAROOTDIR $ENV{SERENITY_ROOT}/Build/Root/usr/share) set(CMAKE_C_COMPILER i686-pc-serenity-gcc) set(CMAKE_CXX_COMPILER i686-pc-serenity-g++)