Skip to content

Instantly share code, notes, and snippets.

@netskink

netskink/pcmx.bb Secret

Last active October 13, 2016 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netskink/2cd7f2464a4ccc95fb5c3c771ea0a9d7 to your computer and use it in GitHub Desktop.
Save netskink/2cd7f2464a4ccc95fb5c3c771ea0a9d7 to your computer and use it in GitHub Desktop.
This worked prior to switching to a make install inside cmake
DESCRIPTION = "pcmx bitbake test application"
SUMMARY = "pcmx native, nativesdk and target build"
SECTION = "examples"
LICENSE = "CLOSED"
PR = "r0"
# maybe depends is wrong, orig depened upon opencv
# this will cause the cmake to be build for target which we don't want.
# DEPENDS = "cmake"
#DEPENDS = "nativesdk-gcc"
#DEPENDS = "libpcap-devel"
#DEPENDS = "libpcap"
#
# PCMX depends upon libpcap-dev. How to add if DEPENDS is not the method?
#
SRCREV = "${AUTOREV}"
SRCREV_FORMAT ?= "d3_d3v16_pcmx"
SRCREV_d3 ?= "${AUTOREV}"
SRCREV_d3v16 ?= "${AUTOREV}"
SRCREV_pcmx-native ?= "${AUTOREV}"
PV = "1.0.0+git${SRCPV}"
# My goal is to create a src dir like this
# git
# pcmx
# d3
# d3v16
#
# And have the cmake build kick off in the pcmx directory.
#
#
# This will create the dir structure above.
SRC_URI = " \
git://ssh@devsupport:22/tfs/DefaultCollection/jfdtesty/_git/d3;protocol=ssh;destsuffix=git/d3 \
git://ssh@devsupport:22/tfs/DefaultCollection/jfdtesty/_git/d3v16;protocol=ssh;destsuffix=git/d3v16 \
git://ssh@devsupport:22/tfs/DefaultCollection/jfdtesty/_git/pcmx;protocol=ssh;destsuffix=git/pcmx;branch=testy \
"
# this is used for copies and install
S = "${WORKDIR}/git/pcmx"
#inherit native cmake
inherit cmake
BBCLASSEXTEND = "native"
DEPENDS_class-target="pcmx-native"
DEPENDS_class-target += "libpcap"
DEPENDS_class-target += "ncurses"
#BBCLASSEXTEND = "native nativesdk"
#
# The target uses my custom NT_INSTALL_DIR prefix for doing $make install
# This is seperate from the CMAKE_PREFIX_DIR ? variable. If you use that one
# it will install to the proper place, but it interferes with searching for
# the generators. In this case, I want to search for generators in /usr/bin
# on the host/native build but then install on the target in /usr/bin/pcmx subtree.
#
# The ${D} is so that it does an install in my image file system and not the literal
# /usr/bin/ file system.
#
#EXTRA_OECMAKE_class-target = " -DBITBAKE_BUILD_MODE=target -DNT_INSTALL_DIR=${D}${bindir}/pcmx/"
EXTRA_OECMAKE_class-target = " -DBITBAKE_BUILD_MODE=target "
EXTRA_OECMAKE_class-native = " -DBITBAKE_BUILD_MODE=native "
# Do not need to run single threaded now
#PARALLEL_MAKE = ""
# B="${S}"
# TODO: this nees to be modified so that it only installs
# specific files to host.
do_install_class-native() {
install -d ${D}${bindir}
# # this does not work
# #install -m 0755 ${WORKDIR}/Tutorial ${D}${bindir}
# # this works
# old way
#install -m 0755 bin/*generator ${D}${bindir}
install -m 0755 ./src/logger/pcmx_logger_region_xml_generator ${D}${bindir}
install -m 0755 ./src/logger/logger_status_codes_generator ${D}${bindir}
install -m 0755 ./src/logger/logger_metrics_xml_generator ${D}${bindir}
install -m 0755 ./src/logger/logger_metrics_header_generator ${D}${bindir}
install -m 0755 ./src/sysmon/sysmon_metrics_header_generator ${D}${bindir}
install -m 0755 ./src/sysmon/sysmon_status_codes_generator ${D}${bindir}
install -m 0755 ./src/commlib/commlib_status_codes_generator ${D}${bindir}
install -m 0755 ./src/syslib/syslib_status_codes_generator ${D}${bindir}
install -m 0755 ./src/applib/applib_metrics_header_generator ${D}${bindir}
install -m 0755 ./src/applib/applib_rsync_metrics_header_generator ${D}${bindir}
install -m 0755 ./src/applib/applib_status_codes_generator ${D}${bindir}
install -m 0755 ./src/cdblib/cdblib_status_codes_generator ${D}${bindir}
install -m 0755 ./src/d3comm/d3comm_status_codes_generator ${D}${bindir}
install -m 0755 ./src/d3comm/pcmx_comm_link_stats_region_xml_generator ${D}${bindir}
install -m 0755 ./src/d3comm/d3comm_metrics_xml_generator ${D}${bindir}
install -m 0755 ./src/d3comm/d3comm_metrics_header_generator ${D}${bindir}
install -m 0755 ./src/d3comm/pcmx_comm_code_stats_region_xml_generator ${D}${bindir}
install -m 0755 ./src/leglib/leglib_status_codes_generator ${D}${bindir}
install -m 0755 ./src/loaderlib/loaderlib_status_codes_generator ${D}${bindir}
install -m 0755 ./src/loadmgr/loadmgr_status_codes_generator ${D}${bindir}
# old way
# install -m 0755 bin/lfotool.bin ${D}${bindir}
install -m 0755 ./build_utils/lfotool.bin ${D}${bindir}
}
# I'm going to rely on make install of cmake to handle this
#JFD20161012 do_install_class-target() {
#JFD20161012
#JFD20161012
#JFD20161012 install -d ${D}/${bindir}/pcmx/bin
#JFD20161012 install -d ${D}/${bindir}/pcmx/cfg
#JFD20161012 install -d ${D}/${bindir}/pcmx/lfo
#JFD20161012 install -d ${D}/${bindir}/pcmx/db
#JFD20161012 install -d ${D}/${bindir}/pcmx/lfo
#JFD20161012 install -d ${D}/${bindir}/pcmx/log
#JFD20161012 install -d ${D}/${bindir}/pcmx/sabl
#JFD20161012 install -d ${D}/${bindir}/pcmx/utils
#JFD20161012
#JFD20161012
#JFD20161012
#JFD20161012 # loadmgr
#JFD20161012 install -m 0755 ./src/loadmgr/loadmgr.bin ${D}/${bindir}/pcmx/bin
#JFD20161012
#JFD20161012 # d3comm
#JFD20161012 install -m 0755 ./src/d3comm/d3comm.bin ${D}/${bindir}/pcmx/bin
#JFD20161012 install -m 0755 ./lfo/d3comm.lfo ${D}/${bindir}/pcmx/lfo
#JFD20161012
#JFD20161012 # logger
#JFD20161012 install -m 0755 ./src/logger/logger.bin ${D}/${bindir}/pcmx/bin
#JFD20161012 install -m 0755 ./lfo/logger.lfo ${D}/${bindir}/pcmx/lfo
#JFD20161012
#JFD20161012 # utils
#JFD20161012 install -m 0644 ${S}/pcm_install/utils/linux/kernel_cmd_line.txt ${D}/${bindir}/pcmx/utils
#JFD20161012 install -m 0755 ${S}/pcm_install/utils/linux/clean.sh ${D}/${bindir}/pcmx/utils
#JFD20161012 install -m 0644 ${S}/pcm_install/utils/linux/psa_switch.txt ${D}/${bindir}/pcmx/utils
#JFD20161012 install -m 0755 ${S}/pcm_install/utils/linux/setenv.sh ${D}/${bindir}/pcmx/utils
#JFD20161012 install -m 0755 ${S}/pcm_install/utils/linux/coldstart_debug_init.sh ${D}/${bindir}/pcmx/utils
#JFD20161012
#JFD20161012 # cfg
#JFD20161012 install -m 0644 ${S}/src/loadmgr/loadmgr.xml ${D}/${bindir}/pcmx/cfg
#JFD20161012
#JFD20161012 }
# will this help?
# NO PACKAGE_CLASSES = "package_tar"
# This website is how they describe using the packages keyword
# http://www.embeddedlinux.org.cn/OEManual/recipes_packages.html
#
# I've tried to use the equals and it fails. It was suggested to try
# the append.
PACKAGES = "${PN}-dbg ${PN}"
# I've tried these as append and not using the PACKAGES keyword above and it failed.
FILES_${PN} = "\
${bindir}/pcmx/bin/* \
${bindir}/pcmx/cfg \
${bindir}/pcmx/db \
${bindir}/pcmx/log \
${bindir}/pcmx/sabl \
${bindir}/pcmx/lfo/* \
${bindir}/pcmx/utils/* \
${bindir}/pcmx/cfg/* \
"
FILES_${PN}-dbg = "\
${bindir}/pcmx/bin/*.debug \
"
#
# This either finds a previously built d3comm_status_codes_generator (exe)
# or it sets up the makefile to build it.
#
if(${BITBAKE_BUILD_MODE} STREQUAL "target")
#
# This finds the status codes generator executable for target builds
#
message(STATUS "Looking for d3comm_status_codes_generator exe")
find_program(D3COMM_STATUS_CODES_GENERATOR_EXE d3comm_status_codes_generator)
if(NOT D3COMM_STATUS_CODES_GENERATOR_EXE )
# this will message and exit cmake
message(FATAL_ERROR "Could not find ${D3COMM_STATUS_CODES_GENERATOR_EXE}")
endif()
add_executable(d3comm_status_codes_generator IMPORTED GLOBAL)
set_property(TARGET d3comm_status_codes_generator PROPERTY IMPORTED_LOCATION ${D3COMM_STATUS_CODES_GENERATOR_EXE})
message(STATUS "\tFound ***${D3COMM_STATUS_CODES_GENERATOR_EXE}***")
#
# This finds the metrics generator executable for target builds
#
message(STATUS "Looking for d3comm_metrics_header_generator exe")
find_program(D3COMM_METRICS_HEADER_GENERATOR_EXE d3comm_metrics_header_generator)
if(NOT D3COMM_METRICS_HEADER_GENERATOR_EXE )
# this will message and exit cmake
message(FATAL_ERROR "Could not find ${D3COMM_METRICS_HEADER_GENERATOR_EXE}")
endif()
add_executable(d3comm_metrics_header_generator IMPORTED GLOBAL)
set_property(TARGET d3comm_metrics_header_generator PROPERTY IMPORTED_LOCATION ${D3COMM_METRICS_HEADER_GENERATOR_EXE})
message(STATUS "\tFound ***${D3COMM_METRICS_HEADER_GENERATOR_EXE}***")
#
# This finds the pcmx comm link stats region xml generator executable for target builds
# This is used to make xml input file #1 for the .lfo
#
message(STATUS "Looking for pcmx_comm_link_stats_region_xml_generator exe")
find_program(PCMX_COMM_LINK_STATS_REGION_XML_GENERATOR_EXE pcmx_comm_link_stats_region_xml_generator)
if(NOT PCMX_COMM_LINK_STATS_REGION_XML_GENERATOR_EXE )
# this will message and exit cmake
message(FATAL_ERROR "Could not find ${PCMX_COMM_LINK_STATS_REGION_XML_GENERATOR_EXE}")
endif()
add_executable(pcmx_comm_link_stats_region_xml_generator IMPORTED GLOBAL)
set_property(TARGET pcmx_comm_link_stats_region_xml_generator PROPERTY IMPORTED_LOCATION ${PCMX_COMM_LINK_STATS_REGION_XML_GENERATOR_EXE})
message(STATUS "\tFound ***${PCMX_COMM_LINK_STATS_REGION_XML_GENERATOR_EXE}***")
#
# This finds the pcmx comm code stats region xml generator executable for target builds
# This is used to make xml input file #2 for the .lfo
#
message(STATUS "Looking for pcmx_comm_code_stats_region_xml_generator exe")
find_program(PCMX_COMM_CODE_STATS_REGION_XML_GENERATOR_EXE pcmx_comm_code_stats_region_xml_generator)
if(NOT PCMX_COMM_CODE_STATS_REGION_XML_GENERATOR_EXE )
# this will message and exit cmake
message(FATAL_ERROR "Could not find ${PCMX_COMM_CODE_STATS_REGION_XML_GENERATOR_EXE}")
endif()
add_executable(pcmx_comm_code_stats_region_xml_generator IMPORTED GLOBAL)
set_property(TARGET pcmx_comm_code_stats_region_xml_generator PROPERTY IMPORTED_LOCATION ${PCMX_COMM_CODE_STATS_REGION_XML_GENERATOR_EXE})
message(STATUS "\tFound ***${PCMX_COMM_CODE_STATS_REGION_XML_GENERATOR_EXE}***")
#
# This finds the pcmx comm code stats region xml generator executable for target builds
# This is used to make xml input file #3 for the .lfo
#
message(STATUS "Looking for d3comm_metrics_xml_generator exe")
find_program(D3COMM_METRICS_XML_GENERATOR_EXE d3comm_metrics_xml_generator)
if(NOT D3COMM_METRICS_XML_GENERATOR_EXE )
# this will message and exit cmake
message(FATAL_ERROR "Could not find ${D3COMM_METRICS_XML_GENERATOR_EXE}")
endif()
add_executable(d3comm_metrics_xml_generator IMPORTED GLOBAL)
set_property(TARGET d3comm_metrics_xml_generator PROPERTY IMPORTED_LOCATION ${D3COMM_METRICS_XML_GENERATOR_EXE})
message(STATUS "\tFound ***${D3COMM_METRICS_XML_GENERATOR_EXE}***")
else() # for host/native building
#
# This builds the d3comm_metrics_header_generator exe which makes:
# o xxx_metrics_defs_map.cpp
# o xxx_metrics_defs.h
#
set(d3comm_metrics_header_generator_sources ../../build_utils/metrics_kit_generator.cpp)
add_executable(d3comm_metrics_header_generator ${d3comm_metrics_header_generator_sources})
target_link_libraries(d3comm_metrics_header_generator cppreflection)
target_include_directories(d3comm_metrics_header_generator PUBLIC ${CMAKE_BINARY_DIR}/gen/)
# This method specifes both the preprocessor definition and the include files to include on command line.
set_target_properties(d3comm_metrics_header_generator
PROPERTIES
COMPILE_DEFINITIONS GENERATE_DESCRIPTOR
COMPILE_FLAGS
"-include${CPPREFLECTION_HEADERS}/reflect.h \
-include${CPPREFLECTION_HEADERS}/typedecl.h \
-include${CMAKE_SOURCE_DIR}/src/d3comm/d3comm_metrics_decls.h"
)
target_include_directories(d3comm_metrics_header_generator PUBLIC ../../build_utils)
#
# This builds the d3comm_status_codes_generator exe which makes d3comm_status_codes.h file.
#
set(d3comm_status_codes_generator_sources d3comm_gen_status_codes.cpp)
add_executable(d3comm_status_codes_generator ${d3comm_status_codes_generator_sources})
add_dependencies(d3comm_status_codes_generator PROXY_D3COMM_METRICS_SOURCE)
target_include_directories(d3comm_status_codes_generator PUBLIC ${CMAKE_BINARY_DIR}/src/d3comm/)
#
# This makes the pcmx_comm_link_stats_region_xml_generator (exe).
# Its used to make the .xml for use with the lfo tool
# This is for xml file #1
#
# pcmx_comm_link_stats_region_decls.h is in inc folder
SET(XML_GENERATOR "pcmx_comm_link_stats_region_decls.h")
configure_file(${CMAKE_SOURCE_DIR}/build_utils/xml_descriptor_generator.cpp
${CMAKE_BINARY_DIR}/gen/pcmx_comm_link_stats_region_xml_descriptor_generator.cpp
@ONLY)
add_executable(pcmx_comm_link_stats_region_xml_generator
${CMAKE_BINARY_DIR}/gen/pcmx_comm_link_stats_region_xml_descriptor_generator.cpp)
add_custom_target(PROXY_PCMX_COMM_LINK_STATS_REGION_XML_DESCRIPTOR_GENERATOR
DEPENDS ${CMAKE_BINARY_DIR}/gen/pcmx_comm_link_stats_region_xml_descriptor_generator.cpp)
set_target_properties(pcmx_comm_link_stats_region_xml_generator
PROPERTIES
COMPILE_DEFINITIONS GENERATE_DESCRIPTOR
)
target_include_directories(pcmx_comm_link_stats_region_xml_generator PUBLIC ${CPPREFLECTION_HEADERS})
target_include_directories(pcmx_comm_link_stats_region_xml_generator PUBLIC ${CMAKE_BINARY_DIR}/src/d3comm)
target_link_libraries(pcmx_comm_link_stats_region_xml_generator tinyxml)
target_link_libraries(pcmx_comm_link_stats_region_xml_generator cppreflection)
# need this but cannot do it add_dependencies(d3comm_metrics_xml_generator d3comm_metrics_defs.h)
add_dependencies(pcmx_comm_link_stats_region_xml_generator PROXY_D3COMM_METRICS_SOURCE)
#
# This makes the pcmx_comm_code_stats_region_xml_generator (exe).
# Its used to make the .xml for use with the lfo tool
# This is for xml file #2
#
# pcmx_comm_code_stats_region_decls.h is in inc folder
SET(XML_GENERATOR "pcmx_comm_code_stats_region_decls.h")
configure_file(${CMAKE_SOURCE_DIR}/build_utils/xml_descriptor_generator.cpp
${CMAKE_BINARY_DIR}/gen/pcmx_comm_code_stats_region_xml_descriptor_generator.cpp
@ONLY)
add_executable(pcmx_comm_code_stats_region_xml_generator ${CMAKE_BINARY_DIR}/gen/pcmx_comm_code_stats_region_xml_descriptor_generator.cpp)
add_custom_target(PROXY_PCMX_COMM_CODE_STATS_REGION_XML_DESCRIPTOR_GENERATOR
DEPENDS ${CMAKE_BINARY_DIR}/gen/pcmx_comm_code_stats_region_xml_descriptor_generator.cpp)
set_target_properties(pcmx_comm_code_stats_region_xml_generator
PROPERTIES
COMPILE_DEFINITIONS GENERATE_DESCRIPTOR
)
target_include_directories(pcmx_comm_code_stats_region_xml_generator PUBLIC ${CPPREFLECTION_HEADERS})
target_include_directories(pcmx_comm_code_stats_region_xml_generator PUBLIC ${CMAKE_BINARY_DIR}/src/d3comm)
target_link_libraries(pcmx_comm_code_stats_region_xml_generator tinyxml)
target_link_libraries(pcmx_comm_code_stats_region_xml_generator cppreflection)
# need this but cannot do it add_dependencies(d3comm_metrics_xml_generator d3comm_metrics_defs.h)
add_dependencies(pcmx_comm_code_stats_region_xml_generator PROXY_D3COMM_METRICS_SOURCE)
#
# This makes the d3comm_metrics_xml_generator (exe).
# It is used to make the .xml for use with the lfo tool
# This is for xml file #3
#
# d3comm_metrics_defs.h is generated above
SET(XML_GENERATOR "d3comm_metrics_defs.h")
configure_file(${CMAKE_SOURCE_DIR}/build_utils/xml_descriptor_generator.cpp
${CMAKE_BINARY_DIR}/gen/d3comm_metrics_xml_descriptor_generator.cpp
@ONLY)
add_executable(d3comm_metrics_xml_generator ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_xml_descriptor_generator.cpp)
add_custom_target(PROXY_D3COMM_METRICS_XML_GENERATOR DEPENDS ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_xml_descriptor.cpp)
set_target_properties(d3comm_metrics_xml_generator
PROPERTIES
COMPILE_DEFINITIONS GENERATE_DESCRIPTOR
)
target_include_directories(d3comm_metrics_xml_generator PUBLIC ${CPPREFLECTION_HEADERS})
target_include_directories(d3comm_metrics_xml_generator PUBLIC ${CMAKE_BINARY_DIR}/src/d3comm)
target_link_libraries(d3comm_metrics_xml_generator tinyxml)
target_link_libraries(d3comm_metrics_xml_generator cppreflection)
# need this but cannot do it add_dependencies(d3comm_metrics_xml_generator d3comm_metrics_defs.h)
add_dependencies(d3comm_metrics_xml_generator PROXY_D3COMM_METRICS_SOURCE)
endif()
## This invokes the executable d3comm_metrics_header_generator (exe) to build :
## o xxx_metrics_defs_map.cpp
## o xxx_metrics_defs.h
##
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_defs.h ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_defs_map.cpp
COMMAND $<TARGET_FILE:d3comm_metrics_header_generator> ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_defs
DEPENDS PROXY_D3COMM_METRICS_SOURCE
PROXY_GEN_DIR
)
add_custom_target(PROXY_D3COMM_METRICS_SOURCE DEPENDS ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_defs.h ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_defs_map.cpp)
## This invokes the executable d3comm_status_codes_generator (exe) to build the d3comm_status_codes.h file.
##
add_custom_target(PROXY_D3COMM_STATUS_CODES_HEADER DEPENDS ${CMAKE_BINARY_DIR}/gen/d3comm_status_codes.h)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gen/d3comm_status_codes.h
COMMAND $<TARGET_FILE:d3comm_status_codes_generator> ${CMAKE_BINARY_DIR}/gen/
DEPENDS PROXY_D3COMM_STATUS_CODES_HEADER
PROXY_GEN_DIR)
#
#
# This builds the d3comm.bin
#
#########################################
set(d3comm_sources
d3comm.cpp
d3comm_dispatcher.cpp
d3comm_initstate.cpp
d3comm_lib.cpp
d3comm_net.cpp
d3comm_runstate.cpp
d3comm_status_codes.cpp
${CMAKE_BINARY_DIR}/gen/d3comm_metrics_defs_map.cpp
)
add_executable(d3comm.bin ${d3comm_sources})
# this works and is preferred
target_link_libraries(d3comm.bin app)
target_link_libraries(d3comm.bin comm)
target_link_libraries(d3comm.bin loader)
target_link_libraries(d3comm.bin loggerlib)
target_link_libraries(d3comm.bin sysclass)
target_link_libraries(d3comm.bin sys)
target_link_libraries(d3comm.bin config)
target_link_libraries(d3comm.bin sysmonlib)
target_link_libraries(d3comm.bin hmon)
target_link_libraries(d3comm.bin rt)
target_link_libraries(d3comm.bin pthread)
#target_link_libraries(d3comm.bin hmon)
add_dependencies(d3comm.bin PROXY_D3COMM_STATUS_CODES_HEADER)
target_include_directories(d3comm.bin PUBLIC ${CMAKE_BINARY_DIR}/gen/)
target_include_directories(d3comm.bin PUBLIC ${CMAKE_BINARY_DIR}/src/d3comm/)
#
#
# This builds the d3comm.lfo
#
#########################################
#
# This is where .xml file #1 is made by the exe made above
#
# when you run this exe, you must specify the name of the xml to write as parameter.
# ${CMAKE_BINARY_DIR}/bin/d3comm_metrics_xml_generator ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_descriptor.xml
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gen/pcmx_comm_link_stats_region_descriptor.xml
COMMAND $<TARGET_FILE:pcmx_comm_link_stats_region_xml_generator> ${CMAKE_BINARY_DIR}/gen/pcmx_comm_link_stats_region_descriptor.xml
DEPENDS PROXY_PCMX_COMM_LINK_STATS_REGION_DESCRIPTOR_XML PROXY_GEN_DIR)
add_custom_target(PROXY_PCMX_COMM_LINK_STATS_REGION_DESCRIPTOR_XML DEPENDS ${CMAKE_BINARY_DIR}/gen/pcmx_comm_link_stats_region_descriptor.xml)
#
# This is where .xml file #2 is made by the exe made above
#
# when you run this exe, you must specify the name of the xml to write as parameter.
# ${CMAKE_BINARY_DIR}/bin/d3comm_metrics_xml_generator ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_descriptor.xml
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gen/pcmx_comm_code_stats_region_descriptor.xml
COMMAND $<TARGET_FILE:pcmx_comm_code_stats_region_xml_generator> ${CMAKE_BINARY_DIR}/gen/pcmx_comm_code_stats_region_descriptor.xml
DEPENDS PROXY_PCMX_COMM_CODE_STATS_REGION_DESCRIPTOR_XML PROXY_GEN_DIR)
add_custom_target(PROXY_PCMX_COMM_CODE_STATS_REGION_DESCRIPTOR_XML DEPENDS ${CMAKE_BINARY_DIR}/gen/pcmx_comm_code_stats_region_descriptor.xml)
#
# This is where .xml file #3 is made by the exe made above
#
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_descriptor.xml
COMMAND $<TARGET_FILE:d3comm_metrics_xml_generator> ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_descriptor.xml
DEPENDS PROXY_D3COMM_METRICS_DESCRIPTOR_XML PROXY_GEN_DIR)
add_custom_target(PROXY_D3COMM_METRICS_DESCRIPTOR_XML DEPENDS ${CMAKE_BINARY_DIR}/gen/d3comm_metrics_descriptor.xml)
# Now make d3comm.lfo
# When building the d3comm.lfo from the d3comm.bin, we need to make the following three files
# used as input to the lfotool.bin program.
# o gen/pcmx_comm_link_stats_region_descriptor.xml
# o gen/pcmx_comm_code_stats_region_descriptor.xml
# o d3comm_metrics_descriptor.xml
#
# This custom target has the additional ALL keyword so that it is made each time?
# TODO: is there a way to not do this each time, but have it done at least once?
#add_custom_target(PROXY_D3COMM_LFO ALL DEPENDS d3comm.lfo)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/lfo/d3comm.lfo
COMMAND $<TARGET_FILE:lfotool.bin> d3comm
-sx ${CMAKE_SOURCE_DIR}/src/d3comm
-st ${CMAKE_BINARY_DIR}/src/d3comm
-d ${CMAKE_BINARY_DIR}/lfo
-r ${CMAKE_BINARY_DIR}/gen/pcmx_comm_link_stats_region_descriptor.xml
${CMAKE_BINARY_DIR}/gen/pcmx_comm_code_stats_region_descriptor.xml
${CMAKE_BINARY_DIR}/gen/d3comm_metrics_descriptor.xml
DEPENDS PROXY_PCMX_COMM_LINK_STATS_REGION_DESCRIPTOR_XML
PROXY_PCMX_COMM_CODE_STATS_REGION_DESCRIPTOR_XML
PROXY_D3COMM_METRICS_DESCRIPTOR_XML
d3comm.bin
PROXY_D3COMM_LFO
PROXY_LFO_DIR)
add_custom_target(PROXY_D3COMM_LFO ALL DEPENDS ${CMAKE_BINARY_DIR}/lfo/d3comm.lfo)
#
#
# Install section
#
#########################################
install(FILES ${CMAKE_BINARY_DIR}/lfo/d3comm.lfo DESTINATION /usr/bin/pcmx/lfo)
install(FILES d3comm.xml DESTINATION /usr/bin/pcmx/cfg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment