Compare commits
No commits in common. "42de1f7dad5dbcb1fb1ffdf0aca061793c07f676" and "0c8282ab5d2047c47e0a7b049920b8f19ca04732" have entirely different histories.
42de1f7dad
...
0c8282ab5d
13
Jenkinsfile
vendored
13
Jenkinsfile
vendored
@ -12,6 +12,7 @@ pipeline {
|
|||||||
stage('Prepare') {
|
stage('Prepare') {
|
||||||
steps {
|
steps {
|
||||||
cleanWs()
|
cleanWs()
|
||||||
|
rtConanClient(id: "conan", userHome: "/home/jackcartersmith")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
@ -21,16 +22,20 @@ pipeline {
|
|||||||
dir("linux") {
|
dir("linux") {
|
||||||
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Texture'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Texture.git']]])
|
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Texture'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Texture.git']]])
|
||||||
sh 'git submodule update --init --recursive'
|
sh 'git submodule update --init --recursive'
|
||||||
sh 'conan install . -of build -s build_type=Release -o tools=True -pr:h=default -pr:b=default --build=missing'
|
dir("build") {
|
||||||
cmakeBuild buildDir: 'build', cmakeArgs: '-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DRSPTEXTURE_SHARED=ON -DRSPTEXTURE_STATIC=OFF -DBUILD_TOOLS=ON -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release', installation: 'latest', steps: [[args: 'all']]
|
rtConanRun(clientId: "conan", command: "install .. -s build_type=Release -pr:h=default -pr:b=default --build=missing")
|
||||||
|
}
|
||||||
|
cmakeBuild buildDir: 'build', cmakeArgs: '-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release', installation: 'latest', steps: [[args: 'all']]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
windows: {
|
windows: {
|
||||||
dir("windows") {
|
dir("windows") {
|
||||||
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-Texture.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-Texture.git']]])
|
||||||
sh 'git submodule update --init --recursive'
|
sh 'git submodule update --init --recursive'
|
||||||
sh 'conan install . -of build -s build_type=Release -o tools=True -pr:b=default -pr:h=windows --build=missing'
|
dir("build") {
|
||||||
cmakeBuild buildDir: 'build', cmakeArgs: '-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DRSPTEXTURE_SHARED=ON -DRSPTEXTURE_STATIC=OFF -DBUILD_TOOLS=ON -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres', installation: 'latest', steps: [[args: 'all']]
|
rtConanRun(clientId: "conan", command: "install .. -s build_type=Release -pr:b=default -pr:h=windows --build=missing")
|
||||||
|
}
|
||||||
|
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']]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
31
README.md
31
README.md
@ -44,39 +44,26 @@ Due to issue with copyrights, I can't provide samples... You need to extract HMT
|
|||||||
|
|
||||||
Necessary libs (provided only in windows release) for running and for compiling.
|
Necessary libs (provided only in windows release) for running and for compiling.
|
||||||
|
|
||||||
- [zlib](https://www.zlib.net/) (1.3.1)
|
- [zlib](https://www.zlib.net/) (1.2.13)
|
||||||
- [libpng](http://www.libpng.org/pub/png/libpng.html) (1.6.43)
|
- [libpng](http://www.libpng.org/pub/png/libpng.html) (1.6.40)
|
||||||
|
|
||||||
### Compiling
|
### 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 (I've abandonned the support for conan v1 as it's now considered as deprecated).
|
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.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
conan install . -of build -b missing -s build_type=Release -o tools=True -pr:b=default -pr:h=default
|
conan install -of build . --build=missing -pr:b=default -pr:h=default
|
||||||
cmake --preset conan-release -G "Unix Makefiles"
|
cd build
|
||||||
cmake --build --preset conan-release
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles"
|
||||||
|
cmake --build .
|
||||||
```
|
```
|
||||||
|
|
||||||
If your CMake<3.23, you should use this command for generation instead of preset one:
|
|
||||||
|
|
||||||
`cmake . -S build -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DRSPTEXTURE_SHARED=ON -DRSPTEXTURE_STATIC=OFF -DBUILD_TOOLS=ON -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles"`
|
|
||||||
|
|
||||||
Beware to use the same release/debug configuration with CMake using Conan! Adjust CMake preset or Conan configuration if necessary.
|
|
||||||
|
|
||||||
On Windows environment, you can use MinGW `-G "MinGW Makefiles"` or Ninja `-G "Ninja"` as CMake generator.
|
On Windows environment, you can use MinGW `-G "MinGW Makefiles"` or Ninja `-G "Ninja"` as CMake generator.
|
||||||
|
|
||||||
### Compiling (options)
|
### Compiling (HARDCORE)
|
||||||
|
|
||||||
There are a few configurable build options:
|
|
||||||
|
|
||||||
- RSPTEXTURE_SHARED Enable the build of shared version of the library ("shared" conan option)
|
|
||||||
- RSPTEXTURE_STATIC Enable the build of static version of the library ("shared" conan option)
|
|
||||||
- BUILD_TOOLS Enable the build of the standalone tools (necessary to use the lib directly) ("tools" conan option)
|
|
||||||
|
|
||||||
### Compiling (old-way)
|
|
||||||
|
|
||||||
If you want to do it manually without Conan, you will probably need to specify the dependency flags for CMake. Ex:
|
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.3.1/include" -D"ZLIB_LIBRARY=zlib/1.3.1/lib/libzlib.dll.a" -D"PNG_PNG_INCLUDE_DIR=libpng/1.6.43/include" -D"PNG_LIBRARY=libpng/1.6.43/lib/libpng.dll.a" -DRSPTEXTURE_SHARED=ON -DRSPTEXTURE_STATIC=OFF -DBUILD_TOOLS=ON . -G "MinGW Makefiles"`
|
`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.
|
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.
|
||||||
|
120
conanfile.py
120
conanfile.py
@ -1,120 +0,0 @@
|
|||||||
import os
|
|
||||||
from conan import ConanFile
|
|
||||||
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake
|
|
||||||
from conan.tools.files import copy
|
|
||||||
from conan.tools.scm import Git, Version
|
|
||||||
|
|
||||||
required_conan_version = ">=2.3"
|
|
||||||
|
|
||||||
class rse_texture(ConanFile):
|
|
||||||
name = "RSETexture"
|
|
||||||
package_type = "library"
|
|
||||||
version = "2.1.0"
|
|
||||||
revision_mode = "scm"
|
|
||||||
license = "GPL-3.0"
|
|
||||||
author = "JackCarterSmith <jackcartersmith@jcsmith.fr>"
|
|
||||||
url = "https://git.jcsmith.fr/JCS-Prod/RSE-Texture"
|
|
||||||
description = "Rogue Squadron 3D (PC) game textures files (HMT) extractor"
|
|
||||||
settings = "os", "compiler", "build_type", "arch"
|
|
||||||
generators = "CMakeDeps"
|
|
||||||
options = {
|
|
||||||
"shared": [True, False],
|
|
||||||
"tools": [True, False],
|
|
||||||
"fPIC": [True, False]
|
|
||||||
}
|
|
||||||
|
|
||||||
default_options = {
|
|
||||||
"shared": True,
|
|
||||||
"tools": False,
|
|
||||||
"fPIC": True
|
|
||||||
}
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _is_msvc(self):
|
|
||||||
return str(self.settings.compiler) in ["Visual Studio", "msvc"]
|
|
||||||
|
|
||||||
#def validate(self):
|
|
||||||
# if self.settings.os == "Macos":
|
|
||||||
# raise ConanInvalidConfiguration("MacOS not supported")
|
|
||||||
|
|
||||||
def config_options(self):
|
|
||||||
if self.settings.os == "Windows":
|
|
||||||
del self.options.fPIC
|
|
||||||
|
|
||||||
def configure(self):
|
|
||||||
self.options["libpng"].shared = True
|
|
||||||
self.options["libpng"].sse = True
|
|
||||||
if self.options.shared:
|
|
||||||
self.options.rm_safe("fPIC")
|
|
||||||
|
|
||||||
def requirements(self):
|
|
||||||
if self.options.tools:
|
|
||||||
self.requires("zlib/1.3.1")
|
|
||||||
self.requires("libpng/1.6.43")
|
|
||||||
|
|
||||||
def source(self):
|
|
||||||
git = Git(self)
|
|
||||||
cargs = ['--single-branch', '--recursive', '--depth', '1', '--branch', 'v' + self.version]
|
|
||||||
git.clone(url="https://git.jcsmith.fr/JCS-Prod/RSE-Texture.git", target=".", args=cargs)
|
|
||||||
|
|
||||||
# def _patch(self):
|
|
||||||
# replace_in_file(self, os.path.join(self.source_folder, "RSPTextureLib", "CMakeLists.txt"),
|
|
||||||
# 'set_target_properties(rsp-texture-libstatic PROPERTIES OUTPUT_NAME "${RSP_TEXTURE_LIB_NAME}_static")',
|
|
||||||
# 'set_target_properties(rsp-texture-libstatic PROPERTIES OUTPUT_NAME "${RSP_TEXTURE_LIB_NAME}")')
|
|
||||||
|
|
||||||
def export_sources(self):
|
|
||||||
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
|
|
||||||
|
|
||||||
# def layout(self):
|
|
||||||
# cmake_layout(self, src_folder='.', build_folder='build')
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
tc = CMakeToolchain(self)
|
|
||||||
tc.cache_variables["RSPTEXTURE_SHARED"] = self.options.shared
|
|
||||||
tc.cache_variables["RSPTEXTURE_STATIC"] = not self.options.shared
|
|
||||||
tc.cache_variables["BUILD_TOOLS"] = self.options.tools
|
|
||||||
#tc.cache_variables["BUILD_DEBUG"] = self.settings.build_type == "Debug"
|
|
||||||
tc.generate()
|
|
||||||
|
|
||||||
#cmdeps = CMakeDeps(self)
|
|
||||||
#cmpdeps.set_property("zlib", "cmake_find_mode", "both")
|
|
||||||
#cmpdeps.set_property("libpng", "cmake_find_mode", "both")
|
|
||||||
#if self.options.shared:
|
|
||||||
#cmdeps.configuration = "ReleaseShared"
|
|
||||||
#cmdeps.generate()
|
|
||||||
|
|
||||||
for dep in self.dependencies.values():
|
|
||||||
if self.settings.os == "Windows":
|
|
||||||
if self._is_msvc:
|
|
||||||
copy(self, "*.dll", dep.cpp_info.bindirs[0], os.path.join(self.build_folder, "bin", str(self.settings.build_type)))
|
|
||||||
else:
|
|
||||||
copy(self, "*.dll", dep.cpp_info.bindirs[0], os.path.join(self.build_folder, "bin"))
|
|
||||||
else:
|
|
||||||
copy(self, "*.so", dep.cpp_info.bindirs[0], os.path.join(self.build_folder, "bin"))
|
|
||||||
|
|
||||||
def build(self):
|
|
||||||
cmbuilder = CMake(self)
|
|
||||||
#self._patch()
|
|
||||||
cmbuilder.configure()
|
|
||||||
cmbuilder.build()
|
|
||||||
|
|
||||||
def package(self):
|
|
||||||
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
|
||||||
copy(self, pattern="*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include"))
|
|
||||||
copy(self, pattern="*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False)
|
|
||||||
copy(self, pattern="*.so", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False)
|
|
||||||
copy(self, pattern="*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False)
|
|
||||||
copy(self, pattern="*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False)
|
|
||||||
|
|
||||||
def package_info(self):
|
|
||||||
self.cpp_info.set_property("cmake_file_name", "RSPTexture")
|
|
||||||
self.cpp_info.set_property("cmake_target_name", "RSPTexture")
|
|
||||||
self.cpp_info.set_property("cmake_module_target_name", "RSPTexture::RSPTexture")
|
|
||||||
self.cpp_info.set_property("cmake_find_mode", "both")
|
|
||||||
|
|
||||||
prefix = "lib" if self._is_msvc else ""
|
|
||||||
#suffix = "d" if self.settings.build_type == "Debug" else ""
|
|
||||||
suffix = ""
|
|
||||||
major_min_version = f"{Version(self.version).major}{Version(self.version).minor}"
|
|
||||||
|
|
||||||
self.cpp_info.libs = ["{}RSPTexture{}{}".format(prefix, major_min_version, suffix)]
|
|
13
conanfile.txt
Normal file
13
conanfile.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[requires]
|
||||||
|
zlib/1.2.13
|
||||||
|
libpng/1.6.40
|
||||||
|
|
||||||
|
[generators]
|
||||||
|
CMakeDeps
|
||||||
|
CMakeToolchain
|
||||||
|
|
||||||
|
[options]
|
||||||
|
libpng/*:shared=True
|
||||||
|
|
||||||
|
[imports]
|
||||||
|
bin, *.dll -> ./bin
|
Loading…
x
Reference in New Issue
Block a user