Skip to content

Commit 5eb3ec6

Browse files
olivier-rousselhugtalbotbakpaulfredroyalxbilger
authored
[Pixi][CI] Add pixi support (#5252)
* Init pixi support * Add pixi based CI workflow * Update pixi.toml syntax * Remove Cuda for now * Fix missing header * Use MSVC >= 19.42 CL compiler on windows * Disable dependency pack * Update pixi.toml Co-authored-by: Hugo <hugo.talbot@sofa-framework.org> * apply review remarks * moving to cmake presets (WIP) * moving to cmake presets (WIP) * fix pixi CI workflow * discard sofaCuda for now * fix cuda-plugin feature to excluse osx * fix typo in activation script * disable cuda on osx * add gmp dependency for cgal plugin * set cuda archs to native * update lockfile * [CMake] Add flag to enable the use of a local directory for external projects (#5511) Add flag to enable the use of a local directory for external projects instead of fetching them * [Collision.Response.Mapper] Remove special characters for generated components' name (#5533) remove special characters * [Type] Remove the namespace on sqrt (#5531) * [CImg] Fix CImg compat (#5526) * fix cimg cmake module to make it compatible with conda package * fix cimg compat for >=v3.5.0 * fix typo in unix activation script * set find python strategy to location * update setup pixi GH action * fix typo for SofaCUDA cmake var * disable all CUDA plugins on macOS * try to disable pixi setup action cache for debugging windows build * update lockfile * cosms * remove macOS x64 CI * build release package relies on full cmake preset * Add plugin-cimg dependencies & update lockfile * fix tinyxml2 cmake find module to make it look also for dlls for packaging * add custom zlib find module to support win installation * add/fix cmake modules to handle dll installation * fix install of cxxopts when found externally on windows for release package * fix QGLViewer cmake module * fix PNG cmake module * force pixi to use default supported python version 3.12 * update lockfile * fix cmake modules old cmake version compat * fix windows post install fixup for Sofa.Qt like plugins * clean debug messages * add automatic bundling of licenses in release package with Pixi * fix cmake for cxxopts installation in build release package * install new cmake modules to be consumed by other Sofa plugins * force custom cmake modules instead of config mode * REMOVE ME: use unmerged PR of Sofa.Qt for CI * disable CGAL plugin support on windows * Revert "REMOVE ME: use unmerged PR of Sofa.Qt for CI" This reverts commit 6bfcca3. * REVERT ME: use GLFW PR 235 * update to recent manifest specs & minor fixes * vs2022 is now the globally pinned compiler for win platforms * update lockfile * rename python feature to supported version * fix deprecated centOS 7 dependencies use (bump to libc 2.28) * clean cmake flags for build release package * reduce to 4 max parallel jobs as in sofa.ci scripts * do not force parrallel build * use patched SofaPython3 * cleaning pixi.toml (wip) * [temp] use fixed branch of CGALPlugin * add test task to runSofa with batch gui (for testing in CI) * update CI for testing * update runSofa task * add feature to compile with clang on linux * update runSofa task * move implementation of OperationFactory::getInstance() to cpp file * Revert "[temp] use fixed branch of CGALPlugin" This reverts commit ed67ba0. * Revert "REVERT ME: use GLFW PR 235" This reverts commit f03c36b. * update lockfile * add tight-inclusion dep * apply windows postinstall script also on non-release builds * remove deprecated collections postinstall fixes * fix cmake error on already defined target * switch back SofaPython3 to master instead of hotfix for running runSofa on macOS * run pixi CI only on push master OR on PR if pixi files changed --------- Co-authored-by: Hugo <hugo.talbot@sofa-framework.org> Co-authored-by: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Co-authored-by: Frederick Roy <fredroy@users.noreply.github.com> Co-authored-by: Alex Bilger <alxbilger@users.noreply.github.com>
1 parent d82852d commit 5eb3ec6

17 files changed

Lines changed: 16602 additions & 17 deletions

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@
2424
## Scripts
2525
*.sh text
2626
*.awk text
27+
# GitHub syntax highlighting
28+
pixi.lock linguist-language=YAML linguist-generated=true
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI - MacOS/Linux/Windows via Pixi
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
paths:
9+
- 'pixi*'
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
sofa-pixi:
18+
name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }}
19+
runs-on: ${{ matrix.os }}
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [ubuntu-latest, macos-latest, macos-15-intel, windows-latest]
25+
environment: [supported-plugins]
26+
build_type: [Release]
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- uses: prefix-dev/setup-pixi@v0.8.10
32+
with:
33+
cache: false
34+
environments: ${{ matrix.environment }}
35+
36+
- name: Build SOFA [MacOS/Linux/Windows]
37+
shell: bash -el {0}
38+
env:
39+
SOFA_BUILD_TYPE: ${{ matrix.build_type }}
40+
run: |
41+
pixi run -e ${{ matrix.environment }} build
42+
43+
- name: Testing - Run SOFA in batch mode [MacOS/Linux/Windows]
44+
shell: bash -el {0}
45+
env:
46+
SOFA_BUILD_TYPE: ${{ matrix.build_type }}
47+
run: |
48+
pixi run -e ${{ matrix.environment }} runSofa -g batch

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,7 @@ compile_commands.json
6969
# to .git/info/exclude instead of .gitignore. Also, .gitignore files
7070
# can be placed in sub-directories to avoid polluting the root one.
7171

72+
73+
# pixi environments
74+
.pixi
75+
*.egg-info

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ install(FILES
104104
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/macdeployqt.cmake"
105105
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/windeployqt.cmake"
106106
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindTinyXML2.cmake"
107+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindPNG.cmake"
108+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindPCRE2.cmake"
109+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindZSTD.cmake"
110+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindZLIB.cmake"
111+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindQGLViewer.cmake"
107112
DESTINATION lib/cmake/Modules
108113
COMPONENT headers
109114
)
@@ -280,6 +285,14 @@ sofa_install_git_infos(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR})
280285
add_subdirectory(tools/postinstall-fixup)
281286

282287
if(SOFA_BUILD_RELEASE_PACKAGE)
288+
# if building release package using Pixi, build a bundle of licence files of all
289+
# dependencies that will be embedded in the package
290+
if($ENV{SOFA_BUILD_RELEASE_PACKAGE_WITH_PIXI})
291+
message("Build SOFA release package using Pixi, bunding licenses...")
292+
execute_process(COMMAND conda-deny bundle -e $ENV{PIXI_ENVIRONMENT_NAME} -p $ENV{PIXI_CURRENT_PLATFORM} -d ${CMAKE_BINARY_DIR}/licenses)
293+
install(DIRECTORY ${CMAKE_BINARY_DIR}/licenses/ DESTINATION licenses COMPONENT applications)
294+
endif()
295+
283296
#######################
284297
# CPack configuration #
285298
#######################

Sofa/GUI/Common/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ cmake_minimum_required(VERSION 3.22)
22
project(Sofa.GUI.Common LANGUAGES CXX)
33

44
find_package(cxxopts 3.1 QUIET)
5-
if(NOT cxxopts_FOUND AND SOFA_ALLOW_FETCH_DEPENDENCIES)
5+
if(cxxopts_FOUND)
6+
if(SOFA_BUILD_RELEASE_PACKAGE AND CMAKE_SYSTEM_NAME STREQUAL Windows)
7+
include(GNUInstallDirs)
8+
# cxxopts development version must be installed (header only + cmake config)
9+
get_target_property(CXXOPTS_INCLUDE_DIR cxxopts::cxxopts INTERFACE_INCLUDE_DIRECTORIES)
10+
install(DIRECTORY ${cxxopts_DIR} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
11+
install(FILES ${CXXOPTS_INCLUDE_DIR}/cxxopts.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
12+
endif()
13+
elseif(NOT cxxopts_FOUND AND SOFA_ALLOW_FETCH_DEPENDENCIES)
614
message("Sofa.GUI.Common: DEPENDENCY cxxopts NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is ON, fetching cxxopts...")
715

816
set(CXXOPTS_BUILD_EXAMPLES OFF CACHE INTERNAL "")

cmake/Modules/FindPCRE2.cmake

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
# pcre2-config.cmake
2+
# ----------------
3+
#
4+
# Finds the PCRE2 library, specify the starting search path in PCRE2_ROOT.
5+
#
6+
# Static vs. shared
7+
# -----------------
8+
# To make use of the static library instead of the shared one, one needs
9+
# to set the variable PCRE2_USE_STATIC_LIBS to ON before calling find_package.
10+
# Example:
11+
# set(PCRE2_USE_STATIC_LIBS ON)
12+
# find_package(PCRE2 CONFIG COMPONENTS 8BIT)
13+
#
14+
# This will define the following variables:
15+
#
16+
# PCRE2_FOUND - True if the system has the PCRE2 library.
17+
# PCRE2_VERSION - The version of the PCRE2 library which was found.
18+
#
19+
# and the following imported targets:
20+
#
21+
# PCRE2::8BIT - The 8 bit PCRE2 library.
22+
# PCRE2::16BIT - The 16 bit PCRE2 library.
23+
# PCRE2::32BIT - The 32 bit PCRE2 library.
24+
# PCRE2::POSIX - The POSIX PCRE2 library.
25+
26+
set(PCRE2_NON_STANDARD_LIB_PREFIX )
27+
set(PCRE2_NON_STANDARD_LIB_SUFFIX )
28+
set(PCRE2_8BIT_NAME pcre2-8)
29+
set(PCRE2_16BIT_NAME pcre2-16)
30+
set(PCRE2_32BIT_NAME pcre2-32)
31+
set(PCRE2_POSIX_NAME pcre2-posix)
32+
find_path(PCRE2_INCLUDE_DIR NAMES pcre2.h DOC "PCRE2 include directory")
33+
if(PCRE2_USE_STATIC_LIBS)
34+
if(MSVC)
35+
set(PCRE2_8BIT_NAME pcre2-8-static)
36+
set(PCRE2_16BIT_NAME pcre2-16-static)
37+
set(PCRE2_32BIT_NAME pcre2-32-static)
38+
set(PCRE2_POSIX_NAME pcre2-posix-static)
39+
endif()
40+
41+
set(PCRE2_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
42+
set(PCRE2_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
43+
else()
44+
set(PCRE2_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
45+
if(MINGW AND PCRE2_NON_STANDARD_LIB_PREFIX)
46+
set(PCRE2_PREFIX "")
47+
endif()
48+
49+
set(PCRE2_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
50+
if(MINGW AND PCRE2_NON_STANDARD_LIB_SUFFIX)
51+
set(PCRE2_SUFFIX "-0.dll")
52+
elseif(MSVC)
53+
set(PCRE2_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
54+
endif()
55+
endif()
56+
find_library(
57+
PCRE2_8BIT_LIBRARY
58+
NAMES ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}d${PCRE2_SUFFIX}
59+
DOC "8 bit PCRE2 library"
60+
)
61+
find_library(
62+
PCRE2_16BIT_LIBRARY
63+
NAMES ${PCRE2_PREFIX}${PCRE2_16BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_16BIT_NAME}d${PCRE2_SUFFIX}
64+
DOC "16 bit PCRE2 library"
65+
)
66+
find_library(
67+
PCRE2_32BIT_LIBRARY
68+
NAMES ${PCRE2_PREFIX}${PCRE2_32BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_32BIT_NAME}d${PCRE2_SUFFIX}
69+
DOC "32 bit PCRE2 library"
70+
)
71+
find_library(
72+
PCRE2_POSIX_LIBRARY
73+
NAMES ${PCRE2_PREFIX}${PCRE2_POSIX_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_POSIX_NAME}d${PCRE2_SUFFIX}
74+
DOC "8 bit POSIX PCRE2 library"
75+
)
76+
77+
if(WIN32)
78+
find_file(
79+
PCRE2_8BIT_DLL
80+
NAMES ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
81+
PATH_SUFFIXES bin
82+
DOC "8 bit PCRE2 DLL"
83+
)
84+
find_file(
85+
PCRE2_16BIT_DLL
86+
NAMES ${PCRE2_PREFIX}${PCRE2_16BIT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
87+
PATH_SUFFIXES bin
88+
DOC "16 bit PCRE2 DLL"
89+
)
90+
find_file(
91+
PCRE2_32BIT_DLL
92+
NAMES ${PCRE2_PREFIX}${PCRE2_32BIT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
93+
PATH_SUFFIXES bin
94+
DOC "32 bit PCRE2 DLL"
95+
)
96+
find_file(
97+
PCRE2_POSIX_DLL
98+
NAMES ${PCRE2_PREFIX}${PCRE2_POSIX_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
99+
PATH_SUFFIXES bin
100+
DOC "8 bit POSIX PCRE2 DLL"
101+
)
102+
endif()
103+
104+
unset(PCRE2_NON_STANDARD_LIB_PREFIX)
105+
unset(PCRE2_NON_STANDARD_LIB_SUFFIX)
106+
unset(PCRE2_8BIT_NAME)
107+
unset(PCRE2_16BIT_NAME)
108+
unset(PCRE2_32BIT_NAME)
109+
unset(PCRE2_POSIX_NAME)
110+
111+
# Set version
112+
if(PCRE2_INCLUDE_DIR)
113+
set(PCRE2_VERSION "10.45.0")
114+
endif()
115+
116+
# Which components have been found.
117+
if(PCRE2_8BIT_LIBRARY AND (NOT WIN32 OR PCRE2_8BIT_DLL))
118+
set(PCRE2_8BIT_FOUND TRUE)
119+
endif()
120+
if(PCRE2_16BIT_LIBRARY AND (NOT WIN32 OR PCRE2_16BIT_DLL))
121+
set(PCRE2_16BIT_FOUND TRUE)
122+
endif()
123+
if(PCRE2_32BIT_LIBRARY AND (NOT WIN32 OR PCRE2_32BIT_DLL))
124+
set(PCRE2_32BIT_FOUND TRUE)
125+
endif()
126+
if(PCRE2_POSIX_LIBRARY AND (NOT WIN32 OR PCRE2_POSIX_DLL))
127+
set(PCRE2_POSIX_FOUND TRUE)
128+
endif()
129+
130+
# Check if at least one component has been specified.
131+
list(LENGTH PCRE2_FIND_COMPONENTS PCRE2_NCOMPONENTS)
132+
if(PCRE2_NCOMPONENTS LESS 1)
133+
message(FATAL_ERROR "No components have been specified. This is not allowed. Please, specify at least one component.")
134+
endif()
135+
unset(PCRE2_NCOMPONENTS)
136+
137+
# When POSIX component has been specified make sure that also 8BIT component is specified.
138+
set(PCRE2_8BIT_COMPONENT FALSE)
139+
set(PCRE2_POSIX_COMPONENT FALSE)
140+
foreach(component ${PCRE2_FIND_COMPONENTS})
141+
if(component STREQUAL "8BIT")
142+
set(PCRE2_8BIT_COMPONENT TRUE)
143+
elseif(component STREQUAL "POSIX")
144+
set(PCRE2_POSIX_COMPONENT TRUE)
145+
endif()
146+
endforeach()
147+
148+
if(PCRE2_POSIX_COMPONENT AND NOT PCRE2_8BIT_COMPONENT)
149+
message(
150+
FATAL_ERROR
151+
"The component POSIX is specified while the 8BIT one is not. This is not allowed. Please, also specify the 8BIT component."
152+
)
153+
endif()
154+
unset(PCRE2_8BIT_COMPONENT)
155+
unset(PCRE2_POSIX_COMPONENT)
156+
157+
include(FindPackageHandleStandardArgs)
158+
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
159+
find_package_handle_standard_args(
160+
PCRE2
161+
FOUND_VAR PCRE2_FOUND
162+
REQUIRED_VARS PCRE2_INCLUDE_DIR
163+
HANDLE_COMPONENTS
164+
VERSION_VAR PCRE2_VERSION
165+
CONFIG_MODE
166+
)
167+
168+
set(PCRE2_LIBRARIES)
169+
if(PCRE2_FOUND)
170+
foreach(component ${PCRE2_FIND_COMPONENTS})
171+
add_library(PCRE2::${component} SHARED IMPORTED)
172+
if(WIN32)
173+
set_target_properties(
174+
PCRE2::${component}
175+
PROPERTIES
176+
IMPORTED_LOCATION "${PCRE2_${component}_DLL}"
177+
IMPORTED_IMPLIB "${PCRE2_${component}_LIBRARY}"
178+
INTERFACE_INCLUDE_DIRECTORIES "${PCRE2_INCLUDE_DIR}"
179+
)
180+
else()
181+
set_target_properties(
182+
PCRE2::${component}
183+
PROPERTIES
184+
IMPORTED_LOCATION "${PCRE2_${component}_LIBRARY}"
185+
IMPORTED_IMPLIB "${PCRE2_${component}_LIBRARY}"
186+
INTERFACE_INCLUDE_DIRECTORIES "${PCRE2_INCLUDE_DIR}"
187+
)
188+
endif()
189+
190+
if(component STREQUAL "POSIX")
191+
set_target_properties(
192+
PCRE2::${component}
193+
PROPERTIES INTERFACE_LINK_LIBRARIES "PCRE2::8BIT" LINK_LIBRARIES "PCRE2::8BIT"
194+
)
195+
endif()
196+
197+
set(PCRE2_LIBRARIES ${PCRE2_LIBRARIES} ${PCRE2_${component}_LIBRARY})
198+
mark_as_advanced(PCRE2_${component}_LIBRARY)
199+
endforeach()
200+
endif()
201+
202+
mark_as_advanced(PCRE2_INCLUDE_DIR)

0 commit comments

Comments
 (0)