-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add libnoise/1.0.0 * fix include install layout
- Loading branch information
Showing
7 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
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,33 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
project(noise) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
set(NOISE_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/noise/src) | ||
|
||
file(GLOB NOISE_SRC_FILES | ||
${NOISE_SRC_DIR}/*.cpp | ||
${NOISE_SRC_DIR}/model/*.cpp | ||
${NOISE_SRC_DIR}/module/*.cpp | ||
) | ||
|
||
add_library(${PROJECT_NAME} ${NOISE_SRC_FILES}) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
|
||
find_library(M_LIB m) | ||
if(M_LIB) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC ${M_LIB}) | ||
endif() | ||
|
||
include(GNUInstallDirs) | ||
install(TARGETS ${PROJECT_NAME} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
) | ||
|
||
foreach(SRC_SUBDIR "." "model" "module") | ||
file(GLOB NOISE_HDR_FILES ${NOISE_SRC_DIR}/${SRC_SUBDIR}/*.h) | ||
install(FILES ${NOISE_HDR_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/noise/${SRC_SUBDIR}) | ||
endforeach() |
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,4 @@ | ||
sources: | ||
"1.0.0": | ||
url: "https://sourceforge.net/projects/libnoise/files/libnoise%20sources/1.0.0/libnoisesrc-1.0.0.zip" | ||
sha256: "34ed402f43f30ce5e39812642c9533c11082cd2bc092341c65160f5c743be95b" |
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,68 @@ | ||
from conans import ConanFile, CMake, tools | ||
|
||
required_conan_version = ">=1.33.0" | ||
|
||
|
||
class LibnoiseConan(ConanFile): | ||
name = "libnoise" | ||
description = ( | ||
"A general-purpose library that generates three-dimensional coherent " | ||
"noise. Useful for terrain generation and procedural texture " | ||
"generation. Uses a broad number of techniques (Perlin noise, ridged " | ||
"multifractal, etc.) and combinations of those techniques." | ||
) | ||
license = "LGPL-2.1-or-later" | ||
topics = ("libnoise", "graphics", "noise-generator") | ||
homepage = "http://libnoise.sourceforge.net" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
|
||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
} | ||
|
||
exports_sources = "CMakeLists.txt" | ||
generators = "cmake" | ||
_cmake = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
del self.options.fPIC | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], | ||
destination=self._source_subfolder) | ||
|
||
def _configure_cmake(self): | ||
if self._cmake: | ||
return self._cmake | ||
self._cmake = CMake(self) | ||
self._cmake.configure() | ||
return self._cmake | ||
|
||
def build(self): | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy("COPYING.txt", dst="licenses", src=self._source_subfolder) | ||
cmake = self._configure_cmake() | ||
cmake.install() | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["noise"] | ||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs.append("m") |
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() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) |
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" | ||
|
||
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) |
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 @@ | ||
#include <noise/noisegen.h> | ||
|
||
#include <iostream> | ||
|
||
int main() { | ||
std::cout << noise::IntValueNoise3D(4, 2, 5) << std::endl; | ||
return 0; | ||
} |
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,3 @@ | ||
versions: | ||
"1.0.0": | ||
folder: all |