Skip to content

Commit

Permalink
Refactor to a modern conan integration
Browse files Browse the repository at this point in the history
The CMakeToolchain and CMakeDeps are the recommended generators and are
supported in Conan 2.0 as well.
  • Loading branch information
dariusarnold committed Mar 29, 2023
1 parent c8d49cd commit 9ece342
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ project(game_boy_emulator)

set(CMAKE_CXX_STANDARD 20)

# This is done because after executing "conan install .." in the binary dir, conan_paths.cmake
# will set up CMAKE_MODULE_PATH so find_package will find the packages install by conan.
include(${CMAKE_BINARY_DIR}/conan_paths.cmake OPTIONAL RESULT_VARIABLE CONAN_PATHS_FOUND)
if (${CONAN_PATHS_FOUND} STREQUAL "NOTFOUND")
message(STATUS "File conan_paths.cmake not found. Maybe conan install was not executed?")
endif ()
find_package(fmt REQUIRED)
find_package(Catch2 REQUIRED)
find_package(SDL2 REQUIRED)
Expand Down
22 changes: 19 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
from conans import ConanFile, CMake
from conans import ConanFile
from conan.tools.cmake import cmake_layout


class GameBoyEmulatorConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "fmt/9.1.0", "catch2/2.13.6", "imgui/1.88", "magic_enum/0.8.1", "spdlog/1.11.0", "argparse/2.9", "boost/1.80.0", "sdl/2.26.1", ("nas/1.9.4", "override")
generators = "cmake_find_package", "cmake_paths"
generators = "CMakeToolchain", "CMakeDeps"

def requirements(self):
self.requires("fmt/9.1.0")
self.requires("imgui/1.88")
self.requires("magic_enum/0.8.1")
self.requires("spdlog/1.11.0")
self.requires("argparse/2.9")
self.requires("boost/1.80.0")
self.requires("sdl/2.26.1")
self.requires("catch2/2.13.6")
if "arm" in self.settings.arch:
self.requires("nas/1.9.4", override=True)

def layout(self):
cmake_layout(self)

def configure(self):
self.options["boost"].header_only = True
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ target_link_libraries(game_boy_emulator_library PUBLIC
magic_enum::magic_enum
spdlog::spdlog
fmt::fmt
Boost::Boost
boost::boost
)
# Required for the compile time caching of tile lines.
target_compile_options(game_boy_emulator_library PRIVATE
Expand Down

0 comments on commit 9ece342

Please sign in to comment.