def test_common_options_full(self): args = self.default_args() args.enable_asan = True args.enable_ubsan = True args.export_compile_commands = True args.distcc = True args.cmake_generator = 'Xcode' args.clang_user_visible_version = CompilerVersion( string_representation="9.0.0", components=("9", "0", "0", None)) args.clang_compiler_version = CompilerVersion( string_representation="999.0.900", components=("999", "0", "900", None)) args.build_ninja = True cmake = self.cmake(args) self.assertEqual(list(cmake.common_options()), [ "-G", "Xcode", "-DLLVM_USE_SANITIZER=Address;Undefined", "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON", "-DCMAKE_C_COMPILER:PATH=" + self.mock_distcc_path(), "-DCMAKE_C_COMPILER_ARG1=/path/to/clang", "-DCMAKE_CXX_COMPILER:PATH=" + self.mock_distcc_path(), "-DCMAKE_CXX_COMPILER_ARG1=/path/to/clang++", "-DCMAKE_CONFIGURATION_TYPES=" + "Debug;Release;MinSizeRel;RelWithDebInfo", "-DLLVM_VERSION_MAJOR:STRING=9", "-DLLVM_VERSION_MINOR:STRING=0", "-DLLVM_VERSION_PATCH:STRING=0", "-DCLANG_VERSION_MAJOR:STRING=9", "-DCLANG_VERSION_MINOR:STRING=0", "-DCLANG_VERSION_PATCH:STRING=0" ])
def test_common_options_clang_compiler_version(self): args = self.default_args() args.clang_compiler_version = CompilerVersion( string_representation="999.0.999", components=("999", "0", "999", None)) cmake = self.cmake(args) self.assertEqual(list(cmake.common_options()), [ "-G", "Ninja", "-DCMAKE_C_COMPILER:PATH=/path/to/clang", "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++", "-DCMAKE_MAKE_PROGRAM=" + self.which_ninja(args) ])
def test_common_options_clang_compiler_version(self): args = self.default_args() args.clang_compiler_version = CompilerVersion( string_representation="3.8.0", components=("3", "8", "0", None)) cmake = self.cmake(args) self.assertEqual(list(cmake.common_options()), [ "-G", "Ninja", "-DCMAKE_C_COMPILER:PATH=/path/to/clang", "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++", "-DLLVM_VERSION_MAJOR:STRING=3", "-DLLVM_VERSION_MINOR:STRING=8", "-DLLVM_VERSION_PATCH:STRING=0" ])
def test_common_options_clang_user_visible_version(self): args = self.default_args() args.clang_user_visible_version = CompilerVersion( string_representation="9.0.0", components=("9", "0", "0", None)) cmake = self.cmake(args) self.assertEqual(list(cmake.common_options()), [ "-G", "Ninja", "-DCMAKE_C_COMPILER:PATH=/path/to/clang", "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++", "-DLLVM_VERSION_MAJOR:STRING=9", "-DLLVM_VERSION_MINOR:STRING=0", "-DLLVM_VERSION_PATCH:STRING=0", "-DCLANG_VERSION_MAJOR:STRING=9", "-DCLANG_VERSION_MINOR:STRING=0", "-DCLANG_VERSION_PATCH:STRING=0", "-DCMAKE_MAKE_PROGRAM=" + self.which_ninja(args) ])