Skip to content

chore: patch and build freexl locally #5775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions Tools/CMake/Conan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,53 @@ if(USE_CONAN)
if(WIN32)

message(STATUS " ${CONAN_COMPILER_RUNTIME}")

execute_process(
COMMAND_ECHO STDOUT
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND
conan install ${CONAN_FILE_PATH} --output-folder=${CMAKE_BINARY_DIR}/conan_build
conan install ${CONAN_FILE_PATH} --output-folder=${CMAKE_BINARY_DIR}/_conan_build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why _conan_build?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because I think all dependencies build dir should with "_" just like others.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is minor but for just for the uniformity...

-s build_type=${CMAKE_BUILD_TYPE}
-c tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}
-s compiler.runtime=${CONAN_COMPILER_RUNTIME} --build=missing)

message(STATUS "Cloning private freexl dependency")
set(FREEXL_VERSION "2.1.0-dev")
FetchContent_Declare(
freexl
GIT_REPOSITORY https://github.com/jasp-stats/conan-recipes.git
GIT_TAG f014849188bddd01b9ca3ddf63dde8d2e3a45314
)
FetchContent_MakeAvailable(freexl)

if(NOT freexl_FOUND)
if(freexl_POPULATED)

message(STATUS "Compiling freexl dependency")
execute_process(
COMMAND_ECHO STDOUT
WORKING_DIRECTORY ${freexl_SOURCE_DIR}/freexl
COMMAND
conan create . --version=${FREEXL_VERSION}
-s build_type=${CMAKE_BUILD_TYPE}
-c tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}
-s compiler.runtime=${CONAN_COMPILER_RUNTIME} --build=missing
--test-missing
)
else()
message(CHECK_FAIL "build freexl failed")
endif()
endif()

# find conan_toolchain.cmake generated in local
file(GLOB_RECURSE CONAN_TOOLCHAIN_PATH ${freexl_SOURCE_DIR}/freexl/test_package/build/*/generators/conan_toolchain.cmake)
list(GET CONAN_TOOLCHAIN_PATH 0 CONAN_TOOLCHAIN_PATH)
if (EXISTS ${CONAN_TOOLCHAIN_PATH})
get_filename_component(CONAN_TOOLCHAIN_PATH_DIR ${CONAN_TOOLCHAIN_PATH} DIRECTORY)
message(STATUS "freexl conan toolchain directory: ${CONAN_TOOLCHAIN_PATH_DIR}")
else ()
message(FATAL_ERROR "freexl conan toolchain not found!")
endif ()

elseif(APPLE)

Expand All @@ -61,7 +99,7 @@ if(USE_CONAN)

endif()

if(EXISTS ${CMAKE_BINARY_DIR}/conan_build/${CONAN_RESULT_FILE})
if(EXISTS ${CMAKE_BINARY_DIR}/_conan_build/${CONAN_RESULT_FILE})
message(CHECK_PASS "successful")
else()
message(CHECK_FAIL "unsuccessful")
Expand All @@ -71,7 +109,8 @@ if(USE_CONAN)
)
endif()

include(${CMAKE_BINARY_DIR}/conan_build/conan_toolchain.cmake)
include(${CMAKE_BINARY_DIR}/_conan_build/conan_toolchain.cmake)
include(${CONAN_TOOLCHAIN_PATH})

endif()

Expand Down
3 changes: 1 addition & 2 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ jsoncpp/1.9.5
openssl/3.0.10
bison/3.7.6
brotli/1.0.9
sqlite3/3.46.0
sqlite3/3.47.2
gmp/6.3.0
mpfr/4.2.1
freexl/2.0.0

[generators]
CMakeDeps
Expand Down
Loading