Skip to content

Commit

Permalink
Use find_file to find secp256k1.dll
Browse files Browse the repository at this point in the history
* use find_file to find secp256k1.dll

because in testing we found that CMAKE_BINARY_DIR is usually app/build/windows/x64, but some Windows hosts use app/build/windows.  This should support both
force pushed to fix a small typo.

* remove explicit references to secp256k1.dll

* formatting

limit lines to 180 characters, align comments
  • Loading branch information
sneurlax committed Jan 18, 2024
1 parent 5119149 commit 1eadf99
Showing 1 changed file with 34 additions and 11 deletions.
45 changes: 34 additions & 11 deletions coinlib_flutter/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,39 @@ project(${PROJECT_NAME} LANGUAGES CXX)
# Invoke the build for native code shared with the other target platforms.
# This can be changed to accommodate different builds.
# add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
# TODO re-enable the above line if/when the CMake process is made Windows-compatible. See also below.
# TODO re-enable the above line if/when the CMake process is made Windows-compatible.
# See also below.

# List of absolute paths to libraries that should be bundled with the plugin.
# This list could contain prebuilt libraries, or libraries created by an
# external build triggered from this build file.
set(coinlib_flutter_bundled_libraries
# Defined in ../src/CMakeLists.txt.
# This can be changed to accommodate different builds.
# $<TARGET_FILE:coinlib_flutter>
# TODO re-enable the above line if/when the CMake process is made Windows-compatible. See also above.
${CMAKE_BINARY_DIR}/../../secp256k1.dll
PARENT_SCOPE
# Search for secp256k1.dll in multiple possible directories.
#
# This is only necessary because in testing we have found that most Windows hosts
# have CMAKE_BINARY_DIR = app/build/windows/x64, but some use app/build/windows.
# This should search through its multiple possible locations.
find_file(SECP256K1_DLL
NAMES secp256k1.dll
PATHS
"${CMAKE_BINARY_DIR}/../" # Check one level up.
"${CMAKE_BINARY_DIR}/../../" # Check two levels up.
"${CMAKE_BINARY_DIR}/../../../" # Used for the example app.
"${CMAKE_SOURCE_DIR}/../build"
"${CMAKE_SOURCE_DIR}/../../build" # Works for the example app.
NO_DEFAULT_PATH
)

# Check if SECP256K1_DLL was found
if (SECP256K1_DLL)
# List of absolute paths to libraries that should be bundled with the plugin.
# This list could contain prebuilt libraries, or libraries created by an
# external build triggered from this build file.
set(coinlib_flutter_bundled_libraries
# Defined in ../src/CMakeLists.txt.
# This can be changed to accommodate different builds.
# $<TARGET_FILE:coinlib_flutter>
# TODO re-enable if/when the CMake process is made Windows-compatible.
# See also above.
${SECP256K1_DLL}
PARENT_SCOPE
)
else ()
message(FATAL_ERROR "Could not find secp256k1.dll.")
endif ()

0 comments on commit 1eadf99

Please sign in to comment.