Experimental support for building with Clang under Linux.

Skip building file I/O files as these are currently Windows only.
This commit is contained in:
Lewis Baker 2017-07-18 08:13:41 +09:30
parent be43f4ac7e
commit 5e0dbf5f64
5 changed files with 79 additions and 13 deletions

2
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "cake"]
path = tools/cake
url = https://github.com/lewissbaker/cake.git
branch = master
branch = clang

View File

@ -145,3 +145,65 @@ if cake.system.isWindows() or cake.system.isCygwin():
except CompilerNotFoundError, e:
print str(e)
elif cake.system.isLinux():
from cake.library.compilers.clang import ClangCompiler
clangVariant = baseVariant.clone(compiler='clang',
platform='linux',
architecture='x64')
compiler = ClangCompiler(
configuration=configuration,
clangExe='/usr/bin/clang-5.0',
llvmArExe='/usr/bin/llvm-ar-5.0',
binPaths=['/usr/bin'])
compiler.addCppFlag('-std=c++1z')
compiler.addCppFlag('-fcoroutines-ts')
compiler.addCppFlag('-m64')
# Set this to the install-prefix of where libc++-5.0 is installed.
libCxxInstallPrefix = None # '/path/to/install'
if libCxxInstallPrefix:
compiler.addCppFlag('-nostdinc++')
compiler.addIncludePath(cake.path.join(
libCxxInstallPrefix, 'include', 'c++', 'v1'))
compiler.addLibraryPath(cake.path.join(
libCxxInstallPrefix, 'lib'))
else:
compiler.addCppFlag('-stdlib=libc++')
compiler.addLibrary('c++')
compiler.addLibrary('c++abi')
compiler.addLibrary('c')
compiler.addLibrary('pthread')
#compiler.addProgramFlag('-Wl,--trace')
#compiler.addProgramFlag('-Wl,-v')
clangVariant.tools['compiler'] = compiler
env = clangVariant.tools["env"]
env["COMPILER"] = "clang"
env["COMPILER_VERSION"] = "5.0"
env["PLATFORM"] = "linux"
env["ARCHITECTURE"] = "x64"
clangDebugVariant = clangVariant.clone(release='debug')
clangDebugVariant.tools["env"]["RELEASE"] = 'debug'
# TODO: Configure debug-specific settings here
compiler = clangDebugVariant.tools["compiler"]
configuration.addVariant(clangDebugVariant)
clangOptimisedVariant = clangVariant.clone(release='optimised')
clangOptimisedVariant.tools["env"]["RELEASE"] = 'optimised'
# TODO: Configure optimised-specific settings here
compiler = clangOptimisedVariant.tools["compiler"]
configuration.addVariant(clangOptimisedVariant)

View File

@ -50,15 +50,6 @@ sources = script.cwd([
'cancellation_token.cpp',
'cancellation_source.cpp',
'cancellation_registration.cpp',
'io_service.cpp',
'file.cpp',
'readable_file.cpp',
'writable_file.cpp',
'read_only_file.cpp',
'write_only_file.cpp',
'read_write_file.cpp',
'file_read_operation.cpp',
'file_write_operation.cpp',
])
extras = script.cwd([
@ -72,6 +63,15 @@ if variant.platform == "windows":
]))
sources.extend(script.cwd([
'win32.cpp',
'io_service.cpp',
'file.cpp',
'readable_file.cpp',
'writable_file.cpp',
'read_only_file.cpp',
'write_only_file.cpp',
'read_write_file.cpp',
'file_read_operation.cpp',
'file_write_operation.cpp',
]))
buildDir = env.expand('${CPPCORO_BUILD}')

View File

@ -27,10 +27,14 @@ sources = script.cwd([
'shared_lazy_task_tests.cpp',
'shared_task_tests.cpp',
'task_tests.cpp',
'io_service_tests.cpp',
'file_tests.cpp',
])
if variant.platform == 'windows':
sources += script.cwd([
'io_service_tests.cpp',
'file_tests.cpp',
])
extras = script.cwd([
'build.cake',
])

@ -1 +1 @@
Subproject commit ccb64fd82ea829cdda5f2053edccc70346c5125a
Subproject commit e63b4cb5dd0936c776e10f0d43e4f5855516acbd