Validated conan v2 migration
All checks were successful
JCS-Prod/RSE-Terrain/pipeline/head This commit looks good

This commit is contained in:
JackCarterSmith 2024-05-19 10:08:52 +02:00
parent ebfd3faeaa
commit 753089aec8
Signed by: JackCarterSmith
GPG Key ID: 832E52F4E23F8F24
7 changed files with 43 additions and 59 deletions

1
.gitignore vendored
View File

@ -75,3 +75,4 @@ install_manifest.txt
compile_commands.json compile_commands.json
CTestTestfile.cmake CTestTestfile.cmake
_deps _deps
CMakeUserPresets.json

View File

@ -7,8 +7,8 @@
# CMake requirement and general configuration # CMake requirement and general configuration
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.15)
cmake_policy(VERSION 3.12) cmake_policy(VERSION 3.15)
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
if(DEFINED ENV{MS_COMPATIBLE}) if(DEFINED ENV{MS_COMPATIBLE})
set(CMAKE_GNUtoMS ON) # Enable compatibility level to exported libraries set(CMAKE_GNUtoMS ON) # Enable compatibility level to exported libraries
@ -24,7 +24,6 @@ else() # Standalone project mode, should not be used for release.
set(RSE_TERRAIN_NAME RSETerrain) set(RSE_TERRAIN_NAME RSETerrain)
endif() endif()
set(RSP_TERRAIN_LIB_NAME RSPTerrain${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}) set(RSP_TERRAIN_LIB_NAME RSPTerrain${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")

8
Jenkinsfile vendored
View File

@ -23,9 +23,9 @@ pipeline {
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Terrain'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Terrain.git']]]) checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Terrain'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Terrain.git']]])
sh 'git submodule update --init --recursive' sh 'git submodule update --init --recursive'
dir("build") { dir("build") {
rtConanRun(clientId: "conan", command: "install .. -pr:b=default -pr:h=default --build=missing") rtConanRun(clientId: "conan", command: "install .. -s build_type=Release -pr:b=default -pr:h=default --build=missing")
} }
cmakeBuild buildDir: 'build', installation: 'latest', steps: [[args: 'all']] cmakeBuild buildDir: 'build', cmakeArgs: '-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release', installation: 'latest', steps: [[args: 'all']]
} }
}, },
windows: { windows: {
@ -33,9 +33,9 @@ pipeline {
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Terrain'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Terrain.git']]]) checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Terrain'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Terrain.git']]])
sh 'git submodule update --init --recursive' sh 'git submodule update --init --recursive'
dir("build") { dir("build") {
rtConanRun(clientId: "conan", command: "install .. -pr:b=default -pr:h=windows --build=missing") rtConanRun(clientId: "conan", command: "install .. -s build_type=Release -pr:b=default -pr:h=windows --build=missing")
} }
cmakeBuild buildDir: 'build', cmakeArgs: '-DGNU_HOST=x86_64-w64-mingw32 -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw_cross_toolchain.cmake', installation: 'latest', steps: [[args: 'all']] cmakeBuild buildDir: 'build', cmakeArgs: '-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release', installation: 'latest', steps: [[args: 'all']]
} }
} }
) )

View File

@ -43,46 +43,34 @@ Due to issue with copyrights, I can't provide samples... You need to extract HOB
### Dependencies ### Dependencies
- libpng (1.6.37) - [zlib](https://www.zlib.net/) (1.2.13)
- obj-lib: as obj file exporter. (https://git.jcsmith.fr/jackcartersmith/obj) - [libpng](http://www.libpng.org/pub/png/libpng.html) (1.6.40)
- [obj-lib](https://git.jcsmith.fr/jackcartersmith/obj "obj file exporter")
### Compiling ### Compiling
You can compile on both Windows (MinGW) or native Linux system thanks to CMake, you only need to adjust your dependencies on Windows or use Conan packages manager (https://conan.io). You can compile on both Windows (MinGW) or native Linux environment thanks to CMake, you only need to adjust your dependencies on Windows or use Conan packages manager (https://conan.io).
libpng16-dev distrib package can be used on debian/ubuntu. libpng16-dev distrib package can be used on debian/ubuntu.
To compile, just clone (**don't forget git submodules**) and launch cmake:
### Compiling
I've a preference for compiling libraries by hand, mainly for backward compatibility, but I recommend using Conan packages manager (https://conan.io) for simplicity. (**Don't forget git submodules**)
```shell ```shell
cmake . conan install -of build . --build=missing -pr:b=default -pr:h=default
make
make install
```
On Windows system, I can suggest you to use Conan support to help you with dependencies:
```shell
mkdir build
cd build cd build
conan install .. --build=missing cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles"
cmake .. -G "MinGW Makefiles"
make
```
If you want to do it manually without Conan support, you will probably need to specify the dependency flags for CMake. Ex:
`cmake.exe -D"ZLIB_INCLUDE_DIR=zlib/1.2.11/include" -D"ZLIB_LIBRARY=zlib/1.2.11/lib/libzlib.dll.a" -D"PNG_PNG_INCLUDE_DIR=libpng/1.6.37/include" -D"PNG_LIBRARY=libpng/1.6.37/lib/libpng.dll.a" . -G "MinGW Makefiles"`
We can also use cross-compilation (after installing `mingw64` and `cmake` packages on your distrib):
```shell
mkdir build && cd build
cmake -DGNU_HOST=x86_64-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE=../cmake/mingw_cross_toolchain.cmake \
-D"ZLIB_INCLUDE_DIR=zlib/1.2.11/include" \
-D"ZLIB_LIBRARY=zlib/1.2.11/lib/libzlib.dll.a" \
-D"PNG_PNG_INCLUDE_DIR=libpng/1.6.37/include" \
-D"PNG_LIBRARY=libpng/1.6.37/lib/libpng.dll.a" \
..
cmake --build . cmake --build .
``` ```
On Windows environment, you can use MinGW `-G "MinGW Makefiles"` or Ninja `-G "Ninja"` as CMake generator.
### Compiling (HARDCORE)
If you want to do it manually without Conan, you will probably need to specify the dependency flags for CMake. Ex:
`cmake.exe -D"ZLIB_INCLUDE_DIR=zlib/1.2.13/include" -D"ZLIB_LIBRARY=zlib/1.2.13/lib/libzlib.dll.a" -D"PNG_PNG_INCLUDE_DIR=libpng/1.6.40/include" -D"PNG_LIBRARY=libpng/1.6.40/lib/libpng.dll.a" . -G "MinGW Makefiles"`
I've tested cross-compilation too, but since I want to check that Conan is working properly at each release, I've integrated it into the Jenkins flow using Conan for the cross-abstraction.

View File

@ -12,7 +12,7 @@ include(CheckCSourceCompiles)
if(BUILD_TOOLS) if(BUILD_TOOLS)
# Import needed packages and references their include path # Import needed packages and references their include path
find_package(PNG 1.6.37 REQUIRED) find_package(PNG 1.6.40 REQUIRED)
include_directories(${PNG_INCLUDE_DIR}) include_directories(${PNG_INCLUDE_DIR})
find_package(GLEW REQUIRED) find_package(GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIR}) include_directories(${GLEW_INCLUDE_DIR})
@ -44,9 +44,13 @@ if(BUILD_TOOLS)
endif() endif()
# Link externals libraries to the linker # Link externals libraries to the linker
if(RSPTERRAIN_SHARED) if (TARGET GLEW::GLEW)
target_link_libraries(rse-terrain PRIVATE rsp-terrain-lib ${PNG_LIBRARIES} ${GLEW_LIBRARIES} ${AUX_LIBS}) if (TARGET PNG::PNG)
elseif(RSPTERRAIN_STATIC) if(RSPTERRAIN_SHARED)
target_link_libraries(rse-terrain PRIVATE rsp-terrain-libstatic ${PNG_LIBRARIES} ${GLEW_LIBRARIES} ${AUX_LIBS}) target_link_libraries(rse-terrain PRIVATE rsp-terrain-lib PNG::PNG GLEW::GLEW ${AUX_LIBS})
elseif(RSPTERRAIN_STATIC)
target_link_libraries(rse-terrain PRIVATE rsp-terrain-libstatic PNG::PNG GLEW::GLEW ${AUX_LIBS})
endif()
endif()
endif() endif()
endif() endif()

View File

@ -1,8 +0,0 @@
SET(CMAKE_SYSTEM_NAME Windows)
IF("${GNU_HOST}" STREQUAL "")
SET(GNU_HOST i586-mingw32msvc)
ENDIF()
# Prefix detection only works with compiler id "GNU"
SET(CMAKE_C_COMPILER ${GNU_HOST}-gcc)
# CMake doesn't automatically look for prefixed 'windres', do it manually:
SET(CMAKE_RC_COMPILER ${GNU_HOST}-windres)

View File

@ -1,15 +1,15 @@
[requires] [requires]
zlib/1.2.12 zlib/1.2.13
libpng/1.6.37 libpng/1.6.40
glew/2.2.0 glew/2.2.0
[generators] [generators]
cmake CMakeDeps
cmake_find_package CMakeToolchain
[options] [options]
libpng:shared=True libpng/*:shared=True
glew:shared=True glew/*:shared=True
[imports] [imports]
bin, *.dll -> ./bin bin, *.dll -> ./bin