conan: allow repeated executions of conan build
This commit is contained in:
parent
b375e20c75
commit
a78e4a3366
61
conanfile.py
61
conanfile.py
@ -81,38 +81,41 @@ class Re3Conan(ConanFile):
|
|||||||
def build(self):
|
def build(self):
|
||||||
if self.source_folder == self.build_folder:
|
if self.source_folder == self.build_folder:
|
||||||
raise Exception("cannot build with source_folder == build_folder")
|
raise Exception("cannot build with source_folder == build_folder")
|
||||||
os.unlink(os.path.join(self.install_folder, "Findlibrw.cmake"))
|
try:
|
||||||
tools.save("FindOpenAL.cmake",
|
os.unlink(os.path.join(self.install_folder, "Findlibrw.cmake"))
|
||||||
textwrap.dedent(
|
tools.save("FindOpenAL.cmake",
|
||||||
"""
|
|
||||||
set(OPENAL_FOUND ON)
|
|
||||||
set(OPENAL_INCLUDE_DIR ${OpenAL_INCLUDE_DIRS})
|
|
||||||
set(OPENAL_LIBRARY ${OpenAL_LIBRARIES})
|
|
||||||
set(OPENAL_DEFINITIONS ${OpenAL_DEFINITIONS})
|
|
||||||
"""), append=True)
|
|
||||||
if self.options["librw"].platform == "gl3" and self.options["librw"].gl3_gfxlib == "glfw":
|
|
||||||
tools.save("Findglfw3.cmake",
|
|
||||||
textwrap.dedent(
|
textwrap.dedent(
|
||||||
"""
|
"""
|
||||||
if(NOT TARGET glfw)
|
set(OPENAL_FOUND ON)
|
||||||
message(STATUS "Creating glfw TARGET")
|
set(OPENAL_INCLUDE_DIR ${OpenAL_INCLUDE_DIRS})
|
||||||
add_library(glfw INTERFACE IMPORTED)
|
set(OPENAL_LIBRARY ${OpenAL_LIBRARIES})
|
||||||
set_target_properties(glfw PROPERTIES
|
set(OPENAL_DEFINITIONS ${OpenAL_DEFINITIONS})
|
||||||
INTERFACE_LINK_LIBRARIES CONAN_PKG::glfw)
|
|
||||||
endif()
|
|
||||||
"""), append=True)
|
"""), append=True)
|
||||||
tools.save("CMakeLists.txt",
|
if self.options["librw"].platform == "gl3" and self.options["librw"].gl3_gfxlib == "glfw":
|
||||||
textwrap.dedent(
|
tools.save("Findglfw3.cmake",
|
||||||
"""
|
textwrap.dedent(
|
||||||
cmake_minimum_required(VERSION 3.0)
|
"""
|
||||||
project(cmake_wrapper)
|
if(NOT TARGET glfw)
|
||||||
|
message(STATUS "Creating glfw TARGET")
|
||||||
include("{}/conanbuildinfo.cmake")
|
add_library(glfw INTERFACE IMPORTED)
|
||||||
conan_basic_setup(TARGETS)
|
set_target_properties(glfw PROPERTIES
|
||||||
|
INTERFACE_LINK_LIBRARIES CONAN_PKG::glfw)
|
||||||
add_subdirectory("{}" re3)
|
endif()
|
||||||
""").format(self.install_folder.replace("\\", "/"),
|
"""), append=True)
|
||||||
self.source_folder.replace("\\", "/")))
|
tools.save("CMakeLists.txt",
|
||||||
|
textwrap.dedent(
|
||||||
|
"""
|
||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
project(cmake_wrapper)
|
||||||
|
|
||||||
|
include("{}/conanbuildinfo.cmake")
|
||||||
|
conan_basic_setup(TARGETS)
|
||||||
|
|
||||||
|
add_subdirectory("{}" re3)
|
||||||
|
""").format(self.install_folder.replace("\\", "/"),
|
||||||
|
self.source_folder.replace("\\", "/")))
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
cmake = CMake(self)
|
cmake = CMake(self)
|
||||||
cmake.definitions["RE3_AUDIO"] = self._re3_audio
|
cmake.definitions["RE3_AUDIO"] = self._re3_audio
|
||||||
cmake.definitions["RE3_WITH_OPUS"] = self.options.with_opus
|
cmake.definitions["RE3_WITH_OPUS"] = self.options.with_opus
|
||||||
|
Loading…
Reference in New Issue
Block a user