forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(conan-io#15414) baical-p7: conan v2 support
* conan v2 support * add libm to system libs
- Loading branch information
1 parent
472f88a
commit 262491d
Showing
8 changed files
with
174 additions
and
67 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -1,6 +1,6 @@ | ||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR) | ||
|
||
-#project(p7lib) | ||
+project(p7lib) | ||
|
||
#>>Build options ********************************************************************** | ||
option(P7_TESTS_BUILD "Build test" OFF) | ||
@@ -25,7 +25,6 @@ if(NOT DEFINED ROOT_P7_PATH) | ||
set(ROOT_P7_PATH ${PROJECT_SOURCE_DIR} CACHE INTERNAL "") | ||
set(PATH_P7 ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "") | ||
set(PATH_P7_API "${PROJECT_SOURCE_DIR}/Headers" CACHE INTERNAL "") | ||
-else(expression) | ||
endif(NOT DEFINED ROOT_P7_PATH) | ||
|
||
if(MSVC) | ||
--- a/Sources/CMakeLists.txt | ||
+++ b/Sources/CMakeLists.txt | ||
@@ -7,7 +7,7 @@ include_directories(${PATH_SHARED_PLATFORM}) | ||
include_directories(${PATH_P7_API}) | ||
|
||
if(WIN32) | ||
- set(P7_PLATFORM_LIBS Ws2_32) | ||
+ set(P7_PLATFORM_LIBS ws2_32) | ||
elseif(UNIX) | ||
set(P7_PLATFORM_LIBS rt pthread) | ||
else() | ||
@@ -16,29 +16,38 @@ endif() | ||
|
||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} P7_SOURCES) | ||
|
||
+if(NOT P7_BUILD_SHARED) | ||
add_library(${PROJECT_NAME} STATIC ${P7_SOURCES}) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC ${P7_PLATFORM_LIBS}) | ||
+endif() | ||
|
||
if(P7_BUILD_SHARED) | ||
add_library(${PROJECT_NAME}-shared SHARED ${P7_SOURCES}) | ||
target_link_libraries(${PROJECT_NAME}-shared ${P7_PLATFORM_LIBS}) | ||
endif() | ||
|
||
+if(NOT P7_BUILD_SHARED) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON) | ||
+endif() | ||
|
||
if(P7_BUILD_SHARED) | ||
set_property(TARGET ${PROJECT_NAME}-shared PROPERTY POSITION_INDEPENDENT_CODE ON) | ||
endif() | ||
|
||
|
||
+if(NOT P7_BUILD_SHARED) | ||
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../Headers/") | ||
+endif() | ||
if(P7_BUILD_SHARED) | ||
target_include_directories(${PROJECT_NAME}-shared PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../Headers/") | ||
endif() | ||
|
||
+if(NOT P7_BUILD_SHARED) | ||
target_include_directories(${PROJECT_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/../Headers/") | ||
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../Shared/") | ||
+endif() | ||
|
||
+if(NOT P7_BUILD_SHARED) | ||
if(WIN32) | ||
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../Shared/Platforms/Windows_x86/") | ||
elseif(UNIX) | ||
@@ -51,14 +60,15 @@ install(TARGETS ${PROJECT_NAME} | ||
RUNTIME DESTINATION bin | ||
) | ||
|
||
-if(P7_BUILD_SHARED) | ||
+else() | ||
install(TARGETS ${PROJECT_NAME}-shared | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib | ||
RUNTIME DESTINATION bin) | ||
endif() | ||
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../Headers/ DESTINATION include FILES_MATCHING PATTERN "*.h") | ||
|
||
-if(COMMAND set_ide_folder) | ||
+if(0) | ||
set_ide_folder(${PROJECT_NAME}) | ||
if(P7_BUILD_SHARED) | ||
set_ide_folder(${PROJECT_NAME}-shared) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package CXX) | ||
project(test_package LANGUAGES CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
find_package(p7 REQUIRED CONFIG) | ||
find_package(baical-p7 REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
|
||
if(P7_SHARED) | ||
target_link_libraries(${PROJECT_NAME} p7::p7-shared) | ||
else() | ||
target_link_libraries(${PROJECT_NAME} p7::p7) | ||
endif() | ||
target_link_libraries(${PROJECT_NAME} PRIVATE baical-p7::baical-p7) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import CMake, cmake_layout | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.definitions["P7_SHARED"] = self.options["baical-p7"].shared | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package | ||
${CMAKE_CURRENT_BINARY_DIR}/test_package) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |