mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Revert "Add support for Axle library." It breaks the build.
This reverts commit r9292. Swift SVN r9296
This commit is contained in:
@@ -189,9 +189,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -fno-rtti -fno
|
||||
# FLAGS -module-name foo # Flags to add to the compilation
|
||||
# [IS_MAIN] # This is an executable, not a library
|
||||
# [IS_STDLIB_CORE]) # This is the core standard library
|
||||
# [AXLE] # This is compile for axle
|
||||
function(compile_swift_files)
|
||||
parse_arguments(SWIFTFILE "OUTPUT;SOURCES;FLAGS" "IS_MAIN;IS_STDLIB_CORE;AXLE"
|
||||
parse_arguments(SWIFTFILE "OUTPUT;SOURCES;FLAGS" "IS_MAIN;IS_STDLIB_CORE"
|
||||
${ARGN})
|
||||
|
||||
if(SWIFTFILE_IS_MAIN AND SWIFTFILE_IS_STDLIB_CORE)
|
||||
@@ -249,35 +248,20 @@ function(compile_swift_files)
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${objfile}")
|
||||
endif()
|
||||
|
||||
# Set destination directory name.
|
||||
if (SWIFTFILE_AXLE)
|
||||
set(DEST_DIRNAME "axle")
|
||||
else()
|
||||
set(DEST_DIRNAME "swift")
|
||||
endif()
|
||||
|
||||
if(SWIFTFILE_IS_MAIN)
|
||||
set(module_source_file)
|
||||
set(postprocessing)
|
||||
else()
|
||||
get_filename_component(module_source_name ${objfile} NAME_WE)
|
||||
set(module_source_dir ${SWIFTLIB_DIR}/${DEST_DIRNAME})
|
||||
set(module_source_dir ${SWIFTLIB_DIR}/swift)
|
||||
|
||||
# We should find a better way of handling this. Currently, we use the same
|
||||
# module name for the axle library but we need a different object name to
|
||||
# compile for it.
|
||||
if (SWIFTFILE_IS_STDLIB_CORE AND SWIFTFILE_AXLE)
|
||||
set(module_source_file ${module_source_dir}/swift.swiftmodule)
|
||||
set(intermediate_module_source_file ${CMAKE_CURRENT_BINARY_DIR}/swift.swiftmodule)
|
||||
else()
|
||||
set(module_source_file ${module_source_dir}/${module_source_name}.swiftmodule)
|
||||
set(intermediate_module_source_file ${CMAKE_CURRENT_BINARY_DIR}/${module_source_name}.swiftmodule)
|
||||
endif()
|
||||
list(APPEND swift_flags -emit-module)
|
||||
set(postprocessing COMMAND ${CMAKE_COMMAND} -E rename ${intermediate_module_source_file} ${module_source_file})
|
||||
|
||||
install(FILES ${module_source_file}
|
||||
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/${DEST_DIRNAME})
|
||||
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/swift)
|
||||
endif()
|
||||
|
||||
set(stdlib_dep)
|
||||
@@ -315,7 +299,7 @@ endfunction()
|
||||
# Usage:
|
||||
# handle_swift_sources(sourcesvar externalvar target)
|
||||
function(handle_swift_sources sourcesvar externalvar target)
|
||||
parse_arguments(SWIFTSOURCES "" "IS_MAIN;IS_STDLIB_CORE;AXLE" ${ARGN})
|
||||
parse_arguments(SWIFTSOURCES "" "IS_MAIN;IS_STDLIB_CORE" ${ARGN})
|
||||
|
||||
set(result)
|
||||
set(swift_sources)
|
||||
@@ -340,21 +324,14 @@ function(handle_swift_sources sourcesvar externalvar target)
|
||||
if(SWIFTSOURCES_IS_STDLIB_CORE)
|
||||
set(IS_STDLIB_CORE_arg IS_STDLIB_CORE)
|
||||
endif()
|
||||
set(AXLE_arg)
|
||||
if (SWIFTSOURCES_AXLE)
|
||||
set(AXLE_arg AXLE)
|
||||
endif()
|
||||
|
||||
if(swift_sources)
|
||||
|
||||
# Special-case hack to create swift.o for the swift_stdlib_* targets
|
||||
if(target STREQUAL swift_stdlib_core)
|
||||
set(swift_obj_base "swift")
|
||||
elseif(target STREQUAL swift_stdlib_posix)
|
||||
set(swift_obj_base "POSIX")
|
||||
elseif (target STREQUAL swift_stdlib_axle_core)
|
||||
set(swift_obj_base "swift_axle")
|
||||
elseif(target STREQUAL swift_stdlib_axle)
|
||||
set(swift_obj_base "axle")
|
||||
else()
|
||||
# Otherwise, get the name from the first swift input file. Also
|
||||
# a hack!
|
||||
@@ -366,7 +343,7 @@ function(handle_swift_sources sourcesvar externalvar target)
|
||||
compile_swift_files(OUTPUT ${swift_obj}
|
||||
SOURCES ${swift_sources}
|
||||
FLAGS ${swift_flags}
|
||||
${IS_MAIN_arg} ${IS_STDLIB_CORE_arg} ${AXLE_arg})
|
||||
${IS_MAIN_arg} ${IS_STDLIB_CORE_arg})
|
||||
list(APPEND result ${swift_obj})
|
||||
endif()
|
||||
|
||||
@@ -388,10 +365,9 @@ set(SWIFTLIB_DIR "${CMAKE_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR}")
|
||||
# [COMPONENT_DEPENDS comp1 ...] # LLVM components this library depends on
|
||||
# [INSTALL] # Install library to lib/swift
|
||||
# [IS_STDLIB_CORE] # Compile as the standard library core
|
||||
# [AXLE] # Compile for axle so install in lib/axle
|
||||
# source1 [source2 source3 ...]) # Sources to add into this library
|
||||
macro(add_swift_library name)
|
||||
parse_arguments(SWIFTLIB "DEPENDS;COMPONENT_DEPENDS" "INSTALL;IS_STDLIB_CORE;AXLE"
|
||||
parse_arguments(SWIFTLIB "DEPENDS;COMPONENT_DEPENDS" "INSTALL;IS_STDLIB_CORE"
|
||||
${ARGN})
|
||||
set(SWIFTLIB_SOURCES ${SWIFTLIB_DEFAULT_ARGS})
|
||||
|
||||
@@ -413,23 +389,13 @@ macro(add_swift_library name)
|
||||
set(libkind)
|
||||
endif()
|
||||
|
||||
# Set destination directory name.
|
||||
set(AXLE_arg)
|
||||
if (SWIFTLIB_AXLE)
|
||||
set(DEST_DIRNAME "axle")
|
||||
set(AXLE_arg AXLE)
|
||||
else()
|
||||
set(DEST_DIRNAME "swift")
|
||||
endif(SWIFTLIB_AXLE)
|
||||
|
||||
|
||||
set(IS_STDLIB_CORE_arg)
|
||||
if(SWIFTLIB_IS_STDLIB_CORE)
|
||||
set(IS_STDLIB_CORE_arg IS_STDLIB_CORE)
|
||||
endif()
|
||||
|
||||
handle_swift_sources(SWIFTLIB_SOURCES SWIFTLIB_EXTERNAL_SOURCES ${name}
|
||||
${IS_STDLIB_CORE_arg} ${AXLE_arg})
|
||||
${IS_STDLIB_CORE_arg})
|
||||
add_library( ${name} ${libkind}
|
||||
${SWIFTLIB_SOURCES}
|
||||
${SWIFTLIB_EXTERNAL_SOURCES})
|
||||
@@ -445,7 +411,7 @@ macro(add_swift_library name)
|
||||
set_source_files_properties(${SWIFTLIB_EXTERNAL_SOURCES} PROPERTIES
|
||||
HEADER_FILE_ONLY true)
|
||||
|
||||
target_link_libraries( ${name} "-L${SWIFTLIB_DIR}/${DEST_DIRNAME}" ${SWIFTLIB_DEPENDS} )
|
||||
target_link_libraries( ${name} "-L${SWIFTLIB_DIR}/swift" ${SWIFTLIB_DEPENDS} )
|
||||
llvm_config( ${name} ${SWIFTLIB_COMPONENT_DEPENDS} )
|
||||
target_link_libraries( ${name} ${LLVM_COMMON_LIBS} )
|
||||
link_system_libs( ${name} )
|
||||
@@ -461,14 +427,14 @@ macro(add_swift_library name)
|
||||
|
||||
if(SWIFTLIB_INSTALL)
|
||||
set_target_properties(${name} PROPERTIES
|
||||
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib/${DEST_DIRNAME}")
|
||||
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib/swift")
|
||||
|
||||
# Install runtime libraries to lib/[swift|axle] instead of lib. This works around
|
||||
# Install runtime libraries to lib/swift instead of lib. This works around
|
||||
# the fact that -isysroot prevents linking to libraries in the system
|
||||
# /usr/lib if Swift is installed in /usr.
|
||||
set_target_properties(${name} PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${SWIFTLIB_DIR}/${DEST_DIRNAME}
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${SWIFTLIB_DIR}/${DEST_DIRNAME})
|
||||
LIBRARY_OUTPUT_DIRECTORY ${SWIFTLIB_DIR}/swift
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${SWIFTLIB_DIR}/swift)
|
||||
|
||||
foreach(config ${CMAKE_CONFIGURATION_TYPES})
|
||||
string(TOUPPER ${config} config_upper)
|
||||
@@ -481,13 +447,13 @@ macro(add_swift_library name)
|
||||
string(REPLACE "$(CONFIGURATION)" ${config} config_lib_dir
|
||||
${SWIFTLIB_DIR})
|
||||
set_target_properties(${name} PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${DEST_DIRNAME}
|
||||
ARCHIVE_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${DEST_DIRNAME})
|
||||
LIBRARY_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/swift
|
||||
ARCHIVE_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/swift)
|
||||
endforeach()
|
||||
|
||||
install(TARGETS ${name}
|
||||
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}/${DEST_DIRNAME}
|
||||
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}/${DEST_DIRNAME})
|
||||
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}/swift
|
||||
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}/swift)
|
||||
|
||||
# FIXME: Install .swift files so they can be parsed on import.
|
||||
# Really we want to install a preparsed metadata file.
|
||||
|
||||
4
Makefile
4
Makefile
@@ -76,10 +76,6 @@ ifndef SWIFT_HEADER_DIR
|
||||
SWIFT_HEADER_DIR := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/swift
|
||||
endif
|
||||
|
||||
ifndef AXLE_SWIFT_HEADER_DIR
|
||||
AXLE_SWIFT_HEADER_DIR := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/axle
|
||||
endif
|
||||
|
||||
|
||||
###
|
||||
# Settings for .swift files in Swift compiler and stdlib
|
||||
|
||||
@@ -169,9 +169,6 @@ public:
|
||||
/// The name of the standard library module "swift".
|
||||
Identifier StdlibModuleName;
|
||||
|
||||
/// The name of the standard library module "axle".
|
||||
Identifier AxleStdlibModuleName;
|
||||
|
||||
/// ImportSearchPaths - The paths to search for imports in.
|
||||
std::vector<std::string> ImportSearchPaths;
|
||||
|
||||
|
||||
@@ -218,7 +218,6 @@ ASTContext::ASTContext(LangOptions &langOpts, SourceManager &SourceMgr,
|
||||
Diags(Diags),
|
||||
TheBuiltinModule(new (*this) BuiltinModule(getIdentifier("Builtin"), *this)),
|
||||
StdlibModuleName(getIdentifier("swift")),
|
||||
AxleStdlibModuleName(getIdentifier("axle")),
|
||||
TheErrorType(new (*this, AllocationArena::Permanent) ErrorType(*this)),
|
||||
TheEmptyTupleType(TupleType::get(ArrayRef<TupleTypeElt>(), *this)),
|
||||
TheObjectPointerType(new (*this, AllocationArena::Permanent)
|
||||
|
||||
@@ -1084,7 +1084,6 @@ static void performAutoImport(SourceFile &SF, bool hasBuiltinModuleAccess) {
|
||||
|
||||
// If we're building the standard library, import the magic Builtin module,
|
||||
// otherwise, import the standard library.
|
||||
std::pair<Module::ImportedModule, bool> Imports[2];
|
||||
Module *M;
|
||||
if (hasBuiltinModuleAccess)
|
||||
M = SF.TU.Ctx.TheBuiltinModule;
|
||||
@@ -1096,16 +1095,8 @@ static void performAutoImport(SourceFile &SF, bool hasBuiltinModuleAccess) {
|
||||
|
||||
// FIXME: These will be the same for most source files, but we copy them
|
||||
// over and over again.
|
||||
Imports[0] = std::make_pair(Module::ImportedModule({}, M), false);
|
||||
if (SF.TU.Ctx.LangOpts.Axle && !hasBuiltinModuleAccess) {
|
||||
Module* AxleM =
|
||||
SF.TU.Ctx.getModule({{SF.TU.Ctx.AxleStdlibModuleName, SourceLoc()}});
|
||||
Imports[1] = std::make_pair(Module::ImportedModule({}, AxleM), false);
|
||||
|
||||
SF.setImports(SF.TU.Ctx.AllocateCopy(llvm::makeArrayRef(Imports, 2)));
|
||||
} else
|
||||
SF.setImports(SF.TU.Ctx.AllocateCopy(llvm::makeArrayRef(Imports, 1)));
|
||||
|
||||
auto Import = std::make_pair(Module::ImportedModule({}, M), false);
|
||||
SF.setImports(SF.TU.Ctx.AllocateCopy(llvm::makeArrayRef(Import)));
|
||||
}
|
||||
|
||||
SourceFile::SourceFile(TranslationUnit &tu, SourceKind K,
|
||||
|
||||
@@ -28,9 +28,6 @@ void CompilerInvocation::setMainExecutablePath(StringRef Path) {
|
||||
llvm::SmallString<128> LibPath(Path);
|
||||
llvm::sys::path::remove_filename(LibPath); // Remove /swift
|
||||
llvm::sys::path::remove_filename(LibPath); // Remove /bin
|
||||
if (getLangOptions().Axle)
|
||||
llvm::sys::path::append(LibPath, "lib", "axle");
|
||||
else
|
||||
llvm::sys::path::append(LibPath, "lib", "swift");
|
||||
setRuntimeIncludePath(LibPath.str());
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
SWIFT_LEVEL := ..
|
||||
include $(SWIFT_LEVEL)/../../Makefile.config
|
||||
|
||||
DIRS := runtime core axle POSIX objc
|
||||
DIRS := runtime core POSIX objc
|
||||
|
||||
include $(SWIFT_LEVEL)/Makefile
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
@# -*- mode: swift -*-
|
||||
|
||||
@# Ignore the following admonition; it applies to the resulting .swift file only
|
||||
//// Automatically Generated From AxleBuiltins.gyb. Do Not Edit Directly ////
|
||||
//// To regenerate: ////
|
||||
//// ../../tools/gyb AxleBuiltins.gyb -o AxleBuiltins.swift ////
|
||||
|
||||
// 2.2.1 Vertex Functions
|
||||
@@asmname="llvm.air.get_vertex_id"
|
||||
func getVertexId() -> Int32
|
||||
|
||||
@@asmname="llvm.air.get_instance_id"
|
||||
func getInstanceId() -> Int32
|
||||
|
||||
// 2.3.1 Work-Item Functions
|
||||
@@asmname="llvm.air.get_work_dim.i32"
|
||||
func getWorkDim() -> Int32
|
||||
|
||||
@@asmname="llvm.air.get_global_id.i32"
|
||||
func getGlobalId(dimindx : Int32) -> Int32
|
||||
|
||||
@@asmname="llvm.air.get_global_size.i32"
|
||||
func getGlobalSize(dimindx : Int32) -> Int32
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
//// Automatically Generated From AxleBuiltins.gyb. Do Not Edit Directly ////
|
||||
//// To regenerate: ////
|
||||
//// ../../tools/gyb AxleBuiltins.gyb -o AxleBuiltins.swift ////
|
||||
|
||||
// 2.2.1 Vertex Functions
|
||||
@asmname="llvm.air.get_vertex_id"
|
||||
func getVertexId() -> Int32
|
||||
|
||||
@asmname="llvm.air.get_instance_id"
|
||||
func getInstanceId() -> Int32
|
||||
|
||||
// 2.3.1 Work-Item Functions
|
||||
@asmname="llvm.air.get_work_dim.i32"
|
||||
func getWorkDim() -> Int32
|
||||
|
||||
@asmname="llvm.air.get_global_id.i32"
|
||||
func getGlobalId(dimindx : Int32) -> Int32
|
||||
|
||||
@asmname="llvm.air.get_global_size.i32"
|
||||
func getGlobalSize(dimindx : Int32) -> Int32
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#
|
||||
# Determine AXLELIB_SOURCES, the list of source files in the swift library.
|
||||
#
|
||||
|
||||
# Ensure that cmake is re-run whenever AXLELibSources.txt changes.
|
||||
configure_file(SwiftAxleSources.txt SwiftAxleSources.txt.copy)
|
||||
|
||||
file(STRINGS SwiftAxleSources.txt AXLELIB_SOURCES)
|
||||
|
||||
# Remove Vec2h.swift for all architectures that don't support half.
|
||||
if (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL air)
|
||||
string(REPLACE ";Vec2h.swift" "" AXLELIB_SOURCES "${AXLELIB_SOURCES}")
|
||||
endif()
|
||||
|
||||
|
||||
# Strip comments and blank lines
|
||||
string(REGEX REPLACE " *#[^;]*" "" AXLELIB_SOURCES "${AXLELIB_SOURCES}")
|
||||
string(REGEX REPLACE ";;+" ";" AXLELIB_SOURCES "${AXLELIB_SOURCES}")
|
||||
|
||||
|
||||
set(SHARED_LIBRARY ON)
|
||||
add_swift_library(swift_stdlib_axle INSTALL AXLE
|
||||
${AXLELIB_SOURCES}
|
||||
DEPENDS swift_stdlib_core)
|
||||
|
||||
add_swift_optimization_flags(swift_stdlib_axle)
|
||||
@@ -1,64 +0,0 @@
|
||||
##===- stdlib/axle/Makefile --------------------------------*- Makefile -*-===##
|
||||
#
|
||||
# This source file is part of the Swift.org open source project
|
||||
#
|
||||
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
||||
# Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
#
|
||||
# See http://swift.org/LICENSE.txt for license information
|
||||
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
SWIFT_LEVEL := ../..
|
||||
include $(SWIFT_LEVEL)/../../Makefile.config
|
||||
|
||||
LIBRARYNAME := swift_axle
|
||||
LINK_LIBS_IN_SHARED := 1
|
||||
SHARED_LIBRARY := 1
|
||||
|
||||
#
|
||||
# Determine SWIFT_SOURCES, the list of source files in the swift library.
|
||||
#
|
||||
# sed is used here to strip comments.
|
||||
SWIFT_SOURCES := $(shell sed -e "s/\#.*//g" "$(PROJ_SRC_DIR)/tools/swift/stdlib/axle/SwiftAxleSources.txt" )
|
||||
|
||||
# Replace Assert.swift with AssertDebug.swift if assertions are enabled
|
||||
ifneq ($(DISABLE_ASSERTIONS),1)
|
||||
SWIFT_SOURCES := $(subst Assert.swift,AssertDebug.swift,$(SWIFT_SOURCES))
|
||||
endif
|
||||
|
||||
# Remove half (f16) from compiling on anything but for air arch.
|
||||
ifneq ($(ARCH),air)
|
||||
SWIFT_SOURCES := $(filter-out Vec2h.swift,$(SWIFT_SOURCES))
|
||||
endif
|
||||
|
||||
#
|
||||
# Done with SWIFT_SOURCES
|
||||
#
|
||||
|
||||
SOURCES := axle.swift
|
||||
NO_BUILD_ARCHIVE := 1
|
||||
|
||||
include $(SWIFT_LEVEL)/Makefile
|
||||
|
||||
LDFLAGS += -lswift_stdlib_core
|
||||
|
||||
PATH_TO_SWIFT_SOURCES := $(addprefix $(PROJ_SRC_DIR)/, $(SWIFT_SOURCES))
|
||||
|
||||
$(AXLE_SWIFT_HEADER_DIR):
|
||||
$(MKDIR) $(AXLE_SWIFT_HEADER_DIR)
|
||||
|
||||
$(AXLE_SWIFT_HEADER_DIR)/axle.swiftmodule: $(ObjDir)/axle.o $(AXLE_SWIFT_HEADER_DIR)
|
||||
|
||||
$(ObjDir)/axle.o: $(PATH_TO_SWIFT_SOURCES) $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE) $(SWIFT_COMPILER) $(LibDir)/libswift_runtime.a $(AXLE_SWIFT_HEADER_DIR)
|
||||
$(Echo) "Compiling $(notdir $@) for $(BuildMode) build"
|
||||
$(Verb) $(SWIFT_COMPILER) $(SWIFT_FLAGS) -o $@ -c -emit-module -module-link-name $(LIBRARYNAME) -parse-as-library $(PATH_TO_SWIFT_SOURCES)
|
||||
@mv $(ObjDir)/axle.swiftmodule $(AXLE_SWIFT_HEADER_DIR)
|
||||
|
||||
$(SharedLibDir)/swift/%.$(SHLIBEXT): $(SharedLibDir)/swift/.dir
|
||||
ln -s ../$(@F) $@
|
||||
|
||||
$(SharedLibDir)/%.$(SHLIBEXT): $(SharedLibDir)/swift/%.$(SHLIBEXT)
|
||||
|
||||
all-local:: $(AXLE_SWIFT_HEADER_DIR)/axle.swiftmodule
|
||||
@@ -1,9 +0,0 @@
|
||||
#
|
||||
# This file lists the sources for the swift standard library in a
|
||||
# common place that can be used by both CMake and Make. It should
|
||||
# always begin with a comment. Filenames should not contain spaces
|
||||
# and should be listed one-per-line. Comments, which are ignored,
|
||||
# begin with "#" and extend to the end of the line.
|
||||
#
|
||||
AxleBuiltins.swift
|
||||
#Matrix4f.swift
|
||||
@@ -1,36 +0,0 @@
|
||||
#
|
||||
# This file lists the sources for the swift standard library in a
|
||||
# common place that can be used by both CMake and Make. It should
|
||||
# always begin with a comment. Filenames should not contain spaces
|
||||
# and should be listed one-per-line. Comments, which are ignored,
|
||||
# begin with "#" and extend to the end of the line.
|
||||
#
|
||||
Policy.swift
|
||||
Bool.swift
|
||||
Word.swift # Replaced by build system with Word32.swift or Word64.swift
|
||||
FixedPoint.swift
|
||||
Float32.swift
|
||||
Float64.swift
|
||||
Object.swift
|
||||
UnsafePointer.swift
|
||||
CTypes.swift
|
||||
Misc.swift
|
||||
Indexable.swift
|
||||
Range.swift
|
||||
Slice.swift
|
||||
HeapBuffer.swift
|
||||
StringByte.swift
|
||||
Optional.swift
|
||||
String.swift
|
||||
Char.swift
|
||||
Vector.swift
|
||||
Algorithm.swift
|
||||
OutputStream.swift
|
||||
LifetimeManager.swift
|
||||
CString.swift
|
||||
CodePoints.swift
|
||||
AssertCommon.swift
|
||||
Assert.swift # May be replaced by build system with AssertDebug.swift
|
||||
VecBool.swift
|
||||
VecFloat.swift
|
||||
VecInt.swift
|
||||
@@ -49,36 +49,14 @@ set_target_properties(swift_stdlib_core PROPERTIES
|
||||
LINK_FLAGS "-all_load -Xlinker -reexport-lobjc")
|
||||
add_dependencies(swift_stdlib_core swift)
|
||||
|
||||
|
||||
# Create the symlinks necessary to get the compiler to find the
|
||||
# swift runtime during development with Xcode.
|
||||
add_custom_command(TARGET swift_stdlib_core PRE_BUILD
|
||||
COMMAND ln "-fhs" "${SWIFTLIB_DIR}" "${CMAKE_BINARY_DIR}/bin/lib"
|
||||
COMMAND mkdir "-p" "${SWIFTLIB_DIR}/swift"
|
||||
COMMAND mkdir "-p" "${SWIFTLIB_DIR}/axle"
|
||||
COMMAND ln "-fhs" "${SWIFT_PATH_TO_CLANG_BUILD}/lib/clang" "${SWIFTLIB_DIR}/swift/clang")
|
||||
|
||||
|
||||
# The stdlib will be cut down further than what we have included here.
|
||||
configure_file(AxleSwiftLibSources.txt AxleSwiftLibSources.txt.copy)
|
||||
file(STRINGS AxleSwiftLibSources.txt AXLE_SWIFTLIB_SOURCES)
|
||||
string(REPLACE ";Word.swift" ";Word${word_size}.swift" AXLE_SWIFTLIB_SOURCES "${AXLE_SWIFTLIB_SOURCES}")
|
||||
if(SWIFT_ASSERTS)
|
||||
string(REPLACE ";Assert.swift" ";AssertDebug.swift" AXLE_SWIFTLIB_SOURCES "${AXLE_SWIFTLIB_SOURCES}")
|
||||
endif()
|
||||
# Strip comments and blank lines
|
||||
string(REGEX REPLACE " *#[^;]*" "" AXLE_SWIFTLIB_SOURCES "${AXLE_SWIFTLIB_SOURCES}")
|
||||
string(REGEX REPLACE ";;+" ";" AXLE_SWIFTLIB_SOURCES "${AXLE_SWIFTLIB_SOURCES}")
|
||||
|
||||
add_swift_library(swift_stdlib_axle_core INSTALL AXLE IS_STDLIB_CORE
|
||||
${AXLE_SWIFTLIB_SOURCES}
|
||||
DEPENDS swift_runtime)
|
||||
add_dependencies(swift_stdlib_axle_core swift)
|
||||
add_swift_optimization_flags(swift_stdlib_axle_core)
|
||||
set_target_properties(swift_stdlib_axle_core PROPERTIES
|
||||
LINK_FLAGS "-all_load -Xlinker -reexport-lobjc")
|
||||
add_dependencies(swift_stdlib_axle_core swift)
|
||||
|
||||
|
||||
# Install Clang headers under the Swift library so that an installed swift's
|
||||
# module importer can find the compiler headers corresponding to its clang.
|
||||
install(
|
||||
|
||||
@@ -22,7 +22,6 @@ SHARED_LIBRARY := 1
|
||||
#
|
||||
# sed is used here to strip comments.
|
||||
SWIFT_SOURCES := $(shell sed -e "s/\#.*//g" "$(PROJ_SRC_DIR)/tools/swift/stdlib/core/SwiftLibSources.txt" )
|
||||
AXLE_SWIFT_SOURCES := $(shell sed -e "s/\#.*//g" "$(PROJ_SRC_DIR)/tools/swift/stdlib/core/AxleSwiftLibSources.txt" )
|
||||
|
||||
# Replace Word.swift with Word64.swift or Word32.swift, according to
|
||||
# the target architecture
|
||||
@@ -73,30 +72,9 @@ $(ObjDir)/swift.o: $(PATH_TO_SWIFT_SOURCES) $(ObjDir)/.dir $(BUILT_SOURCES) $(PR
|
||||
$(Verb) $(SWIFT_COMPILER) $(SWIFT_FLAGS) -module-name=swift -emit-module -module-link-name $(LIBRARYNAME) -parse-stdlib -parse-as-library $(PATH_TO_SWIFT_SOURCES) -c -o $@
|
||||
@mv $(ObjDir)/swift.swiftmodule $(SWIFT_HEADER_DIR)
|
||||
|
||||
|
||||
# Build Axle version of the stdlib.
|
||||
AXLE_SWIFT_SOURCES := $(subst Word.swift,Word$(WORD_SIZE).swift,$(AXLE_SWIFT_SOURCES))
|
||||
ifneq ($(DISABLE_ASSERTIONS),1)
|
||||
AXLE_SWIFT_SOURCES := $(subst Assert.swift,AssertDebug.swift,$(AXLE_SWIFT_SOURCES))
|
||||
endif
|
||||
|
||||
PATH_TO_AXLE_SWIFT_SOURCES := $(addprefix $(PROJ_SRC_DIR)/, $(AXLE_SWIFT_SOURCES))
|
||||
$(AXLE_SWIFT_HEADER_DIR)/swift.swiftmodule: $(ObjDir)/swift_axle.o $(AXLE_SWIFT_HEADER_DIR)
|
||||
|
||||
$(AXLE_SWIFT_HEADER_DIR):
|
||||
$(MKDIR) $(AXLE_SWIFT_HEADER_DIR)
|
||||
|
||||
# Serialize builds of swift module since they are using the same module name.
|
||||
$(ObjDir)/swift_axle.o: $(PATH_TO_AXLE_SWIFT_SOURCES) $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE) $(SWIFT_COMPILER) $(LibDir)/libswift_runtime.a $(AXLE_SWIFT_HEADER_DIR) $(ObjDir)/swift.o
|
||||
$(Echo) "Compiling $(notdir $@) for $(BuildMode) build"
|
||||
$(Verb) $(SWIFT_COMPILER) $(SWIFT_FLAGS) -o $@ -c -emit-module -module-name swift -parse-stdlib -parse-as-library $(PATH_TO_AXLE_SWIFT_SOURCES)
|
||||
$(Echo) "mv $(ObjDir)/swift.swiftmodule $(AXLE_SWIFT_HEADER_DIR)"
|
||||
@mv $(ObjDir)/swift.swiftmodule $(AXLE_SWIFT_HEADER_DIR)
|
||||
|
||||
|
||||
$(SharedLibDir)/swift/%.$(SHLIBEXT): $(SharedLibDir)/swift/.dir
|
||||
ln -s ../$(@F) $@
|
||||
|
||||
$(SharedLibDir)/%.$(SHLIBEXT): $(SharedLibDir)/swift/%.$(SHLIBEXT)
|
||||
|
||||
all-local:: $(SWIFT_HEADER_DIR)/swift.swiftmodule $(AXLE_SWIFT_HEADER_DIR)/swift.swiftmodule
|
||||
all-local:: $(SWIFT_HEADER_DIR)/swift.swiftmodule
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// RUN: %swift -std=axle -triple x86_64-apple-darwin10 %s -emit-llvm | FileCheck %s
|
||||
|
||||
@kernel func ktest() {
|
||||
// Compute functions
|
||||
getWorkDim()
|
||||
getGlobalId(0)
|
||||
getGlobalSize(1)
|
||||
}
|
||||
|
||||
// CHECK-LABEL: call i32 @llvm.air.get_work_dim.i32()
|
||||
// CHECK-LABEL: call i32 @llvm.air.get_global_id.i32(i32 0)
|
||||
// CHECK-LABEL: call i32 @llvm.air.get_global_size.i32(i32 1)
|
||||
|
||||
@vertex func vtest() {
|
||||
// Vertex functions
|
||||
getVertexId()
|
||||
getInstanceId()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: call i32 @llvm.air.get_vertex_id()
|
||||
// CHECK-LABEL: call i32 @llvm.air.get_instance_id()
|
||||
Reference in New Issue
Block a user