def test_add_artefact_target_outputs(self):
        """Add Artefact Target Outputs"""

        self.data_test['cmake'] = get_cmake_lists(self.cur_dir)
        under_test = ProjectVariables(self.data_test)

        under_test.add_artefact_target_outputs()

        self.data_test['cmake'].close()

        cmakelists_test = open('%s/CMakeLists.txt' % self.cur_dir, 'r')
        content_test = cmakelists_test.read()

        self.assertTrue(
            'set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}")'
            in content_test)
        self.assertTrue(
            'set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}")'
            in content_test)
        self.assertTrue(
            'set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}'
            in content_test)

        self.assertTrue(
            'set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}")'
            in content_test)
        self.assertTrue(
            'set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}")'
            in content_test)
        self.assertTrue(
            'set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}'
            in content_test)

        cmakelists_test.close()
    def test_add_artefact_target_outputs(self):
        """Add Artefact Target Outputs"""

        self.data_test['cmake'] = get_cmake_lists(self.cur_dir)
        under_test = ProjectVariables(self.data_test)

        under_test.add_artefact_target_outputs()

        self.data_test['cmake'].close()

        cmakelists_test = open('%s/CMakeLists.txt' % self.cur_dir, 'r')
        content_test = cmakelists_test.read()

        self.assertTrue(
            'set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}")' in content_test
        )
        self.assertTrue(
            'set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}")' in content_test
        )
        self.assertTrue(
            'set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}' in content_test
        )

        self.assertTrue(
            'set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}")' in content_test
        )
        self.assertTrue(
            'set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}")' in content_test
        )
        self.assertTrue(
            'set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}' in content_test
        )

        cmakelists_test.close()
示例#3
0
    def create_data(self):
        """
        Create the data and convert each part of "vcxproj" project

        """

        # Write variables
        variables = ProjectVariables(self.data)
        variables.add_project_variables()
        variables.add_outputs_variables()

        files = ProjectFiles(self.data)
        files.write_files_variables()
        variables.add_cmake_project(files.language)
        variables.add_default_target()

        # Write Macro
        define_and_write_macro(self.data)

        # Write Output Variables
        variables.add_artefact_target_outputs()

        # Write Include Directories
        depends = Dependencies(self.data)
        if self.data['includes']:
            depends.write_include_dir()
        else:
            send('Include Directories is not set.', '')

        # Write Dependencies
        depends.write_dependencies()

        # Add additional code or not
        if self.data['additional_code'] is not None:
            files.add_additional_code(self.data['additional_code'])

        # Write Flags
        all_flags = Flags(self.data)
        all_flags.write_flags()

        # Write and add Files
        files.write_source_files()
        files.add_target_artefact()

        # Link with other dependencies
        depends.link_dependencies()
示例#4
0
    def create_data(self):
        """
        Create the data and convert each part of vcxproj project

        """

        # Write variables
        variables = ProjectVariables(self.data)
        variables.add_project_variables()
        variables.add_outputs_variables()

        files = ProjectFiles(self.data)
        files.write_files_variables()
        variables.add_cmake_project(files.language)
        variables.add_default_target()

        # Write Macro
        define_and_write_macro(self.data)

        # Write Output Variables
        variables.add_artefact_target_outputs()

        # Write Include Directories
        depends = Dependencies(self.data)
        if self.data['includes']:
            depends.write_include_dir()
        else:
            send('Include Directories is not set.', '')

        # Write Dependencies
        depends.write_dependencies()

        # Add additional code or not
        if self.data['additional_code'] is not None:
            files.add_additional_code(self.data['additional_code'])

        # Write Flags
        all_flags = Flags(self.data)
        all_flags.write_flags()

        # Write and add Files
        files.write_source_files()
        files.add_target_artefact()

        # Link with other dependencies
        depends.link_dependencies()