Skip to content

Commit

Permalink
updated sdk finder. added WIN32_LEAN_AND_MEAN flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nlitsme committed Aug 24, 2023
1 parent 87e9b4f commit 5bd694b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
28 changes: 18 additions & 10 deletions cmake_find/Findidasdk.cmake
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
# note: this depends on my local install
if (TARGET idasdk)
return()
endif()
find_path(IDASDK_PATH NAMES include/netnode.hpp PATHS $ENV{IDASDK} $ENV{HOME}/src/idasdk_pro82 c:/local/idasdk82)
# note: this depends partially on my local install
find_path(IDASDK_PATH NAMES include/netnode.hpp PATHS
$ENV{IDASDK}
$ENV{HOME}/src/idasdk_pro82
$ENV{HOME}/src/idasdk_pro80
c:/local/idasdk_pro82
c:/local/idasdk77)
if (IDASDK_PATH STREQUAL "IDASDK_PATH-NOTFOUND")
message(FATAL_ERROR "IDASDK not found.")
message(FATAL_ERROR "IDASDK not found on ${CMAKE_SYSTEM_NAME}.")
endif()
if(WIN32)
# note that for windows both libs have the same name.
find_library(IDALIB32 ida ${IDASDK_PATH}/lib/x64_win_vc_32 ${IDASDK_PATH}/lib/x64_win_vc_32_pro)
find_library(IDALIB64 ida ${IDASDK_PATH}/lib/x64_win_vc_64 ${IDASDK_PATH}/lib/x64_win_vc_64_pro)
elseif(LINUX)
find_library(IDALIB32 ida ${IDASDK_PATH}/lib/x64_linux_gcc_32 ${IDASDK_PATH}/lib/x64_linux_gcc_32_pro)
find_library(IDALIB32 ida ${IDASDK_PATH}/lib/x64_linux_gcc_32 ${IDASDK_PATH}/lib/x64_linux_gcc_32_pro)
find_library(IDALIB64 ida64 ${IDASDK_PATH}/lib/x64_linux_gcc_64 ${IDASDK_PATH}/lib/x64_linux_gcc_64_pro)
elseif(DARWIN)
find_library(IDALIB32 ida ${IDASDK_PATH}/lib/x64_mac_clang_32 ${IDASDK_PATH}/lib/x64_mac_clang_32_pro)
find_library(IDALIB64 ida64 ${IDASDK_PATH}/lib/x64_mac_clang_64 ${IDASDK_PATH}/lib/x64_mac_clang_64_pro)
elseif(MACARM)
# todo ... how do I detect this from my cmake script?
find_library(IDALIB32 ida ${IDASDK_PATH}/lib/arm64_mac_clang_32 ${IDASDK_PATH}/lib/arm64_mac_clang_32_pro)
find_library(IDALIB64 ida64 ${IDASDK_PATH}/lib/arm64_mac_clang_64 ${IDASDK_PATH}/lib/arm64_mac_clang_64_pro)
# now this depends on the host, better would be to set
# CMAKE_OSX_ARCHITECTURES to arm64 for the arm build.
if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64)
find_library(IDALIB32 ida ${IDASDK_PATH}/lib/x64_mac_clang_32 ${IDASDK_PATH}/lib/x64_mac_clang_32_pro)
find_library(IDALIB64 ida64 ${IDASDK_PATH}/lib/x64_mac_clang_64 ${IDASDK_PATH}/lib/x64_mac_clang_64_pro)
else()
find_library(IDALIB32 ida ${IDASDK_PATH}/lib/arm64_mac_clang_32 ${IDASDK_PATH}/lib/arm64_mac_clang_32_pro)
find_library(IDALIB64 ida64 ${IDASDK_PATH}/lib/arm64_mac_clang_64 ${IDASDK_PATH}/lib/arm64_mac_clang_64_pro)
endif()
endif()
if (IDALIB64 STREQUAL "IDALIB64-NOTFOUND")
message(FATAL_ERROR "could not find libida64")
Expand Down
2 changes: 1 addition & 1 deletion cmake_find/boilerplate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ if(MSVC)
# NOBITMAP - avoid error in mmreg.h
# NOMINMAX - remove 'max()' macro from global namespace
# NOGDI - ...
add_definitions(-DNOMINMAX -DNOGDI -DNOBITMAP)
add_definitions(-DNOMINMAX -DNOGDI -DNOBITMAP -DWIN32_LEAN_AND_MEAN)
add_definitions(-DWIN32)
add_definitions(-D__STDC_WANT_SECURE_LIB__=1)

Expand Down

0 comments on commit 5bd694b

Please sign in to comment.