Skip to content

Commit

Permalink
Conda (#1)
Browse files Browse the repository at this point in the history
* Add conda package

The packaging is done without vcpkg, the dependencies are provided by conda itself.
- Add cmake preset to build conda packages without toolchain
- Add github action to build conda package
- Improve CMakeLists.txt

* Add arm64 triplet for macos-14
  • Loading branch information
bruno-at-orange authored May 24, 2024
1 parent ff85c57 commit 1aca565
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/hosted-ninja-vcpkg_submod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-13,macos-14, windows-latest]
include:
- os: windows-latest
triplet: x64-windows
- os: ubuntu-latest
triplet: x64-linux
- os: macos-latest
- os: macos-13
triplet: x64-osx
- os: macos-14
triplet: arm64-osx
env:
#
# [OPTIONAL] Define the vcpkg's triplet
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/hosted-pure-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
include:
- os: windows-latest
triplet: x64-windows
- os: ubuntu-latest
triplet: x64-linux
- os: macos-latest
- os: macos-13
triplet: x64-osx
- os: macos-14
triplet: arm64-osx
env:
# Indicates the location of the vcpkg as a Git submodule of the project repository.
# Not using "VCPKG_ROOT" because a variable with the same name is defined in the VS's
Expand Down
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@ set (CMAKE_CXX_STANDARD 17)

project(khiops-gcs LANGUAGES CXX)

# Find dependencies provided by vcpkg (via vcpkg.cmake)
# Find dependencies
find_package(fmt CONFIG REQUIRED)
find_package(google_cloud_cpp_storage CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)

# Hide symbols in the shared libraries
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)

add_library(khiopsdriver_file_gcs MODULE src/gcsplugin.h src/gcsplugin.cpp)
set_target_properties(khiopsdriver_file_gcs PROPERTIES LINK_FLAGS_RELEASE -s)
target_link_options(khiopsdriver_file_gcs PRIVATE $<$<CONFIG:RELEASE>:-s>) # stripping
target_link_libraries(khiopsdriver_file_gcs PRIVATE google-cloud-cpp::storage spdlog::spdlog)

add_executable(KhiopsPluginTest src/khiopsplugintest.cpp)
target_link_libraries(KhiopsPluginTest PRIVATE fmt::fmt)

add_executable(drivertest src/drivertest.cpp)
target_link_libraries(drivertest)
target_link_libraries(drivertest ${CMAKE_DL_LIBS}) # Link to dl

28 changes: 21 additions & 7 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
"configurePresets": [
{
"name": "ninja-multi-vcpkg",
"displayName": "Ninja Multi-Config",
"displayName": "Ninja Multi-Config with vcpkg",
"description": "Configure with vcpkg toolchain and generate Ninja project files for all configurations",
"binaryDir": "${sourceDir}/builds/${presetName}",
"generator": "Ninja Multi-Config",
"toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
},
{
"name": "ninja-multi",
"displayName": "Ninja without vcpkg",
"description": "Configure Ninja project files for all configurations",
"binaryDir": "${sourceDir}/builds/${presetName}",
"generator": "Ninja Multi-Config"
}
],
"buildPresets": [
Expand All @@ -31,10 +38,18 @@
"configuration": "Release"
},
{
"name": "ninja-vcpkg",
"configurePreset": "ninja-multi-vcpkg",
"displayName": "Build",
"description": "Build with Ninja/vcpkg"
"name": "ninja-debug",
"configurePreset": "ninja-multi",
"displayName": "Build (Debug)",
"description": "Build with Ninja",
"configuration": "Debug"
},
{
"name": "ninja-release",
"configurePreset": "ninja-multi",
"displayName": "Build (release)",
"description": "Build with Ninja",
"configuration": "Release"
}
],
"testPresets": [
Expand Down Expand Up @@ -62,5 +77,4 @@
]
}
]
}

}
17 changes: 17 additions & 0 deletions conda/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Set-up the shell to behave more like a general-purpose programming language
set -euo pipefail

# Configure project
cmake --fresh --preset ninja-multi

# Build
cmake --build --preset ninja-release --target khiopsdriver_file_gcs

# Copy binary to conda package
mkdir -p $PREFIX/bin
cp ./builds/ninja-multi/Release/libkhiopsdriver_file_gcs.so "$PREFIX/bin/"



34 changes: 34 additions & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package:
name: khiops-driver-gcs
version: 0.0.1

source:
path: ../

build:
number: 0
requirements:
build:
- cmake
- ninja
- {{ compiler('cxx') }}
host:
- google-cloud-cpp
- spdlog
run:
- google-cloud-cpp
- spdlog

outputs:
- name: khiops-driver-gcs
# test:
# commands:
# - MODL -v
# - MODL_Coclustering -v

about:
home: https://khiops.org
license: BSD+3-clause
summary: Khiops driver to access files on Google Cloud Storage
doc_url: https://khiops.org
dev_url: https://github.com/khiopsml/khiops

0 comments on commit 1aca565

Please sign in to comment.