Merge pull request #129 from xd009642/cmake_config

Initial version of coz-profileConfig.cmake
This commit is contained in:
Charlie Curtsinger 2019-10-20 10:08:54 -05:00 committed by GitHub
commit 030f674255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View File

@ -9,7 +9,9 @@ update-gh-pages:: all
install:: all
@echo $(LOG_PREFIX) Installing coz to prefix $(prefix) $(LOG_SUFFIX)
@sed 's@destdir@"${DESTDIR}${prefix}"@g' coz-profilerConfig.cmake.in > coz-profilerConfig.cmake
@$(INSTALL) -D coz $(DESTDIR)$(bindir)/coz
@$(INSTALL) -D coz-profilerConfig.cmake $(DESTDIR)$(pkglibdir)/coz-profilerConfig.cmake
@$(INSTALL) -D libcoz/libcoz.so $(DESTDIR)$(pkglibdir)/libcoz.so
@$(INSTALL) -D include/coz.h $(DESTDIR)$(incdir)/coz.h
@mkdir -p $(DESTDIR)$(man1dir)

View File

@ -67,6 +67,9 @@ To plot profile results, go to http://plasma-umass.github.io/coz/ and load your
## Sample Applications
The `benchmarks` directory in this repository includes several small benchmarks with progress points added at appropriate locations. To build and run one of these benchmarks with `coz`, just browse to `benchmarks/{bench name}` and type `make bench` (or `make test` for a smaller input size). These programs may require several runs before coz has enough measurements to generate a useful profile. Once you have profiled these programs for several minutes, go to http://plasma-umass.github.io/coz/ to load and plot your profile.
## CMake
When you install coz it installs a cmake config file. To add coz to a cmake project simply use the command `find_package(coz-profiler)`. This will import a target for the library and includes called `coz::coz` and a target for the coz binary `coz::profiler`. For guidance on how to use these targets refer to the CMake documentation.
## Limitations
Coz currently does not support interpreted or JIT-compiled languages such as Python, Ruby, or JavaScript. Interpreted languages will likely not be supported at any point, but support for JIT-compiled languages that produce debug information could be added in the future.

View File

@ -0,0 +1,26 @@
set(COZDIR destdir)
set(COZ_BIN ${COZDIR}/bin/coz)
set(COZ_INCLUDE_DIR ${COZDIR}/include)
get_filename_component(LIBRARY_DIR ${CMAKE_CURRENT_LIST_FILE} DIRECTORY)
set(COZ_LIBRARY ${LIBRARY_DIR}/libcoz.so)
set(COZ_FOUND ON)
message(INFO " ${COZ_INCLUDE_DIR} ${COZ_LIBRARY} ${COZ_FOUND}")
mark_as_advanced(COZ_FOUND COZ_INCLUDE_DIR COZ_LIBRARY)
add_library(coz::coz UNKNOWN IMPORTED)
set_target_properties(coz::coz PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${COZ_INCLUDE_DIR}")
set_target_properties(coz::coz PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${COZ_INCLUDE_DIR}")
add_executable(coz::profiler IMPORTED)
set_property(TARGET coz::profiler PROPERTY IMPORTED_LOCATION ${COZ_BIN})