Skip to content

Commit

Permalink
Template update of I2S Analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus10110 committed Jul 13, 2018
1 parent f06b3fc commit 2960f4a
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/I2sSimulationDataGenerator.cpp
src/I2sSimulationDataGenerator.h
)

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

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

set_post_build_destination(i2s_analyzer)
add_analyzer_plugin(i2s_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/I2sAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "I2sSimulationDataGenerator.h"

class I2sAnalyzerSettings;
class ANALYZER_EXPORT I2sAnalyzer : public Analyzer2
class I2sAnalyzer : public Analyzer2
{
public:
I2sAnalyzer();
Expand Down

0 comments on commit 2960f4a

Please sign in to comment.