1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 02:10:45 +00:00

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.
This commit is contained in:
Paul Redmond 2020-05-26 14:20:24 -04:00 committed by Andreas Kling
parent b0b03c52af
commit 4d4e578edf
4 changed files with 11 additions and 7 deletions

1
AK/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
serenity_install_headers(AK)

View File

@ -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)

View File

@ -181,4 +181,6 @@ add_custom_command(
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kernel.map DESTINATION res)
serenity_install_headers(Kernel)
add_subdirectory(Modules)

View File

@ -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++)