@@ -30,29 +30,40 @@ set(PROJECT_NAMES pcm pcm-numa pcm-latency pcm-power pcm-msr pcm-memory pcm-ts
30
30
file (GLOB COMMON_SOURCES msr.cpp cpucounters.cpp pci.cpp mmio.cpp bw.cpp utils.cpp topology.cpp debug.cpp threadpool.cpp )
31
31
file (GLOB UNUX_SOURCES dashboard.cpp resctrl.cpp )
32
32
33
- if (LINUX OR FREE_BSD )
33
+ if (UNIX ) # LINUX, FREE_BSD, APPLE
34
34
list (APPEND PROJECT_NAMES pcm-sensor )
35
35
if (LINUX )
36
36
list (APPEND PROJECT_NAMES pcm-sensor-server )
37
- endif (LINUX )
38
- add_library (PCM_STATIC STATIC ${COMMON_SOURCES} ${UNUX_SOURCES} )
39
- set_target_properties (PCM_STATIC PROPERTIES OUTPUT_NAME pcm )
40
-
41
- add_library (PCM_SHARED SHARED pcm-core.cpp )
42
- target_link_libraries (PCM_SHARED PRIVATE PCM_STATIC Threads::Threads )
43
- set_target_properties (PCM_SHARED PROPERTIES OUTPUT_NAME pcm )
44
- endif (LINUX OR FREE_BSD )
37
+ endif ()
45
38
46
- if (APPLE )
47
- list (APPEND PROJECT_NAMES pcm-sensor )
39
+ # libpcm.a
48
40
add_library (PCM_STATIC STATIC ${COMMON_SOURCES} ${UNUX_SOURCES} )
49
- include_directories ("${CMAKE_SOURCE_DIR} /src/MacMSRDriver" ) # target_include_directories doesn't work
50
41
set_target_properties (PCM_STATIC PROPERTIES OUTPUT_NAME pcm )
51
42
43
+ # libpcm.a with -DPCM_SILENT for Release*
44
+ add_library (PCM_STATIC_SILENT STATIC ${COMMON_SOURCES} ${UNUX_SOURCES} )
45
+ target_compile_definitions (PCM_STATIC_SILENT PRIVATE
46
+ $< $< CONFIG:Release> :PCM_SILENT>
47
+ $< $< CONFIG:MinSizeRel> :PCM_SILENT>
48
+ $< $< CONFIG:RelWithDebInfo> :PCM_SILENT>
49
+ )
50
+
51
+ # libpcm.so
52
52
add_library (PCM_SHARED SHARED pcm-core.cpp )
53
- target_link_libraries (PCM_SHARED PRIVATE PCM_STATIC PcmMsr Threads::Threads )
53
+ # PCM_SILENT in Release* for pcm-core.cpp
54
+ target_compile_definitions (PCM_SHARED PRIVATE
55
+ $< $< CONFIG:Release> :PCM_SILENT>
56
+ $< $< CONFIG:MinSizeRel> :PCM_SILENT>
57
+ $< $< CONFIG:RelWithDebInfo> :PCM_SILENT>
58
+ )
59
+ if (APPLE )
60
+ include_directories ("${CMAKE_SOURCE_DIR} /src/MacMSRDriver" ) # target_include_directories doesn't work
61
+ target_link_libraries (PCM_SHARED PRIVATE PCM_STATIC_SILENT PcmMsr Threads::Threads )
62
+ else ()
63
+ target_link_libraries (PCM_SHARED PRIVATE PCM_STATIC_SILENT Threads::Threads )
64
+ endif ()
54
65
set_target_properties (PCM_SHARED PROPERTIES OUTPUT_NAME pcm )
55
- endif (APPLE )
66
+ endif ()
56
67
57
68
if (MSVC )
58
69
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa /Zi" )
@@ -65,7 +76,7 @@ if(MSVC)
65
76
# Rest of windows/* files + restrictDriverAccess.cpp -> PCM_STATIC
66
77
file (GLOB WINDOWS_SOURCES winpmem/winpmem.cpp windows/stdafx.cpp freegetopt/getopt.cpp )
67
78
add_library (PCM_STATIC STATIC $< TARGET_OBJECTS:restrictDriverAccess> ${COMMON_SOURCES} ${WINDOWS_SOURCES} )
68
- target_compile_definitions (PCM_STATIC PRIVATE _UNICODE UNICODE _CONSOLE )
79
+ target_compile_definitions (PCM_STATIC PRIVATE UNICODE _UNICODE _CONSOLE )
69
80
70
81
# Graphical perfmon front-end: pcm-lib, pcm-service
71
82
# Files: COMMON_FILES() + pcm-lib.cpp winpmem\winpmem.cpp dllmain.cpp
0 commit comments