<commit_before># Copyright 2018 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#.rst:
# FindVerilator
# --------
#
# Find Verilator
#
# ::
#
#   VERILATOR_EXECUTABLE    - Verilator
#   VERILATOR_FOUND         - true if Verilator found

if (VERILATOR_FOUND)
    return()
endif()

find_package(PackageHandleStandardArgs REQUIRED)

include(SystemCPackage)
if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
    include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
endif()
find_program(VERILATOR_EXECUTABLE 
    NAMES verilator_bin verilator_bin_dbg
    HINTS ${CONAN_VERILATOR_ROOT} ENV VERILATOR_ROOT
    PATH_SUFFIXES bin
    REQUIRED
    DOC "Path to the Verilator executable"
)

find_program(VERILATOR_COVERAGE_EXECUTABLE 
	NAMES verilator_coverage_bin verilator_coverage_bin_dbg
    HINTS ${CONAN_VERILATOR_ROOT} ENV VERILATOR_ROOT
    PATH_SUFFIXES bin
    REQUIRED
    DOC "Path to the Verilator coverage executable"
)

if(${CONAN_VERILATOR_ROOT})
    set (ENV{VERILATOR_ROOT} ${CONAN_VERILATOR_ROOT}) 
    set (VERILATOR_EXECUTABLE_DIR ${CONAN_BIN_DIRS_VERILATOR})
    set (VERILATOR_INCLUDE_DIR ${CONAN_INCLUDE_DIRS_VERILATOR})
else()
    get_filename_component(VERILATOR_EXECUTABLE_DIR ${VERILATOR_EXECUTABLE}
        DIRECTORY)
    find_path(VERILATOR_INCLUDE_DIR verilated.h
        HINTS $ENV{VERILATOR_ROOT} ${VERILATOR_EXECUTABLE_DIR}/..
        PATH_SUFFIXES include share/verilator/include
        DOC "Path to the Verilator headers"
    )
endif()

mark_as_advanced(VERILATOR_EXECUTABLE)
mark_as_advanced(VERILATOR_COVERAGE_EXECUTABLE)
mark_as_advanced(VERILATOR_INCLUDE_DIR)

find_package_handle_standard_args(Verilator REQUIRED_VARS
    VERILATOR_EXECUTABLE VERILATOR_COVERAGE_EXECUTABLE VERILATOR_INCLUDE_DIR)

set_source_files_properties(
    ${VERILATOR_INCLUDE_DIR}/verilated_cov.cpp
    PROPERTIES
    COMPILE_DEFINITIONS "VM_COVERAGE=1"
)

set(SOURCES 
    ${VERILATOR_INCLUDE_DIR}/verilated.cpp
    ${VERILATOR_INCLUDE_DIR}/verilated_cov.cpp
    ${VERILATOR_INCLUDE_DIR}/verilated_dpi.cpp
    ${VERILATOR_INCLUDE_DIR}/verilated_vcd_c.cpp
    ${VERILATOR_INCLUDE_DIR}/verilated_vcd_sc.cpp
)

add_library(verilated STATIC ${SOURCES})

set_target_properties(verilated PROPERTIES
    ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
    LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
)

target_include_directories(verilated SYSTEM PUBLIC
    ${VERILATOR_INCLUDE_DIR}/vltstd
    ${VERILATOR_INCLUDE_DIR}<commit_msg>removes detection of verilator_coverage executable<commit_after># Copyright 2018 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#.rst:
# FindVerilator
# --------
#
# Find Verilator
#
# ::
#
#   VERILATOR_EXECUTABLE    - Verilator
#   VERILATOR_FOUND         - true if Verilator found

if (VERILATOR_FOUND)
    return()
endif()

find_package(PackageHandleStandardArgs REQUIRED)

include(SystemCPackage)
if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
    include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
endif()
find_program(VERILATOR_EXECUTABLE 
    NAMES verilator_bin verilator_bin_dbg
    HINTS ${CONAN_VERILATOR_ROOT} ENV VERILATOR_ROOT
    PATH_SUFFIXES bin
    REQUIRED
    DOC "Path to the Verilator executable"
)

if(${CONAN_VERILATOR_ROOT})
    set (ENV{VERILATOR_ROOT} ${CONAN_VERILATOR_ROOT}) 
    set (VERILATOR_EXECUTABLE_DIR ${CONAN_BIN_DIRS_VERILATOR})
    set (VERILATOR_INCLUDE_DIR ${CONAN_INCLUDE_DIRS_VERILATOR})
else()
    get_filename_component(VERILATOR_EXECUTABLE_DIR ${VERILATOR_EXECUTABLE}
        DIRECTORY)
    find_path(VERILATOR_INCLUDE_DIR verilated.h
        HINTS $ENV{VERILATOR_ROOT} ${VERILATOR_EXECUTABLE_DIR}/..
        PATH_SUFFIXES include share/verilator/include
        DOC "Path to the Verilator headers"
    )
endif()

mark_as_advanced(VERILATOR_EXECUTABLE)
mark_as_advanced(VERILATOR_INCLUDE_DIR)

find_package_handle_standard_args(Verilator REQUIRED_VARS
    VERILATOR_EXECUTABLE VERILATOR_INCLUDE_DIR)

set_source_files_properties(
    ${VERILATOR_INCLUDE_DIR}/verilated_cov.cpp
    PROPERTIES
    COMPILE_DEFINITIONS "VM_COVERAGE=1"
)

set(SOURCES 
    ${VERILATOR_INCLUDE_DIR}/verilated.cpp
    ${VERILATOR_INCLUDE_DIR}/verilated_cov.cpp
    ${VERILATOR_INCLUDE_DIR}/verilated_dpi.cpp
    ${VERILATOR_INCLUDE_DIR}/verilated_vcd_c.cpp
    ${VERILATOR_INCLUDE_DIR}/verilated_vcd_sc.cpp
)

add_library(verilated STATIC ${SOURCES})

set_target_properties(verilated PROPERTIES
    ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
    LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
)

target_include_directories(verilated SYSTEM PUBLIC
    ${VERILATOR_INCLUDE_DIR}/vltstd
    ${VERILATOR_INCLUDE_DIR}
{'fraction_non_alphanumeric': 0.077390527256479, 'fraction_numerical': 0.0032171581769436996, 'mean_word_length': 5.210876803551609, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4859858', 'n_tokens_mistral': 2070, 'n_tokens_neox': 1911, 'n_words': 385}