Skip to content

Commit

Permalink
use idasdk90 in workflow, update runners (#96)
Browse files Browse the repository at this point in the history
* use idasdk90 in workflow, update runners

* update build with idasdk90:
- add _target_link_libraries_win_ea64/_target_link_libraries_win_ea32
  functions in FindIdaSdk to make the build on windows compatible
  with different versions of the sdk
- by default we are building plugin and loader with idasdk90 so we
  will use NOEA32 everywhere
  • Loading branch information
yeggor authored Nov 7, 2024
1 parent dca0d07 commit 746ef87
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 44 deletions.
40 changes: 14 additions & 26 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
jobs:
build_windows:
runs-on: windows-2019
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -15,18 +15,14 @@ jobs:
PASSWORD: ${{ secrets.ZIP_PASSWORD }}
run: |
cd ..
curl -J -L "%IDA_SDK%" -o idasdk84.zip
unzip -P "%PASSWORD%" idasdk84.zip
curl -J -L "%IDA_SDK%" -o idasdk90.zip
unzip -P "%PASSWORD%" idasdk90.zip
- name: Build efiXplorer
run: |
mkdir build
cd build
cmake .. -DIdaSdk_ROOT_DIR="../../idasdk84" -DHexRaysSdk_ROOT_DIR="../../hexrays_sdk"
cmake --build . --config Release
- uses: actions/upload-artifact@master
with:
name: efiXplorer.dll
path: build/efiXplorer/Release/efiXplorer.dll
cmake .. -DIdaSdk_ROOT_DIR="../../idasdk90" -DHexRaysSdk_ROOT_DIR="../../idasdk90"
cmake --build . --config Release --parallel
- uses: actions/upload-artifact@master
with:
name: efiXplorer64.dll
Expand All @@ -36,7 +32,7 @@ jobs:
name: efiXloader64.dll
path: build/efiXloader/Release/efiXloader64.dll
build_linux:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -48,18 +44,14 @@ jobs:
PASSWORD: ${{ secrets.ZIP_PASSWORD }}
run: |
cd ..
curl -J -L "$IDA_SDK" -o idasdk84.zip
unzip -P $PASSWORD idasdk84.zip
curl -J -L "$IDA_SDK" -o idasdk90.zip
unzip -P $PASSWORD idasdk90.zip
- name: Build efiXplorer
run: |
mkdir build
cd build
cmake .. -DIdaSdk_ROOT_DIR="../../idasdk84" -DHexRaysSdk_ROOT_DIR="../../hexrays_sdk"
cmake --build . --config Release
- uses: actions/upload-artifact@master
with:
name: efiXplorer.so
path: build/efiXplorer/efiXplorer.so
cmake .. -DIdaSdk_ROOT_DIR="../../idasdk90" -DHexRaysSdk_ROOT_DIR="../../idasdk90"
cmake --build . --config Release --parallel
- uses: actions/upload-artifact@master
with:
name: efiXplorer64.so
Expand All @@ -81,18 +73,14 @@ jobs:
PASSWORD: ${{ secrets.ZIP_PASSWORD }}
run: |
cd ..
curl -J -L "$IDA_SDK" -o idasdk84.zip
unzip -P $PASSWORD idasdk84.zip
curl -J -L "$IDA_SDK" -o idasdk90.zip
unzip -P $PASSWORD idasdk90.zip
- name: Build efiXplorer
run: |
mkdir build
cd build
cmake .. -DIdaSdk_ROOT_DIR="../../idasdk84" -DHexRaysSdk_ROOT_DIR="../../hexrays_sdk"
cmake --build . --config Release
- uses: actions/upload-artifact@master
with:
name: efiXplorer.dylib
path: build/efiXplorer/efiXplorer.dylib
cmake .. -DIdaSdk_ROOT_DIR="../../idasdk90" -DHexRaysSdk_ROOT_DIR="../../idasdk90"
cmake --build . --config Release --parallel
- uses: actions/upload-artifact@master
with:
name: efiXplorer64.dylib
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
run: |
git submodule update --init --recursive
cd ..
curl -J -L "$IDA_SDK" -o idasdk84.zip
unzip -P $PASSWORD idasdk84.zip
curl -J -L "$IDA_SDK" -o idasdk90.zip
unzip -P $PASSWORD idasdk90.zip
cd efiXplorer
mkdir build
cd build
cmake .. -DIdaSdk_ROOT_DIR="../../idasdk84" -DHexRaysSdk_ROOT_DIR="../../hexrays_sdk"
cmake --build . --config Release
cmake .. -DIdaSdk_ROOT_DIR="../../idasdk90" -DHexRaysSdk_ROOT_DIR="../../idasdk90"
cmake --build . --config Release --parallel
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
32 changes: 22 additions & 10 deletions cmake/FindIdaSdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,7 @@ find_package_handle_standard_args(
# Define some platform specific variables for later use.
set(_so ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(_so64 64${CMAKE_SHARED_LIBRARY_SUFFIX}) # An additional "64"
# _plx, _plx64, _llx, _llx64 are kept to stay compatible with older
# CMakeLists.txt files.
set(_plx ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(_plx64 64${CMAKE_SHARED_LIBRARY_SUFFIX}) # An additional "64"
set(_llx ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(_llx64 64${CMAKE_SHARED_LIBRARY_SUFFIX}) # An additional "64"

if(APPLE)
set(IdaSdk_PLATFORM __MAC__)
elseif(UNIX)
Expand All @@ -112,6 +107,21 @@ function(_ida_common_target_settings t ea64)
target_include_directories(${t} PUBLIC ${IdaSdk_INCLUDE_DIRS})
endfunction()

function(_target_link_libraries_win_ea64 t)
if(EXISTS ${IdaSdk_DIR}/lib/x64_win_vc_64_pro/ida.lib) # for idasdk84
target_link_libraries(${t} ${IdaSdk_DIR}/lib/x64_win_vc_64_pro/ida.lib)
elseif(EXISTS ${IdaSdk_DIR}/lib/x64_win_vc_64/ida.lib) # for idasdk90
target_link_libraries(${t} ${IdaSdk_DIR}/lib/x64_win_vc_64/ida.lib)
else()
message(FATAL_ERROR "ida.lib could not be found")
endif()
endfunction()

function(_target_link_libraries_win_ea32 t)
# Should not be used on idasdk90 and later
target_link_libraries(${t} ${IdaSdk_DIR}/lib/x64_win_vc_32_pro/ida.lib)
endfunction()

function(_ida_plugin name ea64 link_script) # ARGN contains sources
if(ea64)
set(t ${name}${_so64})
Expand Down Expand Up @@ -147,9 +157,10 @@ function(_ida_plugin name ea64 link_script) # ARGN contains sources
target_compile_options(${t} PUBLIC -Wno-non-virtual-dtor -Wno-varargs)
elseif(WIN32)
if(ea64)
target_link_libraries(${t} ${IdaSdk_DIR}/lib/x64_win_vc_64_pro/ida.lib)
_target_link_libraries_win_ea64(${t})
else()
target_link_libraries(${t} ${IdaSdk_DIR}/lib/x64_win_vc_32_pro/ida.lib)
# Not reachable when using idasdk90 and later
_target_link_libraries_win_ea32(${t})
endif()
endif()
endfunction()
Expand Down Expand Up @@ -188,9 +199,10 @@ function(_ida_loader name ea64 link_script)
target_compile_options(${t} PUBLIC -Wno-non-virtual-dtor -Wno-varargs)
elseif(WIN32)
if(ea64)
target_link_libraries(${t} ${IdaSdk_DIR}/lib/x64_win_vc_64_pro/ida.lib)
_target_link_libraries_win_ea64(${t})
else()
target_link_libraries(${t} ${IdaSdk_DIR}/lib/x64_win_vc_32_pro/ida.lib)
# Not reachable when using idasdk90 and later
_target_link_libraries_win_ea32(${t})
endif()
target_link_options(${t} PUBLIC "/EXPORT:LDSC")
endif()
Expand Down
4 changes: 2 additions & 2 deletions efiXloader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ add_ida_loader(efiXloader NOEA32 ${PROJECT_SOURCE_DIR}/efi_loader.cc)
set_ida_target_properties(efiXloader PROPERTIES CXX_STANDARD 17)
ida_target_include_directories(efiXloader PRIVATE ${IdaSdk_INCLUDE_DIRS})

add_ida_library(efiXloader_lib ${efiloader_src} ${uefitool_src} uefitool.cc
uefitool.h)
add_ida_library(efiXloader_lib NOEA32 ${efiloader_src} ${uefitool_src}
uefitool.cc uefitool.h)
ida_target_link_libraries(efiXloader efiXloader_lib)
6 changes: 4 additions & 2 deletions efiXplorer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ if(HexRaysSdk_ROOT_DIR)
list(APPEND efiXplorer_src "efi_hexrays.cc" "efi_hexrays.h")
endif()

add_ida_plugin(efiXplorer ${PROJECT_SOURCE_DIR}/efixplorer.cc)
# remove NOEA32 to compile with SDK versions prior to idasdk90 as from IDA 90
# the EA32 is no longer required
add_ida_plugin(efiXplorer NOEA32 ${PROJECT_SOURCE_DIR}/efixplorer.cc)

set_ida_target_properties(efiXplorer PROPERTIES CXX_STANDARD 20)
ida_target_include_directories(efiXplorer PRIVATE ${IdaSdk_INCLUDE_DIRS})

add_ida_library(efiXplorer_lib ${efiXplorer_src})
add_ida_library(efiXplorer_lib NOEA32 ${efiXplorer_src})
ida_target_link_libraries(efiXplorer efiXplorer_lib)

0 comments on commit 746ef87

Please sign in to comment.