Photon is now built as a framework
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
#project(photon C ASM-ATT)
|
||||
# project(photon C ASM-ATT)
|
||||
|
||||
macro(subdirlist result curdir)
|
||||
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
|
||||
@@ -13,6 +13,7 @@ macro(subdirlist result curdir)
|
||||
endmacro()
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/platform.cmake)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Bundles.cmake)
|
||||
platform_config(${PHOTON_TARGET})
|
||||
|
||||
message(STATUS "Target: ${machine}-${platform}")
|
||||
@@ -73,21 +74,21 @@ file(GLOB platform_headers
|
||||
set(photon_libc_sources ${photon_libc_sources} ${malloc_sources} ${platform_sources})
|
||||
set(photon_libc_headers ${photon_libc_headers} ${platform_headers})
|
||||
|
||||
if (PHOTON_STATIC EQUAL 1)
|
||||
add_library(c STATIC ${photon_libc_sources} ${photon_libc_headers})
|
||||
else ()
|
||||
add_library(c SHARED ${photon_libc_sources} ${photon_libc_headers})
|
||||
endif ()
|
||||
add_framework(Photon STATIC
|
||||
BUNDLE_ID net.doorstuck.photon
|
||||
SOURCES ${photon_libc_sources} ${photon_libc_headers}
|
||||
HEADERS ${CMAKE_CURRENT_BINARY_DIR}/sysroot/usr/include/*)
|
||||
|
||||
target_compile_options(c PRIVATE -ffreestanding -nostdlib)
|
||||
target_link_libraries(c crt ${photon_platform_libs})
|
||||
framework_compile_options(Photon -ffreestanding -nostdlib)
|
||||
framework_link_libraries(Photon ${photon_platform_libs})
|
||||
framework_link_frameworks(Photon ${photon_platform_frameworks})
|
||||
|
||||
target_include_directories(c PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/include
|
||||
framework_include_directories(Photon ${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/sys/${platform}/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/sysroot/usr/include)
|
||||
|
||||
foreach (platform_include_dir ${photon_platform_extra_include_dirs})
|
||||
target_include_directories(c PRIVATE
|
||||
framework_include_directories(Photon
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/sys/${platform}/${platform_include_dir})
|
||||
endforeach (platform_include_dir)
|
||||
|
||||
@@ -98,10 +99,20 @@ add_custom_target(local-root
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${platform} ${machine})
|
||||
|
||||
add_dependencies(c local-root)
|
||||
framework_add_dependencies(Photon local-root)
|
||||
|
||||
add_custom_command(TARGET Photon POST_BUILD
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/add-framework-crt.sh
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Photon.framework
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_libraries(c gcc)
|
||||
framework_link_libraries(Photon gcc)
|
||||
endif ()
|
||||
|
||||
if (TARGET early-sysroot)
|
||||
# We are being built as part of asbestOS, make sure the sysroot is there.
|
||||
framework_add_dependencies(Photon early-sysroot)
|
||||
endif ()
|
||||
|
||||
if (PHOTON_TESTS EQUAL 1)
|
||||
|
||||
Reference in New Issue
Block a user