Skip to content

Commit

Permalink
Merge pull request #309 from dpaulat/feature/conan-2
Browse files Browse the repository at this point in the history
Conan 2
  • Loading branch information
dpaulat authored Nov 30, 2024
2 parents 1ea94b0 + 82cec1d commit 40b3ecc
Show file tree
Hide file tree
Showing 36 changed files with 246 additions and 102 deletions.
52 changes: 23 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ jobs:
qt_arch_dir: msvc2022_64
qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport
qt_tools: ''
conan_arch: x86_64
conan_compiler: Visual Studio
conan_compiler_version: 17
conan_compiler_runtime: --settings compiler.runtime=MD
conan_compiler_libcxx: ''
conan_package_manager: ''
conan_profile: scwx-win64_msvc2022
artifact_suffix: windows-x64
- name: linux64_gcc
os: ubuntu-22.04
Expand All @@ -51,12 +47,8 @@ jobs:
qt_arch_dir: gcc_64
qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport
qt_tools: ''
conan_arch: x86_64
conan_compiler: gcc
conan_compiler_version: 11
conan_compiler_libcxx: --settings compiler.libcxx=libstdc++
conan_compiler_runtime: ''
conan_package_manager: --conf tools.system.package_manager:mode=install --conf tools.system.package_manager:sudo=True
conan_profile: scwx-linux_gcc-11
artifact_suffix: linux-x64
compiler_packages: ''
- name: linux64_clang
Expand All @@ -70,12 +62,8 @@ jobs:
qt_arch_dir: gcc_64
qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport
qt_tools: ''
conan_arch: x86_64
conan_compiler: clang
conan_compiler_version: 17
conan_compiler_libcxx: --settings compiler.libcxx=libstdc++11
conan_compiler_runtime: ''
conan_package_manager: --conf tools.system.package_manager:mode=install --conf tools.system.package_manager:sudo=True
conan_profile: scwx-linux_clang-17
artifact_suffix: linux-clang-x64
compiler_packages: clang-17
name: ${{ matrix.name }}
Expand Down Expand Up @@ -128,35 +116,41 @@ jobs:
- name: Install Conan Packages
shell: pwsh
run: |
pip install "conan<2.0"
conan profile new default --detect
conan install ./source/ `
pip install conan
conan profile detect -e
conan config install `
./source/tools/conan/profiles/${{ matrix.conan_profile }} `
-tf profiles
mkdir build
cd build
mkdir conan
conan install ../source/ `
--remote conancenter `
--build missing `
--settings arch=${{ matrix.conan_arch }} `
--settings build_type=${{ matrix.build_type }} `
--settings compiler="${{ matrix.conan_compiler }}" `
--settings compiler.version=${{ matrix.conan_compiler_version }} `
${{ matrix.conan_compiler_libcxx }} `
${{ matrix.conan_compiler_runtime }} `
--profile:all ${{ matrix.conan_profile }} `
--settings:all build_type=${{ matrix.build_type }} `
--output-folder ./conan/ `
${{ matrix.conan_package_manager }}
- name: Build Supercell Wx
shell: pwsh
run: |
mkdir build
cd build
cmake ../source/ `
-G Ninja `
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" `
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/supercell-wx"
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="${{ github.workspace }}/source/external/cmake-conan/conan_provider.cmake" `
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/supercell-wx" `
-DCONAN_HOST_PROFILE="${{ matrix.conan_profile }}" `
-DCONAN_BUILD_PROFILE="${{ matrix.conan_profile }}"
ninja supercell-wx wxtest
- name: Separate Debug Symbols (Linux)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
shell: bash
run: |
cd build/
cd Release/
cd bin/
objcopy --only-keep-debug supercell-wx supercell-wx.debug
objcopy --strip-debug --strip-unneeded supercell-wx
Expand Down Expand Up @@ -201,7 +195,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: supercell-wx-debug-${{ matrix.artifact_suffix }}
path: ${{ github.workspace }}/build/bin/*.pdb
path: ${{ github.workspace }}/build/Release/bin/*.pdb

- name: Upload Artifacts (Linux)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
Expand All @@ -216,8 +210,8 @@ jobs:
with:
name: supercell-wx-debug-${{ matrix.artifact_suffix }}
path: |
${{ github.workspace }}/build/bin/*.debug
${{ github.workspace }}/build/lib/*.debug
${{ github.workspace }}/build/Release/bin/*.debug
${{ github.workspace }}/build/Release/lib/*.debug
- name: Build Installer (Windows)
if: matrix.os == 'windows-2022'
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/clang-tidy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ jobs:
qt_arch_aqt: linux_gcc_64
qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport
qt_tools: ''
conan_arch: x86_64
conan_compiler: clang
conan_compiler_version: 17
conan_compiler_libcxx: --settings compiler.libcxx=libstdc++11
conan_compiler_runtime: ''
conan_package_manager: --conf tools.system.package_manager:mode=install --conf tools.system.package_manager:sudo=True
conan_profile: scwx-linux_clang-17
compiler_packages: clang-17 clang-tidy-17
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -78,28 +74,33 @@ jobs:
- name: Install Conan Packages
shell: pwsh
run: |
pip install "conan<2.0"
conan profile new default --detect
conan install ./source/ `
pip install conan
conan profile detect -e
conan config install `
./source/tools/conan/profiles/${{ matrix.conan_profile }} `
-tf profiles
mkdir build
cd build
mkdir conan
conan install ../source/ `
--remote conancenter `
--build missing `
--settings arch=${{ matrix.conan_arch }} `
--settings build_type=${{ matrix.build_type }} `
--settings compiler="${{ matrix.conan_compiler }}" `
--settings compiler.version=${{ matrix.conan_compiler_version }} `
${{ matrix.conan_compiler_libcxx }} `
${{ matrix.conan_compiler_runtime }} `
--profile:all ${{ matrix.conan_profile }} `
--settings:all build_type=${{ matrix.build_type }} `
--output-folder ./conan/ `
${{ matrix.conan_package_manager }}
- name: Autogenerate
shell: pwsh
run: |
mkdir build
cd build
cmake ../source/ `
-G Ninja `
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" `
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="${{ github.workspace }}/source/external/cmake-conan/conan_provider.cmake" `
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/supercell-wx" `
-DCONAN_HOST_PROFILE="${{ matrix.conan_profile }}" `
-DCONAN_BUILD_PROFILE="${{ matrix.conan_profile }}" `
-DCMAKE_EXPORT_COMPILE_COMMANDS=on
ninja scwx-qt_generate_counties_db `
scwx-qt_generate_versions `
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
CMakeUserPresets.json
Testing
cmake_install.cmake
install_manifest.txt
Expand Down
27 changes: 5 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.24)
set(PROJECT_NAME supercell-wx)
project(${PROJECT_NAME}
VERSION 0.4.7
Expand All @@ -11,36 +11,19 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0079 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0148 OLD) # aws-sdk-cpp uses FindPythonInterp

include(tools/scwx_config.cmake)

scwx_output_dirs_setup()

enable_testing()

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

include(${PROJECT_SOURCE_DIR}/external/cmake-conan/conan.cmake)

set_property(DIRECTORY
APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS
conanfile.py)

# Don't use RelWithDebInfo Conan packages
if (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
set(conan_build_type "Release")
else()
set(conan_build_type ${CMAKE_BUILD_TYPE})
endif()

conan_cmake_autodetect(settings
BUILD_TYPE ${conan_build_type})

conan_cmake_install(PATH_OR_REFERENCE ${PROJECT_SOURCE_DIR}
BUILD missing
REMOTE conancenter
SETTINGS ${settings})

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
conan_basic_setup(TARGETS)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_ALL_NO_LIB")

set(SCWX_DIR ${PROJECT_SOURCE_DIR})
Expand Down
44 changes: 31 additions & 13 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,55 @@
from conans import ConanFile
from conan import ConanFile
from conan.tools.cmake import CMake
from conan.tools.files import copy
import os

class SupercellWxConan(ConanFile):
settings = ("os", "compiler", "build_type", "arch")
requires = ("boost/1.86.0",
"cpr/1.11.0",
"fontconfig/2.15.0",
"freetype/2.13.3",
"freetype/2.13.2",
"geographiclib/2.4",
"geos/3.13.0",
"glew/2.2.0",
"glm/cci.20230113",
"gtest/1.15.0",
"libcurl/8.10.1",
"libpng/1.6.44",
"libxml2/2.12.7",
"openssl/3.3.2",
"re2/20240702",
"spdlog/1.14.1",
"sqlite3/3.46.1",
"vulkan-loader/1.3.243.0",
"zlib/1.3.1")
generators = ("cmake",
"cmake_find_package",
"cmake_paths")
default_options = {"geos:shared" : True,
"libiconv:shared" : True,
"openssl:no_module": True,
"openssl:shared" : True}
generators = ("CMakeDeps")
default_options = {"geos/*:shared" : True,
"libiconv/*:shared" : True,
"openssl/*:no_module": True,
"openssl/*:shared" : True}

def requirements(self):
if self.settings.os == "Linux":
self.requires("onetbb/2021.12.0")

def imports(self):
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.dylib", dst="bin", src="lib")
self.copy("license*", dst="licenses", src=".", folder=True, ignore_case=True)
def generate(self):
build_folder = os.path.join(self.build_folder,
"..",
str(self.settings.build_type),
self.cpp_info.bindirs[0])

for dep in self.dependencies.values():
if dep.cpp_info.bindirs:
copy(self, "*.dll", dep.cpp_info.bindirs[0], build_folder)
if dep.cpp_info.libdirs:
copy(self, "*.dylib", dep.cpp_info.libdirs[0], build_folder)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = CMake(self)
cmake.install()
2 changes: 1 addition & 1 deletion external/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.24)
set(PROJECT_NAME scwx-external)

set_property(DIRECTORY
Expand Down
2 changes: 1 addition & 1 deletion external/aws-sdk-cpp
6 changes: 5 additions & 1 deletion external/aws-sdk-cpp.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.24)
set(PROJECT_NAME scwx-aws-sdk-cpp)

set(AWS_SDK_WARNINGS_ARE_ERRORS OFF)
Expand All @@ -21,6 +21,10 @@ set(MINIMIZE_SIZE OFF CACHE BOOL "If enabled, the SDK will be built via
# Save off ${CMAKE_CXX_FLAGS} before modifying compiler settings
set(CMAKE_CXX_FLAGS_PREV "${CMAKE_CXX_FLAGS}")

# Configure OpenSSL crypto library
find_package(OpenSSL)
add_library(crypto ALIAS OpenSSL::Crypto)

# Fix CMake errors for internal variables not set
include(aws-sdk-cpp/cmake/compiler_settings.cmake)
set_msvc_warnings()
Expand Down
2 changes: 1 addition & 1 deletion external/cmake-conan
Submodule cmake-conan updated 48 files
+44 −11 .github/workflows/cmake_conan.yml
+10 −1 .gitignore
+0 −33 CMakeLists.txt
+47 −482 README.md
+0 −1,146 conan.cmake
+676 −0 conan_provider.cmake
+2 −0 example/.gitignore
+10 −0 example/CMakeLists.txt
+8 −0 example/conanfile.txt
+6 −0 example/main.cpp
+0 −6 main.cpp
+0 −1,294 tests.py
+3 −0 tests/pytest.ini
+8 −0 tests/resources/autotools_dependency/CMakeLists.txt
+2 −0 tests/resources/autotools_dependency/conanfile.txt
+13 −0 tests/resources/basic_cmake/CMakeLists.txt
+4 −0 tests/resources/basic_cmake/conanfile.txt
+13 −0 tests/resources/basic_cmake/main.cpp
+15 −0 tests/resources/change_generators/duplicate_generator/conanfile.py
+8 −0 tests/resources/change_generators/no_generator_py/conanfile.py
+3 −0 tests/resources/change_generators/no_generator_txt/conanfile.txt
+13 −0 tests/resources/change_generators/single_generator/conanfile.py
+48 −0 tests/resources/cmake_module_path/library_with_cmake_module_dir/CMakeLists.txt
+8 −0 tests/resources/cmake_module_path/library_with_cmake_module_dir/conanfile.txt
+18 −0 tests/resources/cmake_module_path/module_only/CMakeLists.txt
+5 −0 tests/resources/cmake_module_path/module_only/conanfile.txt
+2 −0 tests/resources/custom_config/profiles/bar
+2 −0 tests/resources/custom_config/profiles/foo
+8 −0 tests/resources/custom_profiles/invalid_os
+13 −0 tests/resources/find_module/basic_module/CMakeLists.txt
+16 −0 tests/resources/find_module/builtin_module/CMakeLists.txt
+9 −0 tests/resources/find_module/cmake_builtin_module/CMakeLists.txt
+21 −0 tests/resources/find_module/policy_scope/CMakeLists.txt
+58 −0 tests/resources/recipes/boost/conanfile.py
+56 −0 tests/resources/recipes/bye/conanfile.py
+60 −0 tests/resources/recipes/cmake-module-only/conanfile.py
+60 −0 tests/resources/recipes/cmake-module-with-dependency/conanfile.py
+9 −0 tests/resources/subdir/CMakeLists.txt
+4 −0 tests/resources/subdir/conanfile.txt
+6 −0 tests/resources/subdir/subdir/CMakeLists.txt
+2 −0 tests/resources/subdir/subdir/main.cpp
+5 −0 tests/resources/subdir2/CMakeLists.txt
+2 −0 tests/resources/subdir2/conanfile.txt
+3 −0 tests/resources/subdir2/subdir/CMakeLists.txt
+2 −0 tests/resources/subdir2/subdir/main.cpp
+17 −0 tests/resources/try_compile/CMakeLists.txt
+8 −0 tests/resources/try_compile/conanfile.txt
+757 −0 tests/test_smoke.py
2 changes: 1 addition & 1 deletion external/date.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.24)
set(PROJECT_NAME scwx-date)

set(USE_SYSTEM_TZ_DB ON)
Expand Down
2 changes: 1 addition & 1 deletion external/hsluv-c.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.24)
set(PROJECT_NAME scwx-hsluv-c)

set(HSLUV_C_TESTS OFF)
Expand Down
2 changes: 1 addition & 1 deletion external/imgui.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.24)
set(PROJECT_NAME scwx-imgui)

find_package(QT NAMES Qt6
Expand Down
2 changes: 1 addition & 1 deletion external/maplibre-native-qt.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.24)
set(PROJECT_NAME scwx-mln)

set(gtest_disable_pthreads ON)
Expand Down
2 changes: 1 addition & 1 deletion external/stb.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.24)
set(PROJECT_NAME scwx-stb)

set(STB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/stb PARENT_SCOPE)
2 changes: 1 addition & 1 deletion external/textflowcpp.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.24)
set(PROJECT_NAME scwx-textflowcpp)

set(TEXTFLOWCPP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/textflowcpp PARENT_SCOPE)
2 changes: 1 addition & 1 deletion external/units.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.24)
set(PROJECT_NAME scwx-units)

add_subdirectory(units)
2 changes: 1 addition & 1 deletion scwx-qt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.24)

set_property(DIRECTORY
APPEND
Expand Down
2 changes: 1 addition & 1 deletion scwx-qt/scwx-qt.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.24)

project(scwx-qt LANGUAGES CXX)

Expand Down
Loading

0 comments on commit 40b3ecc

Please sign in to comment.