diff --git a/.gitmodules b/.gitmodules index 61907af..452d37a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "cake"] path = tools/cake url = https://github.com/lewissbaker/cake.git - branch = master \ No newline at end of file + branch = clang diff --git a/config.cake b/config.cake index 97b9bbb..34dfc40 100644 --- a/config.cake +++ b/config.cake @@ -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) diff --git a/lib/build.cake b/lib/build.cake index 83480d6..102932c 100644 --- a/lib/build.cake +++ b/lib/build.cake @@ -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}') diff --git a/test/build.cake b/test/build.cake index 6e39b3e..45c6241 100644 --- a/test/build.cake +++ b/test/build.cake @@ -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', ]) diff --git a/tools/cake b/tools/cake index ccb64fd..e63b4cb 160000 --- a/tools/cake +++ b/tools/cake @@ -1 +1 @@ -Subproject commit ccb64fd82ea829cdda5f2053edccc70346c5125a +Subproject commit e63b4cb5dd0936c776e10f0d43e4f5855516acbd