Skip to content

Commit

Permalink
Fix cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Antwy committed Jul 23, 2024
1 parent ea3cb55 commit 7d19b69
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Configure (Windows)
if: ${{ matrix.platform == 'windows' }}
run: |
cmake --preset=${{ matrix.cmake-preset }} -DBUILD_SHARED_LIBS:BOOL=ON -DCS_VERSION_MAJOR:STRING=5 -DCOMPILE_RISCV:BOOL=ON -DVCPKG_OVERLAY_TRIPLETS:PATH=${{ github.workspace }}\vcpkg\triplets -DVCPKG_TARGET_TRIPLET:STRING=${{ matrix.vcpkg-triplet }}
cmake --preset=${{ matrix.cmake-preset }} -DBUILD_SHARED_LIBS:BOOL=ON -DCS_VERSION_MAJOR:STRING=5 -DVCPKG_OVERLAY_TRIPLETS:PATH=${{ github.workspace }}\vcpkg\triplets -DVCPKG_TARGET_TRIPLET:STRING=${{ matrix.vcpkg-triplet }}
env:
# capstone 4.0.2 does not produce a CMake Config, hence the need to point directly to include directories and libraries
CAPSTONE_INCLUDE_DIRS: ${{ github.workspace }}/build/${{ matrix.cmake-preset }}/vcpkg_installed/${{ matrix.vcpkg-triplet }}/include
Expand All @@ -76,7 +76,7 @@ jobs:
if: ${{ matrix.platform != 'windows' }}
run: |
python -m pip install importlib-resources
cmake --preset=${{ matrix.cmake-preset }} -DBUILD_SHARED_LIBS:BOOL=ON -DCS_VERSION_MAJOR:STRING=5 -DCOMPILE_RISCV:BOOL=ON -DVCPKG_OVERLAY_TRIPLETS:PATH=${{ github.workspace }}/vcpkg/triplets -DVCPKG_TARGET_TRIPLET:STRING=${{ matrix.vcpkg-triplet }}
cmake --preset=${{ matrix.cmake-preset }} -DBUILD_SHARED_LIBS:BOOL=ON -DCS_VERSION_MAJOR:STRING=5 -DVCPKG_OVERLAY_TRIPLETS:PATH=${{ github.workspace }}/vcpkg/triplets -DVCPKG_TARGET_TRIPLET:STRING=${{ matrix.vcpkg-triplet }}
env:
# capstone 4.0.2 does not produce a CMake Config, hence the need to point directly to include directories and libraries
CAPSTONE_INCLUDE_DIRS: ${{ github.workspace }}/build/${{ matrix.cmake-preset }}/vcpkg_installed/${{ matrix.vcpkg-triplet }}/include
Expand All @@ -86,7 +86,7 @@ jobs:

- name: Build
run: |
cmake --build --preset build-${{ matrix.cmake-preset }} --config Release -DCS_VERSION_MAJOR:STRING=5 -DCOMPILE_RISCV:BOOL=ON
cmake --build --preset build-${{ matrix.cmake-preset }} --config Release -DCS_VERSION_MAJOR:STRING=5
- name: Test
# Test disabled on Windows `pip install lief` fails as there is no ready to use .whl and compilation fails
Expand All @@ -98,7 +98,7 @@ jobs:
- name: Install
run: |
cmake --build --preset build-${{ matrix.cmake-preset }} --config Release --target install -DCOMPILE_RISCV:BOOL=ON
cmake --build --preset build-${{ matrix.cmake-preset }} --config Release --target install -DCS_VERSION_MAJOR:STRING=5
- name: Upload
uses: actions/upload-artifact@v3
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ message(STATUS "Compiling with Capstone")
find_package(CAPSTONE 5 REQUIRED)
message(STATUS "CAPSTONE version: ${CAPSTONE_VERSION}")
if(${CS_VERSION_MAJOR} GREATER_EQUAL 5)
set(COMPILE_RISCV ON)
add_definitions(-DCOMPILE_RISCV)
endif()
if(TARGET capstone::capstone)
Expand Down
4 changes: 2 additions & 2 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ add_custom_target(gen_rv32_doc_from_spec
DEPENDS ${TRITON_ROOT}/src/libtriton/includes/triton/riscv32.spec
)

if(COMPILE_RISCV)
if(${CS_VERSION_MAJOR} GREATER_EQUAL 5)
add_custom_target(doc
COMMAND doxygen ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
DEPENDS gen_x86_doc_from_spec
Expand All @@ -55,7 +55,7 @@ else()
endif()

if(PYTHON_BINDINGS_AUTOCOMPLETE)
if(COMPILE_RISCV)
if(${CS_VERSION_MAJOR} GREATER_EQUAL 5)
add_custom_target(python_autocomplete
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/autocomplete/generate_autocomplete.py "--basedir" "${CMAKE_CURRENT_BINARY_DIR}" "$<$<BOOL:${BITWUZLA_INTERFACE}>:--bitwuzla>" "$<$<BOOL:${Z3_INTERFACE}>:--z3>"
DEPENDS gen_x86_doc_from_spec
Expand Down
2 changes: 1 addition & 1 deletion src/libtriton/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ set(LIBTRITON_HEADER_FILES
)

# Add riscv source and header files
if(${COMPILE_RISCV})
if(${CS_VERSION_MAJOR} GREATER_EQUAL 5)
list(APPEND LIBTRITON_SOURCE_FILES
arch/riscv/riscv32Cpu.cpp
arch/riscv/riscv64Cpu.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/testers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin

add_test(NAME UnicornAArch64Semantics COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/aarch64/unicorn_test_aarch64.py)
add_test(NAME UnicornX86Semantics COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/x86/unicorn_test_x86.py)
if(${COMPILE_RISCV})
if(${CS_VERSION_MAJOR} GREATER_EQUAL 5)
add_test(NAME UnicornRiscv64Semantics COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/riscv/unicorn_test_riscv64.py)
add_test(NAME UnicornRiscv32Semantics COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/riscv/unicorn_test_riscv32.py)
endif()
Expand Down Expand Up @@ -85,7 +85,7 @@ if((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
UnicornARM32Semantics35
PROPERTY ENVIRONMENT "PYTHONPATH=$<TARGET_FILE_DIR:triton>"
)
if(${COMPILE_RISCV})
if(${CS_VERSION_MAJOR} GREATER_EQUAL 5)
set_property(TEST
UnicornRiscv64Semantics
UnicornRiscv32Semantics
Expand Down

0 comments on commit 7d19b69

Please sign in to comment.