Skip to content

Commit

Permalink
Template update of 1-Wire Analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus10110 committed Jul 13, 2018
1 parent 1c37b9d commit 96f9a7c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
11 changes: 1 addition & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,4 @@ src/OneWireSimulationDataGenerator.cpp
src/OneWireSimulationDataGenerator.h
)

add_library(one_wire_analyzer SHARED ${SOURCES})
target_link_libraries(one_wire_analyzer PRIVATE Saleae::AnalyzerSDK)

if(MSVC)
install(TARGETS one_wire_analyzer RUNTIME DESTINATION "Analyzers")
else()
install(TARGETS one_wire_analyzer LIBRARY DESTINATION "Analyzers")
endif()

set_post_build_destination(one_wire_analyzer)
add_analyzer_plugin(one_wire_analyzer SOURCES ${SOURCES})
25 changes: 17 additions & 8 deletions cmake/ExternalAnalyzerSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,20 @@ if(NOT TARGET Saleae::AnalyzerSDK)
endif()
endif()

# Optionally copy the compiled library after build to ${POST_BUILD_DESTINATION}, if POST_BUILD_DESTINATION is defined.
macro(set_post_build_destination target_name)
if(DEFINED POST_BUILD_DESTINATION)
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${target_name}> ${POST_BUILD_DESTINATION})
endif()
endmacro()
function(add_analyzer_plugin TARGET)
set(options )
set(single_value_args )
set(multi_value_args SOURCES)
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${ARGN} )


add_library(${TARGET} MODULE ${_p_SOURCES})
target_link_libraries(${TARGET} PRIVATE Saleae::AnalyzerSDK)

set(ANALYZER_DESTINATION "Analyzers")
install(TARGETS ${TARGET} RUNTIME DESTINATION ${ANALYZER_DESTINATION}
LIBRARY DESTINATION ${ANALYZER_DESTINATION})

set_target_properties(${TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${ANALYZER_DESTINATION}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${ANALYZER_DESTINATION})
endfunction()
2 changes: 1 addition & 1 deletion src/OneWireAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const U64 SPEC_SAMPLE_POINT = 19;
const U64 SPEC_OVD_SAMPLE_POINT = 3;


class ANALYZER_EXPORT OneWireAnalyzer : public Analyzer2
class OneWireAnalyzer : public Analyzer2
{
public:
OneWireAnalyzer();
Expand Down

0 comments on commit 96f9a7c

Please sign in to comment.