-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add initial example integration with cmake (#149)
- Loading branch information
Showing
5 changed files
with
103 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
if (NOT PERFFLOWASPECT_CONFIG_LOADED) | ||
set(PERFFLOWASPECT_VERSION "@PROJECT_VERSION@") | ||
set(PERFFLOWASPECT_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") | ||
set(PERFFLOWASPECT_LIB_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@") | ||
set(PERFFLOWASPECT_VERSION "@PROJECT_VERSION@") | ||
set(PERFFLOWASPECT_DIR "@CMAKE_INSTALL_PREFIX@") | ||
set(PERFFLOWASPECT_LIB_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@") | ||
|
||
include(CMakeFindDependencyMacro) | ||
|
||
find_dependency(OpenSSL REQUIRED) | ||
|
||
# Library targets imported from file | ||
# include(${PERFFLOWASPECT_INSTALL_PREFIX}/share/perfflowaspect_setup_targets.cmake) | ||
include(${PERFFLOWASPECT_INSTALL_PREFIX}/share/perfflowaspect_targets.cmake) | ||
# include(${PERFFLOWASPECT_DIR}/share/perfflowaspect_setup_targets.cmake) | ||
include(${PERFFLOWASPECT_DIR}/share/perfflowaspect_targets.cmake) | ||
|
||
set(PERFFLOWASPECT_CONFIG_LOADED TRUE) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
install(DIRECTORY using-with-cmake | ||
DESTINATION examples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
############################################################################### | ||
# Example that shows how to use an installed instance of PerfFlowAspect in | ||
# another CMake-based build system. | ||
# | ||
# To build: | ||
# mkdir build | ||
# cd build | ||
# cmake -DPERFFLOWASPECT_DIR={perfflowaspect install path} ../ | ||
# make | ||
# ./smoketest | ||
# | ||
# If run in-sub directory below using-with-cmake in a PerfFlowAspect install, | ||
# PERFFLOWASPECT_DIR will be defaulted to ../../.. | ||
# | ||
# mkdir build | ||
# cd build | ||
# cmake .. | ||
# make | ||
# ./smoketest | ||
############################################################################### | ||
|
||
cmake_minimum_required(VERSION 3.0) | ||
|
||
project(using_with_cmake) | ||
|
||
# | ||
# Provide default for PERFFLOWASPECT_DIR that works for an PerfFlowAspect install | ||
# | ||
if(NOT PERFFLOWASPECT_DIR) | ||
set(PERFFLOWASPECT_DIR "../..") | ||
endif() | ||
|
||
# | ||
# Check for valid PerfFlowAspect install | ||
# | ||
get_filename_component(PERFFLOWASPECT_DIR ${PERFFLOWASPECT_DIR} ABSOLUTE) | ||
if(NOT EXISTS ${PERFFLOWASPECT_DIR}/share/perfflowaspect-config.cmake) | ||
message(FATAL_ERROR "Could not find PerfFlowAspect CMake include file (${PERFFLOWASPECT_DIR}/share/perfflowaspect-config.cmake)") | ||
endif() | ||
|
||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/************************************************************\ | ||
* Copyright 2021 Lawrence Livermore National Security, LLC | ||
* (c.f. AUTHORS, NOTICE.LLNS, COPYING) | ||
* | ||
* This file is part of the Flux resource manager framework. | ||
* For details, see https://github.com/flux-framework. | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0 | ||
\************************************************************/ | ||
|
||
#include <cstdio> | ||
#include <string> | ||
#include <unistd.h> | ||
|
||
__attribute__((annotate("@critical_path(pointcut='around')"))) | ||
void bas() | ||
{ | ||
printf("bas\n"); | ||
} | ||
|
||
__attribute__((annotate("@critical_path(pointcut='around')"))) | ||
void bar() | ||
{ | ||
printf("bar\n"); | ||
usleep(1000); | ||
bas(); | ||
} | ||
|
||
__attribute__((annotate("@critical_path()"))) | ||
int foo(const std::string &str) | ||
{ | ||
printf("foo\n"); | ||
usleep(1000); | ||
bar(); | ||
if (str == "hello") | ||
{ | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
printf("Inside main\n"); | ||
for (int i = 0; i < 4; i++) | ||
{ | ||
foo("hello"); | ||
} | ||
return 0; | ||
} | ||
|
||
/* | ||
* vi:tabstop=4 shiftwidth=4 expandtab | ||
*/ |