Skip to content

Commit

Permalink
cmake format ext/dll
Browse files Browse the repository at this point in the history
  • Loading branch information
meastp committed Jan 22, 2024
1 parent 7915d2f commit 15994ea
Showing 1 changed file with 17 additions and 27 deletions.
44 changes: 17 additions & 27 deletions ext/src/dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,20 @@ if(WITH_OTLP_HTTP)
PRIVATE opentelemetry_exporter_otlp_http_log)
endif()

find_program(_vswhere_tool
NAMES vswhere
PATHS "$ENV{ProgramFiles\(x86\)}/Microsoft Visual Studio/Installer")
if (NOT ${vswhere})
message(FATAL_ERROR "Could not locate vswhere.exe - unable to locate dumpbin.exe")
find_program(
_vswhere_tool
NAMES vswhere
PATHS "$ENV{ProgramFiles\(x86\)}/Microsoft Visual Studio/Installer")
if(NOT ${vswhere})
message(
FATAL_ERROR "Could not locate vswhere.exe - unable to locate dumpbin.exe")
endif()

execute_process(
COMMAND "${_vswhere_tool}" -latest -find **/dumpbin.exe
OUTPUT_VARIABLE DUMPBIN_PATHS
RESULT_VARIABLE _vs_where_exitcode
OUTPUT_STRIP_TRAILING_WHITESPACE
)
OUTPUT_STRIP_TRAILING_WHITESPACE)

message(STATUS "DUMPBIN PATHS: ${DUMPBIN_PATHS} ${RESULT_VARIABLE}")

Expand All @@ -72,42 +73,31 @@ list(POP_FRONT DUMPBIN_PATHS_LIST DUMPBIN_PATH)

message(STATUS "DUMPBIN PATH: ${DUMPBIN_PATH}")

# find Powershell executable
#find_program(DUMPBIN_PATH NAMES dumpbin REQUIRED)
# find Powershell executable find_program(DUMPBIN_PATH NAMES dumpbin REQUIRED)

# find Powershell executable
find_program(POWERSHELL_PATH NAMES pwsh powershell REQUIRED)

set(OPENTELEMETRY_INPUT_DEF
"${CMAKE_CURRENT_SOURCE_DIR}/input.txt")
set(OPENTELEMETRY_INPUT_DEF "${CMAKE_CURRENT_SOURCE_DIR}/input.txt")

add_custom_command(
OUTPUT ${OPENTELEMETRY_INPUT_DEF}
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/input.src"
COMMAND
${CMAKE_CXX_COMPILER}
"-D$<JOIN:$<TARGET_PROPERTY:opentelemetry_cpp,COMPILE_DEFINITIONS>,;-D>" /EP
${CMAKE_CURRENT_SOURCE_DIR}/input.src >
${OPENTELEMETRY_INPUT_DEF}
${CMAKE_CURRENT_SOURCE_DIR}/input.src > ${OPENTELEMETRY_INPUT_DEF}
VERBATIM COMMAND_EXPAND_LISTS)

add_custom_command(
OUTPUT ${OPENTELEMETRY_EXPORT_DEF}
DEPENDS "${OPENTELEMETRY_INPUT_DEF}" "${CMAKE_CURRENT_SOURCE_DIR}/make_def.ps1"
DEPENDS "${OPENTELEMETRY_INPUT_DEF}"
"${CMAKE_CURRENT_SOURCE_DIR}/make_def.ps1"
COMMAND
${POWERSHELL_PATH}
"-ExecutionPolicy"
"Bypass"
"-File"
"${CMAKE_CURRENT_SOURCE_DIR}/make_def.ps1"
"-dumpbin"
"${DUMPBIN_PATH}"
"-bindir"
${PROJECT_BINARY_DIR}
"-inputfile"
${OPENTELEMETRY_INPUT_DEF}
"-targetfile"
${OPENTELEMETRY_EXPORT_DEF}
${POWERSHELL_PATH} "-ExecutionPolicy" "Bypass" "-File"
"${CMAKE_CURRENT_SOURCE_DIR}/make_def.ps1" "-dumpbin" "${DUMPBIN_PATH}"
"-bindir" ${PROJECT_BINARY_DIR} "-inputfile" ${OPENTELEMETRY_INPUT_DEF}
"-targetfile" ${OPENTELEMETRY_EXPORT_DEF}
VERBATIM)

if(OPENTELEMETRY_INSTALL)
Expand Down

0 comments on commit 15994ea

Please sign in to comment.