From 339c1eefc371337612543077729a82ccb613e103 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 27 Jul 2020 15:24:51 -0300 Subject: [PATCH 01/18] Add KB-H048 description Signed-off-by: Uilian Ries --- docs/error_knowledge_base.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/error_knowledge_base.md b/docs/error_knowledge_base.md index 593d1ceaad..668a4bc6e0 100644 --- a/docs/error_knowledge_base.md +++ b/docs/error_knowledge_base.md @@ -293,4 +293,8 @@ The CMake definition CMAKE_VERBOSE_MAKEFILE helps for debugging when developing, #### **#KB-H047: "NO ASCII CHARACTERS"** -According to PEP [263](https://www.python.org/dev/peps/pep-0263/), Unicode literals should only appear in Python code if the encoding is declared on one of the first two lines of the source file. Without such a declaration, any Unicode literal will cause a syntax error for Python 2 interpreters. \ No newline at end of file +According to PEP [263](https://www.python.org/dev/peps/pep-0263/), Unicode literals should only appear in Python code if the encoding is declared on one of the first two lines of the source file. Without such a declaration, any Unicode literal will cause a syntax error for Python 2 interpreters. + +#### **#KB-H048: "CMAKE VERSION REQUIRED"** + +The file test_package/CMakeLists.txt should require CMake 3.1 by default: `cmake_minimum_required(VERSION 3.1)`. The CMake wrapper file can require CMake 2.8, because Conan recipe and the test package are totally separated. However, if `CMAKE_CXX_STANDARD` or `CXX_STANDARD` is explicit, CMake 3.1 is mandatory. From b7ccc01abef7d216bb3ac2c73b7033e1816b6547 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 28 Jul 2020 17:42:53 +0200 Subject: [PATCH 02/18] add shaderc/2019.0 --- recipes/shaderc/all/CMakeLists.txt | 7 + recipes/shaderc/all/conandata.yml | 10 + recipes/shaderc/all/conanfile.py | 105 +++++ .../all/patches/2019.0/fix-cmake.patch | 402 ++++++++++++++++++ .../shaderc/all/patches/2019.0/fix-spvc.patch | 24 ++ .../shaderc/all/test_package/CMakeLists.txt | 21 + recipes/shaderc/all/test_package/conanfile.py | 32 ++ .../all/test_package/test_package.vert | 8 + .../all/test_package/test_package_shaderc.c | 8 + .../all/test_package/test_package_shaderc.cpp | 8 + .../all/test_package/test_package_spvc.c | 8 + .../all/test_package/test_package_spvc.cpp | 8 + recipes/shaderc/config.yml | 3 + 13 files changed, 644 insertions(+) create mode 100644 recipes/shaderc/all/CMakeLists.txt create mode 100644 recipes/shaderc/all/conandata.yml create mode 100644 recipes/shaderc/all/conanfile.py create mode 100644 recipes/shaderc/all/patches/2019.0/fix-cmake.patch create mode 100644 recipes/shaderc/all/patches/2019.0/fix-spvc.patch create mode 100644 recipes/shaderc/all/test_package/CMakeLists.txt create mode 100644 recipes/shaderc/all/test_package/conanfile.py create mode 100644 recipes/shaderc/all/test_package/test_package.vert create mode 100644 recipes/shaderc/all/test_package/test_package_shaderc.c create mode 100644 recipes/shaderc/all/test_package/test_package_shaderc.cpp create mode 100644 recipes/shaderc/all/test_package/test_package_spvc.c create mode 100644 recipes/shaderc/all/test_package/test_package_spvc.cpp create mode 100644 recipes/shaderc/config.yml diff --git a/recipes/shaderc/all/CMakeLists.txt b/recipes/shaderc/all/CMakeLists.txt new file mode 100644 index 0000000000..4d393c7a86 --- /dev/null +++ b/recipes/shaderc/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1.2) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory("source_subfolder") diff --git a/recipes/shaderc/all/conandata.yml b/recipes/shaderc/all/conandata.yml new file mode 100644 index 0000000000..e5f374c927 --- /dev/null +++ b/recipes/shaderc/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "2019.0": + url: "https://github.com/google/shaderc/archive/v2019.0.tar.gz" + sha256: "1018cd02be52295272fdbffa056ee24b881be277c83d039ad554d91230f4e11b" +patches: + "2019.0": + - patch_file: "patches/2019.0/fix-cmake.patch" + base_path: "source_subfolder" + - patch_file: "patches/2019.0/fix-spvc.patch" + base_path: "source_subfolder" diff --git a/recipes/shaderc/all/conanfile.py b/recipes/shaderc/all/conanfile.py new file mode 100644 index 0000000000..4243b0e180 --- /dev/null +++ b/recipes/shaderc/all/conanfile.py @@ -0,0 +1,105 @@ +import os + +from conans import ConanFile, CMake, tools + +class ShadercConan(ConanFile): + name = "shaderc" + description = "A collection of tools, libraries and tests for shader compilation." + license = "Apache-2.0" + topics = ("conan", "shaderc", "glsl", "hlsl", "msl", "spirv", "spir-v", "glslc", "spvc") + homepage = "https://github.com/google/shaderc" + url = "https://github.com/conan-io/conan-center-index" + exports_sources = ["CMakeLists.txt", "patches/**"] + generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "spvc": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "spvc": False + } + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_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 + if self.settings.compiler.cppstd: + tools.check_min_cppstd(self, 11) + + def requirements(self): + self.requires("glslang/8.13.3559") + self.requires("spirv-tools/v2020.3") + if self.options.spvc: + self.requires("spirv-cross/20200519") + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + os.rename(self.name + "-" + self.version, self._source_subfolder) + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + cmake = self._configure_cmake() + cmake.build() + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + self._cmake.definitions["SHADERC_ENABLE_SPVC"] = self.options.spvc + self._cmake.definitions["SHADERC_SKIP_INSTALL"] = False + self._cmake.definitions["SHADERC_SKIP_TESTS"] = True + self._cmake.definitions["SHADERC_SPVC_ENABLE_DIRECT_LOGGING"] = False + self._cmake.definitions["SHADERC_SPVC_DISABLE_CONTEXT_LOGGING"] = False + self._cmake.definitions["SHADERC_ENABLE_WERROR_COMPILE"] = False + if self.settings.compiler == "Visual Studio": + self._cmake.definitions["SHADERC_ENABLE_SHARED_CRT"] = str(self.settings.compiler.runtime).startswith("MD") + self._cmake.definitions["ENABLE_CODE_COVERAGE"] = False + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.names["pkg_config"] = "shaderc" if self.options.shared else "shaderc_static" + self.cpp_info.libs = self._get_ordered_libs() + if self.settings.os == "Linux": + self.cpp_info.system_libs.append("pthread") + if not self.options.shared and tools.stdcpp_library(self): + self.cpp_info.system_libs.append(tools.stdcpp_library(self)) + if self.options.shared: + self.cpp_info.defines.append("SHADERC_SHAREDLIB") + + bin_path = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.env_info.PATH.append(bin_path) + + def _get_ordered_libs(self): + libs = ["shaderc"] + if not self.options.shared: + libs.append("shaderc_util") + if self.options.spvc: + libs.append("shaderc_spvc") + return libs diff --git a/recipes/shaderc/all/patches/2019.0/fix-cmake.patch b/recipes/shaderc/all/patches/2019.0/fix-cmake.patch new file mode 100644 index 0000000000..d070cd22c2 --- /dev/null +++ b/recipes/shaderc/all/patches/2019.0/fix-cmake.patch @@ -0,0 +1,402 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -70,7 +70,6 @@ endif(MSVC) + + # Configure subdirectories. + # We depend on these for later projects, so they should come first. +-add_subdirectory(third_party) + + if(SHADERC_ENABLE_SPVC) + add_subdirectory(libshaderc_spvc) +@@ -79,12 +78,11 @@ endif() + add_subdirectory(libshaderc_util) + add_subdirectory(libshaderc) + add_subdirectory(glslc) +-add_subdirectory(examples) + + add_custom_target(build-version + ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py +- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ++ ${shaderc_SOURCE_DIR} + COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).") + + function(define_pkg_config_file NAME LIBS) +--- a/cmake/utils.cmake ++++ b/cmake/utils.cmake +@@ -11,7 +11,6 @@ function(shaderc_default_c_compile_options TARGET) + if (NOT "${MSVC}") + target_compile_options(${TARGET} PRIVATE -Wall -Werror -fvisibility=hidden) + if (NOT "${MINGW}") +- target_compile_options(${TARGET} PRIVATE -fPIC) + endif() + if (ENABLE_CODE_COVERAGE) + # The --coverage option is a synonym for -fprofile-arcs -ftest-coverage +@@ -24,10 +23,6 @@ function(shaderc_default_c_compile_options TARGET) + endif() + if (NOT SHADERC_ENABLE_SHARED_CRT) + if (WIN32) +- # For MinGW cross compile, statically link to the libgcc runtime. +- # But it still depends on MSVCRT.dll. +- set_target_properties(${TARGET} PROPERTIES +- LINK_FLAGS "-static -static-libgcc") + endif(WIN32) + endif(NOT SHADERC_ENABLE_SHARED_CRT) + else() +@@ -40,13 +35,8 @@ endfunction(shaderc_default_c_compile_options) + function(shaderc_default_compile_options TARGET) + shaderc_default_c_compile_options(${TARGET}) + if (NOT "${MSVC}") +- target_compile_options(${TARGET} PRIVATE -std=c++11) + if (NOT SHADERC_ENABLE_SHARED_CRT) + if (WIN32) +- # For MinGW cross compile, statically link to the C++ runtime. +- # But it still depends on MSVCRT.dll. +- set_target_properties(${TARGET} PROPERTIES +- LINK_FLAGS "-static -static-libgcc -static-libstdc++") + endif(WIN32) + endif(NOT SHADERC_ENABLE_SHARED_CRT) + endif() +--- a/glslc/CMakeLists.txt ++++ b/glslc/CMakeLists.txt +@@ -16,31 +16,19 @@ add_library(glslc STATIC + ) + + shaderc_default_compile_options(glslc) +-target_include_directories(glslc PUBLIC ${glslang_SOURCE_DIR}) +-target_link_libraries(glslc PRIVATE glslang OSDependent OGLCompiler +- HLSL glslang SPIRV ${CMAKE_THREAD_LIBS_INIT}) +-target_link_libraries(glslc PRIVATE shaderc_util shaderc) ++target_link_libraries(glslc PRIVATE ${CMAKE_THREAD_LIBS_INIT}) ++target_link_libraries(glslc PUBLIC shaderc_util shaderc) + + add_executable(glslc_exe src/main.cc) + shaderc_default_compile_options(glslc_exe) +-target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include) ++target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..) + set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc) +-target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc) ++target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc CONAN_PKG::spirv-tools) + add_dependencies(glslc_exe build-version) + +-shaderc_add_tests( +- TEST_PREFIX glslc +- LINK_LIBS glslc shaderc_util shaderc +- TEST_NAMES +- file +- resource_parse +- stage) +- + shaderc_add_asciidoc(glslc_doc_README README) + + if(SHADERC_ENABLE_INSTALL) + install(TARGETS glslc_exe + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif(SHADERC_ENABLE_INSTALL) +- +-add_subdirectory(test) +--- a/libshaderc/CMakeLists.txt ++++ b/libshaderc/CMakeLists.txt +@@ -10,18 +10,16 @@ set(SHADERC_SOURCES + src/shaderc_private.h + ) + +-add_library(shaderc STATIC ${SHADERC_SOURCES}) ++add_library(shaderc ${SHADERC_SOURCES}) + shaderc_default_compile_options(shaderc) +-target_include_directories(shaderc PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) +- +-add_library(shaderc_shared SHARED ${SHADERC_SOURCES}) +-shaderc_default_compile_options(shaderc_shared) +-target_include_directories(shaderc_shared PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) +-target_compile_definitions(shaderc_shared +- PRIVATE SHADERC_IMPLEMENTATION +- PUBLIC SHADERC_SHAREDLIB +-) +-set_target_properties(shaderc_shared PROPERTIES SOVERSION 1) ++target_include_directories(shaderc PUBLIC include) ++if(BUILD_SHARED_LIBS) ++ target_compile_definitions(shaderc ++ PRIVATE SHADERC_IMPLEMENTATION ++ PUBLIC SHADERC_SHAREDLIB ++ ) ++ set_target_properties(shaderc PROPERTIES SOVERSION 1) ++endif() + + if(SHADERC_ENABLE_INSTALL) + install( +@@ -34,70 +32,19 @@ if(SHADERC_ENABLE_INSTALL) + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) + +- install(TARGETS shaderc shaderc_shared ++ install(TARGETS shaderc + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif(SHADERC_ENABLE_INSTALL) + +-find_package(Threads) + set(SHADERC_LIBS +- glslang OSDependent OGLCompiler glslang ${CMAKE_THREAD_LIBS_INIT} + shaderc_util +- SPIRV # from glslang +- SPIRV-Tools ++ "CONAN_PKG::glslang" ++ "CONAN_PKG::spirv-tools" + ) + + target_link_libraries(shaderc PRIVATE ${SHADERC_LIBS}) +-target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS}) +- +-shaderc_add_tests( +- TEST_PREFIX shaderc +- LINK_LIBS shaderc +- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} +- ${spirv-tools_SOURCE_DIR}/include +- TEST_NAMES +- shaderc +- shaderc_cpp +- shaderc_private) +- +-shaderc_add_tests( +- TEST_PREFIX shaderc_shared +- LINK_LIBS shaderc_shared SPIRV-Tools +- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} +- ${spirv-tools_SOURCE_DIR}/include +- TEST_NAMES +- shaderc +- shaderc_cpp +- shaderc_private) +- +-shaderc_combine_static_lib(shaderc_combined shaderc) +- +-if(SHADERC_ENABLE_INSTALL) +- # Since shaderc_combined is defined as an imported library, we cannot use the +- # install() directive to install it. Install it like a normal file. +- get_target_property(generated_location shaderc_combined LOCATION) +- string(REGEX MATCH "Visual Studio .*" vs_generator "${CMAKE_GENERATOR}") +- if (NOT "${vs_generator}" STREQUAL "") +- # With Visual Studio generators, the LOCATION property is not properly +- # expanded according to the current build configuration. We need to work +- # around this problem by manually substitution. +- string(REPLACE "$(Configuration)" "\${CMAKE_INSTALL_CONFIG_NAME}" +- install_location "${generated_location}") +- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${install_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) +- else() +- install(FILES ${generated_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) +- endif() +-endif(SHADERC_ENABLE_INSTALL) +- +-shaderc_add_tests( +- TEST_PREFIX shaderc_combined +- LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT} +- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} +- ${spirv-tools_SOURCE_DIR}/include +- TEST_NAMES +- shaderc +- shaderc_cpp) + + if(${SHADERC_ENABLE_TESTS}) + add_executable(shaderc_c_smoke_test ./src/shaderc_c_smoke_test.c) +--- a/libshaderc_spvc/CMakeLists.txt ++++ b/libshaderc_spvc/CMakeLists.txt +@@ -9,26 +9,22 @@ set(SPVC_SOURCES + src/spvc.cc + ) + +-add_library(shaderc_spvc STATIC ${SPVC_SOURCES}) ++add_library(shaderc_spvc ${SPVC_SOURCES}) + shaderc_default_compile_options(shaderc_spvc) +-target_include_directories(shaderc_spvc PUBLIC include PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${spirv-tools_SOURCE_DIR}/include ${SPIRV-Cross_SOURCE_DIR}/..) +- +-add_library(shaderc_spvc_shared SHARED ${SPVC_SOURCES}) +-shaderc_default_compile_options(shaderc_spvc_shared) +-target_include_directories(shaderc_spvc_shared PUBLIC include PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${spirv-tools_SOURCE_DIR}/include ${SPIRV-Cross_SOURCE_DIR}/..) +- +-target_compile_definitions(shaderc_spvc_shared +- PRIVATE SHADERC_IMPLEMENTATION +- PUBLIC SHADERC_SHAREDLIB +-) ++target_include_directories(shaderc_spvc ++ PUBLIC include ${shaderc_SOURCE_DIR}/libshaderc/include PRIVATE ${shaderc_SOURCE_DIR}/libshaderc_util/include) ++if(BUILD_SHARED_LIBS) ++ target_compile_definitions(shaderc_spvc ++ PRIVATE SHADERC_IMPLEMENTATION ++ PUBLIC SHADERC_SHAREDLIB ++ ) ++ set_target_properties(shaderc_spvc PROPERTIES SOVERSION 1) ++endif() + + if (DISABLE_EXCEPTIONS) + target_compile_definitions(shaderc_spvc PRIVATE SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) +- target_compile_definitions(shaderc_spvc_shared PRIVATE SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) + endif (DISABLE_EXCEPTIONS) + +-set_target_properties(shaderc_spvc_shared PROPERTIES SOVERSION 1) +- + if(SHADERC_ENABLE_INSTALL) + install( + FILES +@@ -37,71 +33,18 @@ if(SHADERC_ENABLE_INSTALL) + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) + +- install(TARGETS shaderc_spvc shaderc_spvc_shared ++ install(TARGETS shaderc_spvc + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif(SHADERC_ENABLE_INSTALL) + +-find_package(Threads) + set(SPVC_LIBS +- ${CMAKE_THREAD_LIBS_INIT} +- SPIRV-Tools +- SPIRV-Tools-opt +- spirv-cross-glsl +- spirv-cross-hlsl +- spirv-cross-msl ++ "CONAN_PKG::spirv-cross" ++ "CONAN_PKG::spirv-tools" + ) + + target_link_libraries(shaderc_spvc PRIVATE ${SPVC_LIBS}) +-target_link_libraries(shaderc_spvc_shared PRIVATE ${SPVC_LIBS}) +- +-shaderc_add_tests( +- TEST_PREFIX shaderc +- LINK_LIBS shaderc_spvc +- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc/include ${SPIRV-Cross_SOURCE_DIR}/.. +- TEST_NAMES +- spvc +- spvc_cpp +- spvc_webgpu +- spvc_webgpu_cpp) +- +-shaderc_add_tests( +- TEST_PREFIX shaderc_shared +- LINK_LIBS shaderc_spvc_shared SPIRV-Tools SPIRV-Tools-opt +- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc/include ${SPIRV-Cross_SOURCE_DIR}/.. +- TEST_NAMES +- spvc +- spvc_cpp +- spvc_webgpu +- spvc_webgpu_cpp) +- +-shaderc_combine_static_lib(shaderc_spvc_combined shaderc_spvc) +- +-if(SHADERC_ENABLE_INSTALL) +- # Since shaderc_combined is defined as an imported library, we cannot use the +- # install() directive to install it. Install it like a normal file. +- get_target_property(generated_location shaderc_spvc_combined LOCATION) +- string(REGEX MATCH "Visual Studio .*" vs_generator "${CMAKE_GENERATOR}") +- if (NOT "${vs_generator}" STREQUAL "") +- # With Visual Studio generators, the LOCATION property is not properly +- # expanded according to the current build configuration. We need to work +- # around this problem by manually substitution. +- string(REPLACE "$(Configuration)" "\${CMAKE_INSTALL_CONFIG_NAME}" +- install_location "${generated_location}") +- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${install_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) +- else() +- install(FILES ${generated_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) +- endif() +-endif(SHADERC_ENABLE_INSTALL) +- +-shaderc_add_tests( +- TEST_PREFIX shaderc_spvc_combined +- LINK_LIBS shaderc_spvc_combined ${CMAKE_THREAD_LIBS_INIT} shaderc_util +- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc/include ${spirv-tools_SOURCE_DIR}/include +- TEST_NAMES +- spvc +- spvc_cpp) + + if(${SHADERC_ENABLE_TESTS}) + add_executable(spvc_c_smoke_test ./src/spvc_smoke_test_util.c ./src/spvc_c_smoke_test.c) +--- a/libshaderc_util/CMakeLists.txt ++++ b/libshaderc_util/CMakeLists.txt +@@ -24,25 +24,20 @@ add_library(shaderc_util STATIC + + shaderc_default_compile_options(shaderc_util) + target_include_directories(shaderc_util +- PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) ++ PUBLIC include) + + find_package(Threads) +-target_link_libraries(shaderc_util PRIVATE +- glslang OSDependent OGLCompiler HLSL glslang SPIRV +- SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT}) +- +-shaderc_add_tests( +- TEST_PREFIX shaderc_util +- LINK_LIBS shaderc_util +- TEST_NAMES +- counting_includer +- string_piece +- format +- file_finder +- io +- message +- mutex +- version_profile) ++target_link_libraries(shaderc_util PUBLIC ++ CONAN_PKG::glslang ++ CONAN_PKG::spirv-tools ++ ${CMAKE_THREAD_LIBS_INIT}) ++ ++if(SHADERC_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS) ++ install(TARGETS shaderc_util ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++endif(SHADERC_ENABLE_INSTALL) + + if(${SHADERC_ENABLE_TESTS}) + target_include_directories(shaderc_util_counting_includer_test +@@ -51,15 +46,6 @@ if(${SHADERC_ENABLE_TESTS}) + PRIVATE ${glslang_SOURCE_DIR}) + endif() + +-shaderc_add_tests( +- TEST_PREFIX shaderc_util +- LINK_LIBS shaderc_util +- INCLUDE_DIRS +- ${glslang_SOURCE_DIR} +- ${spirv-tools_SOURCE_DIR}/include +- TEST_NAMES +- compiler) +- + # This target copies content of testdata into the build directory. + add_custom_target(testdata COMMAND + ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/testdata/copy-to-build.cmake +--- a/spvc/CMakeLists.txt ++++ b/spvc/CMakeLists.txt +@@ -1,8 +1,8 @@ + add_executable(spvc_exe src/main.cc) + shaderc_default_compile_options(spvc_exe) +-target_include_directories(spvc_exe PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include ${spirv-tools_SOURCE_DIR}/include) ++target_include_directories(spvc_exe PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include) + set_target_properties(spvc_exe PROPERTIES OUTPUT_NAME spvc) +-target_link_libraries(spvc_exe PRIVATE shaderc_spvc shaderc_util) ++target_link_libraries(spvc_exe PRIVATE shaderc_spvc shaderc_util CONAN_PKG::spirv-tools) + add_dependencies(spvc_exe build-version) + + shaderc_add_asciidoc(spvc_doc_README README) +--- a/utils/update_build_version.py ++++ b/utils/update_build_version.py +@@ -114,12 +114,12 @@ def get_version_string(project, directory): + + + def main(): +- if len(sys.argv) != 4: +- print('usage: {} '.format( ++ if len(sys.argv) != 2: ++ print('usage: {} '.format( + sys.argv[0])) + sys.exit(1) + +- projects = ['shaderc', 'spirv-tools', 'glslang'] ++ projects = ['shaderc'] + new_content = ''.join([ + '"{}\\n"\n'.format(get_version_string(p, d)) + for (p, d) in zip(projects, sys.argv[1:]) diff --git a/recipes/shaderc/all/patches/2019.0/fix-spvc.patch b/recipes/shaderc/all/patches/2019.0/fix-spvc.patch new file mode 100644 index 0000000000..682a95ac5d --- /dev/null +++ b/recipes/shaderc/all/patches/2019.0/fix-spvc.patch @@ -0,0 +1,24 @@ +--- a/libshaderc_spvc/src/spvc.cc ++++ b/libshaderc_spvc/src/spvc.cc +@@ -15,9 +15,9 @@ + #include "shaderc/spvc.h" + + #include "libshaderc_util/exceptions.h" +-#include "spirv-cross/spirv_glsl.hpp" +-#include "spirv-cross/spirv_hlsl.hpp" +-#include "spirv-cross/spirv_msl.hpp" ++#include "spirv_glsl.hpp" ++#include "spirv_hlsl.hpp" ++#include "spirv_msl.hpp" + #include "spirv-tools/libspirv.hpp" + #include "spirv-tools/optimizer.hpp" + +@@ -169,7 +169,7 @@ size_t shaderc_spvc_compile_options_set_for_fuzzing( + shaderc_spvc_compile_options_t options, const uint8_t* data, size_t size) { + if (!data || size < sizeof(*options)) return 0; + +- memcpy(options, data, sizeof(*options)); ++ memcpy(static_cast(options), data, sizeof(*options)); + return sizeof(*options); + } + diff --git a/recipes/shaderc/all/test_package/CMakeLists.txt b/recipes/shaderc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000..492695489b --- /dev/null +++ b/recipes/shaderc/all/test_package/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME}_shaderc_c test_package_shaderc.c) +target_link_libraries(${PROJECT_NAME}_shaderc_c ${CONAN_LIBS}) + +add_executable(${PROJECT_NAME}_shaderc_cpp test_package_shaderc.cpp) +target_link_libraries(${PROJECT_NAME}_shaderc_cpp ${CONAN_LIBS}) +set_property(TARGET ${PROJECT_NAME}_shaderc_cpp PROPERTY CXX_STANDARD 11) + +if(SHADERC_WITH_SPVC) + add_executable(${PROJECT_NAME}_spvc_c test_package_spvc.c) + target_link_libraries(${PROJECT_NAME}_spvc_c ${CONAN_LIBS}) + + add_executable(${PROJECT_NAME}_spvc_cpp test_package_spvc.cpp) + target_link_libraries(${PROJECT_NAME}_spvc_cpp ${CONAN_LIBS}) + set_property(TARGET ${PROJECT_NAME}_spvc_cpp PROPERTY CXX_STANDARD 11) +endif() diff --git a/recipes/shaderc/all/test_package/conanfile.py b/recipes/shaderc/all/test_package/conanfile.py new file mode 100644 index 0000000000..25605eb0a0 --- /dev/null +++ b/recipes/shaderc/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +import os + +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.definitions["SHADERC_WITH_SPVC"] = self.options["shaderc"].spvc + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + # Test programs consuming shaderc lib + bin_path_shaderc_c = os.path.join("bin", "test_package_shaderc_c") + self.run(bin_path_shaderc_c, run_environment=True) + bin_path_shaderc_cpp = os.path.join("bin", "test_package_shaderc_cpp") + self.run(bin_path_shaderc_cpp, run_environment=True) + # Test glslc executable + in_glsl_name = os.path.join(self.source_folder, "test_package.vert") + spv_name = "test_package.spv" + self.run("glslc \"{0}\" -o {1}".format(in_glsl_name, spv_name), run_environment=True) + + if self.options["shaderc"].spvc: + # Test programs consuming shaderc_spvc lib + bin_path_spvc_c = os.path.join("bin", "test_package_spvc_c") + self.run(bin_path_spvc_c, run_environment=True) + bin_path_spvc_cpp = os.path.join("bin", "test_package_spvc_cpp") + self.run(bin_path_spvc_cpp, run_environment=True) diff --git a/recipes/shaderc/all/test_package/test_package.vert b/recipes/shaderc/all/test_package/test_package.vert new file mode 100644 index 0000000000..8f349eebab --- /dev/null +++ b/recipes/shaderc/all/test_package/test_package.vert @@ -0,0 +1,8 @@ +#version 450 +#extension GL_ARB_separate_shader_objects : enable + +layout(location = 0) in vec2 inPosition; + +void main() { + gl_Position = vec4(inPosition, 0.0, 1.0); +} diff --git a/recipes/shaderc/all/test_package/test_package_shaderc.c b/recipes/shaderc/all/test_package/test_package_shaderc.c new file mode 100644 index 0000000000..6a83dd0f7a --- /dev/null +++ b/recipes/shaderc/all/test_package/test_package_shaderc.c @@ -0,0 +1,8 @@ +#include + +int main() { + shaderc_compiler_t shaderc_compiler = shaderc_compiler_initialize(); + shaderc_compiler_release(shaderc_compiler); + + return 0; +} diff --git a/recipes/shaderc/all/test_package/test_package_shaderc.cpp b/recipes/shaderc/all/test_package/test_package_shaderc.cpp new file mode 100644 index 0000000000..d6defefea4 --- /dev/null +++ b/recipes/shaderc/all/test_package/test_package_shaderc.cpp @@ -0,0 +1,8 @@ +#include + +int main() { + shaderc::Compiler compiler; + shaderc::CompileOptions compile_options; + + return 0; +} diff --git a/recipes/shaderc/all/test_package/test_package_spvc.c b/recipes/shaderc/all/test_package/test_package_spvc.c new file mode 100644 index 0000000000..c9fc709f30 --- /dev/null +++ b/recipes/shaderc/all/test_package/test_package_spvc.c @@ -0,0 +1,8 @@ +#include + +int main() { + shaderc_spvc_compiler_t shaderc_spvc_compiler = shaderc_spvc_compiler_initialize(); + shaderc_spvc_compiler_release(shaderc_spvc_compiler); + + return 0; +} diff --git a/recipes/shaderc/all/test_package/test_package_spvc.cpp b/recipes/shaderc/all/test_package/test_package_spvc.cpp new file mode 100644 index 0000000000..40978d50d1 --- /dev/null +++ b/recipes/shaderc/all/test_package/test_package_spvc.cpp @@ -0,0 +1,8 @@ +#include + +int main() { + shaderc_spvc::Compiler compiler; + shaderc_spvc::CompileOptions compile_options; + + return 0; +} diff --git a/recipes/shaderc/config.yml b/recipes/shaderc/config.yml new file mode 100644 index 0000000000..038d99956a --- /dev/null +++ b/recipes/shaderc/config.yml @@ -0,0 +1,3 @@ +versions: + "2019.0": + folder: all From ccb0e0a6021dd8202a2b6896a3966cec3714ed8c Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 29 Jul 2020 13:25:56 +0200 Subject: [PATCH 03/18] shaderc: fix libs output name if shared --- recipes/shaderc/all/conanfile.py | 4 ++-- recipes/shaderc/all/patches/2019.0/fix-cmake.patch | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/shaderc/all/conanfile.py b/recipes/shaderc/all/conanfile.py index 4243b0e180..befabffa69 100644 --- a/recipes/shaderc/all/conanfile.py +++ b/recipes/shaderc/all/conanfile.py @@ -97,9 +97,9 @@ class ShadercConan(ConanFile): self.env_info.PATH.append(bin_path) def _get_ordered_libs(self): - libs = ["shaderc"] + libs = ["shaderc_shared" if self.options.shared else "shaderc"] if not self.options.shared: libs.append("shaderc_util") if self.options.spvc: - libs.append("shaderc_spvc") + libs.append("shaderc_spvc_shared" if self.options.shared else "shaderc_spvc") return libs diff --git a/recipes/shaderc/all/patches/2019.0/fix-cmake.patch b/recipes/shaderc/all/patches/2019.0/fix-cmake.patch index d070cd22c2..1fee3bf35e 100644 --- a/recipes/shaderc/all/patches/2019.0/fix-cmake.patch +++ b/recipes/shaderc/all/patches/2019.0/fix-cmake.patch @@ -120,7 +120,7 @@ + PRIVATE SHADERC_IMPLEMENTATION + PUBLIC SHADERC_SHAREDLIB + ) -+ set_target_properties(shaderc PROPERTIES SOVERSION 1) ++ set_target_properties(shaderc PROPERTIES OUTPUT_NAME "shaderc_shared" SOVERSION 1) +endif() if(SHADERC_ENABLE_INSTALL) @@ -225,7 +225,7 @@ + PRIVATE SHADERC_IMPLEMENTATION + PUBLIC SHADERC_SHAREDLIB + ) -+ set_target_properties(shaderc_spvc PROPERTIES SOVERSION 1) ++ set_target_properties(shaderc_spvc PROPERTIES OUTPUT_NAME "shaderc_spvc_shared" SOVERSION 1) +endif() if (DISABLE_EXCEPTIONS) From ba478641f0fd6c7cf6df313e93625506656fcfef Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 29 Jul 2020 18:30:24 +0200 Subject: [PATCH 04/18] shaderc: bump spirv-cross version --- recipes/shaderc/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/shaderc/all/conanfile.py b/recipes/shaderc/all/conanfile.py index befabffa69..4f7fdbe981 100644 --- a/recipes/shaderc/all/conanfile.py +++ b/recipes/shaderc/all/conanfile.py @@ -47,7 +47,7 @@ class ShadercConan(ConanFile): self.requires("glslang/8.13.3559") self.requires("spirv-tools/v2020.3") if self.options.spvc: - self.requires("spirv-cross/20200519") + self.requires("spirv-cross/20200629") def source(self): tools.get(**self.conan_data["sources"][self.version]) From bf92b981654b27cf56a698c0ea3227b879c9e362 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 5 Aug 2020 15:38:47 -0300 Subject: [PATCH 05/18] Docs: Add info about header-only option behavior Signed-off-by: Uilian Ries --- docs/supported_platforms_and_configurations.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/supported_platforms_and_configurations.md b/docs/supported_platforms_and_configurations.md index 0e1b01f8ad..8c84dbed07 100644 --- a/docs/supported_platforms_and_configurations.md +++ b/docs/supported_platforms_and_configurations.md @@ -9,7 +9,9 @@ - Architectures: x86_64 - Build types: Release, Debug - Runtimes: MT/MD (Release), MTd/MDd (Debug) -- Shared/Static (option `"shared": [True, False]` in the recipe when available) +- Options: + - Shared, Static (option `"shared": [True, False]` in the recipe when available) + - Header Only (option `"header_only": [True, False]` is only added with the value True) ## Linux @@ -21,7 +23,9 @@ - Clang compiler: `libstdc++`, `libc++` - Architectures: x86_64 - Build types: Release, Debug -- Options: Shared, Static (option `"shared": [True, False]` in the recipe when available) +- Options: + - Shared, Static (option `"shared": [True, False]` in the recipe when available) + - Header Only (option `"header_only": [True, False]` is only added with the value True) ## OSX @@ -29,4 +33,6 @@ - C++ Standard Library (`libcxx`): `libc++` - Architectures: x86_64 - Build types: Release, Debug -- Options: Shared, Static (option ``"shared": [True, False]`` in the recipe when available) +- Options: + - Shared, Static (option ``"shared": [True, False]`` in the recipe when available) + - Header Only (option `"header_only": [True, False]` is only added with the value True) From a271ef05b6022fbe94896d8d76bef39e2717009c Mon Sep 17 00:00:00 2001 From: Gavin Date: Thu, 6 Aug 2020 14:31:52 -0400 Subject: [PATCH 06/18] Added easy_profiler --- recipes/easy_profiler/all/CMakeLists.txt | 7 + recipes/easy_profiler/all/conandata.yml | 4 + recipes/easy_profiler/all/conanfile.py | 73 +++++ .../all/test_package/CMakeLists.txt | 8 + .../all/test_package/conanfile.py | 16 + .../all/test_package/example.cpp | 306 ++++++++++++++++++ recipes/easy_profiler/config.yml | 3 + 7 files changed, 417 insertions(+) create mode 100644 recipes/easy_profiler/all/CMakeLists.txt create mode 100644 recipes/easy_profiler/all/conandata.yml create mode 100644 recipes/easy_profiler/all/conanfile.py create mode 100644 recipes/easy_profiler/all/test_package/CMakeLists.txt create mode 100644 recipes/easy_profiler/all/test_package/conanfile.py create mode 100644 recipes/easy_profiler/all/test_package/example.cpp create mode 100644 recipes/easy_profiler/config.yml diff --git a/recipes/easy_profiler/all/CMakeLists.txt b/recipes/easy_profiler/all/CMakeLists.txt new file mode 100644 index 0000000000..1848ca5a77 --- /dev/null +++ b/recipes/easy_profiler/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.12) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/easy_profiler/all/conandata.yml b/recipes/easy_profiler/all/conandata.yml new file mode 100644 index 0000000000..753771f92e --- /dev/null +++ b/recipes/easy_profiler/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.1.0": + url: "https://github.com/yse/easy_profiler/archive/v2.1.0.tar.gz" + sha256: "fabf95d59ede9da4873aebd52ef8a762fa8578dcdbcc6d7cdd811b5a7c3367ad" diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py new file mode 100644 index 0000000000..89da6d0026 --- /dev/null +++ b/recipes/easy_profiler/all/conanfile.py @@ -0,0 +1,73 @@ +from conans import ConanFile, tools, CMake +import os +import glob + + +class easy_profilerConan(ConanFile): + name = "easy_profiler" + description = "Lightweight profiler library for c++" + license = "BSD" + topics = ("conan", "easy_profiler") + homepage = "https://github.com/yse/easy_profiler/" + url = "https://github.com/conan-io/conan-center-index" + exports_sources = ["CMakeLists.txt", "patches/*"] + generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False] + } + default_options = { + "shared": False, + "fPIC": True + } + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_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]) + url = self.conan_data["sources"][self.version]["url"] + extracted_dir = self.name + "-" + self.version + os.rename(extracted_dir, self._source_subfolder) + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + # Don't build the GUI because it is dependent on Qt + self._cmake.definitions["EASY_PROFILER_NO_GUI"] = True + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def package(self): + self.copy("COPYING", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["easy_profiler"] + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["m", "pthread"] + self.cpp_info.names["cmake_find_package"] = "easy_profiler" + self.cpp_info.names["cmake_find_package_multi"] = "easy_profiler" diff --git a/recipes/easy_profiler/all/test_package/CMakeLists.txt b/recipes/easy_profiler/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000..ed914caca5 --- /dev/null +++ b/recipes/easy_profiler/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 2.8.11) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} example.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/easy_profiler/all/test_package/conanfile.py b/recipes/easy_profiler/all/test_package/conanfile.py new file mode 100644 index 0000000000..ca8796e17c --- /dev/null +++ b/recipes/easy_profiler/all/test_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + src = os.path.join(self.source_folder, "tng_example.tng") + self.run("{} {}".format(os.path.join("bin", "test_package"), src), run_environment=True) diff --git a/recipes/easy_profiler/all/test_package/example.cpp b/recipes/easy_profiler/all/test_package/example.cpp new file mode 100644 index 0000000000..4dc18e8d44 --- /dev/null +++ b/recipes/easy_profiler/all/test_package/example.cpp @@ -0,0 +1,306 @@ +//#define FULL_DISABLE_PROFILER +#include +#include +#include +#include +#include +#include +#include + +#define BUILD_WITH_EASY_PROFILER +#include +#include +#include + +std::condition_variable cv; +std::mutex cv_m; +int g_i = 0; + +int OBJECTS = 500; +int MODELLING_STEPS = 1500; +int RENDER_STEPS = 1500; +int RESOURCE_LOADING_COUNT = 50; + +//#define SAMPLE_NETWORK_TEST + +void localSleep(uint64_t magic=200000) +{ + //PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Blue); + volatile int i = 0; + for (; i < magic; ++i); +} + +void loadingResources(){ + EASY_FUNCTION(profiler::colors::DarkCyan); + localSleep(); +// std::this_thread::sleep_for(std::chrono::milliseconds(50)); +} + +void prepareMath(){ + EASY_FUNCTION(profiler::colors::Green); + uint64_t sum = 0; + int* intarray = new int[OBJECTS]; + for (int i = 0; i < OBJECTS; ++i) + { + intarray[i] = i * i; + sum += i * i; + } + delete[] intarray; + //std::this_thread::sleep_for(std::chrono::milliseconds(3)); + + EASY_VALUE("sum", sum, profiler::colors::Blue); +} + +void calcIntersect(){ + EASY_FUNCTION(profiler::colors::Gold); + //int* intarray = new int[OBJECTS * OBJECTS]; + int* intarray = new int[OBJECTS]; + for (int i = 0; i < OBJECTS; ++i) + { + for (int j = i; j < OBJECTS; ++j) + //intarray[i * OBJECTS + j] = i * j - i / 2 + (OBJECTS - j) * 5; + intarray[j] = i * j - i / 2 + (OBJECTS - j) * 5; + } + delete[] intarray; + //std::this_thread::sleep_for(std::chrono::milliseconds(4)); +} + +double multModel(double i) +{ + EASY_FUNCTION(profiler::colors::PaleGold); + return i * sin(i) * cos(i); +} + +void calcPhys(){ + EASY_FUNCTION(profiler::colors::Amber); + double* intarray = new double[OBJECTS]; + for (int i = 0; i < OBJECTS; ++i) + intarray[i] = multModel(double(i)) + double(i / 3) - double((OBJECTS - i) / 2); + calcIntersect(); + delete[] intarray; +} + +double calcSubbrain(int i) +{ + EASY_FUNCTION(profiler::colors::Navy); + auto val = i * i * i - i / 10 + (OBJECTS - i) * 7 ; + EASY_VALUE("subbrainResult", val, profiler::colors::DarkRed); + return val; +} + +void calcBrain(){ + EASY_FUNCTION(profiler::colors::LightBlue); + double* intarray = new double[OBJECTS]; + for (int i = 0; i < OBJECTS; ++i) + intarray[i] = calcSubbrain(i) + double(i * 180 / 3); + delete[] intarray; + //std::this_thread::sleep_for(std::chrono::milliseconds(3)); +} + +void calculateBehavior(){ + EASY_FUNCTION(profiler::colors::Blue); + calcPhys(); + calcBrain(); +} + +void modellingStep(){ + EASY_FUNCTION(); + prepareMath(); + calculateBehavior(); +} + +void prepareRender(){ + EASY_FUNCTION(profiler::colors::Brick); + localSleep(); + //std::this_thread::sleep_for(std::chrono::milliseconds(8)); + +} + +int multPhys(int i) +{ + EASY_FUNCTION(profiler::colors::Red700, profiler::ON); + return i * i * i * i / 100; +} + +int calcPhysicForObject(int i) +{ + EASY_FUNCTION(profiler::colors::Red); + return multPhys(i) + i / 3 - (OBJECTS - i) * 15; +} + +void calculatePhysics(){ + EASY_FUNCTION(profiler::colors::Red); + unsigned int* intarray = new unsigned int[OBJECTS]; + for (int i = 0; i < OBJECTS; ++i) + intarray[i] = calcPhysicForObject(i); + delete[] intarray; + //std::this_thread::sleep_for(std::chrono::milliseconds(8)); +} + +void quadratic_loop(uint64_t n) +{ + EASY_FUNCTION(profiler::colors::Blue); + EASY_VALUE("N", n); + volatile int i = 0; + for (; i < n; ++i) + localSleep(n); +} + +void frame(uint64_t n){ + EASY_FUNCTION(profiler::colors::Magenta); + prepareRender(); + calculatePhysics(); + quadratic_loop(n); +} + +void loadingResourcesThread(){ + //std::unique_lock lk(cv_m); + //cv.wait(lk, []{return g_i == 1; }); + EASY_THREAD("Resource loading"); +#ifdef SAMPLE_NETWORK_TEST + while (true) { +#else + for(int i = 0; i < RESOURCE_LOADING_COUNT; i++){ +#endif + loadingResources(); + EASY_EVENT("Resources Loading!", profiler::colors::Cyan); + localSleep(1200000); + //std::this_thread::sleep_for(std::chrono::milliseconds(20)); + } +} + +void modellingThread(){ + //std::unique_lock lk(cv_m); + //cv.wait(lk, []{return g_i == 1; }); + EASY_THREAD("Modelling"); + uint64_t step = 0; +#ifdef SAMPLE_NETWORK_TEST + while (true) { +#else + for (int i = 0; i < MODELLING_STEPS; i++){ +#endif + EASY_END_BLOCK; + EASY_NONSCOPED_BLOCK("Frame", true, 15., profiler::ON, -5.f, profiler::colors::Red); + modellingStep(); + + localSleep(1200000); + + ++step; + double vals[] = {(double)step, sin((double)step), cos((double)step)}; + EASY_VALUE("step", vals, profiler::colors::Gold, EASY_VIN(step)); + if (step > 10000000) + step = 0; + + EASY_TEXT("Test String", "Some short text. Hey!", profiler::colors::Red); + //std::this_thread::sleep_for(std::chrono::milliseconds(20)); + } + EASY_END_BLOCK; +} + +void renderThread(){ + //std::unique_lock lk(cv_m); + //cv.wait(lk, []{return g_i == 1; }); + EASY_THREAD("Render"); + uint64_t n = 20; +#ifdef SAMPLE_NETWORK_TEST + while (true) { +#else + for (int i = 0; i < RENDER_STEPS; i++){ +#endif + frame(n); + localSleep(1200000); + n += 20; + if (n >= 700) + n = 20; + //std::this_thread::sleep_for(std::chrono::milliseconds(20)); + } +} + +////////////////////////////////////////////////////////////////////////// + +int main(int argc, char* argv[]) +{ + if (argc > 1 && argv[1]){ + OBJECTS = std::atoi(argv[1]); + } + if (argc > 2 && argv[2]){ + MODELLING_STEPS = std::atoi(argv[2]); + } + if (argc > 3 && argv[3]){ + RENDER_STEPS = std::atoi(argv[3]); + } + if (argc > 4 && argv[4]){ + RESOURCE_LOADING_COUNT = std::atoi(argv[4]); + } + + std::cout << "Objects count: " << OBJECTS << std::endl; + std::cout << "Render steps: " << MODELLING_STEPS << std::endl; + std::cout << "Modelling steps: " << RENDER_STEPS << std::endl; + std::cout << "Resource loading count: " << RESOURCE_LOADING_COUNT << std::endl; + + auto start = std::chrono::system_clock::now(); + +#ifndef SAMPLE_NETWORK_TEST + EASY_PROFILER_ENABLE; +#endif + + EASY_MAIN_THREAD; + profiler::startListen(); + +#ifdef EASY_CONSTEXPR_AVAILABLE + constexpr int grrr[] {2, -3, 4}; + auto pppp = &grrr; + EASY_ARRAY("threads count", grrr, 3, false, true, "blabla", profiler::colors::Blue/*, EASY_VIN("threads count")*/, profiler::OFF); +#endif + + int* intPtr = new int(2); + EASY_VALUE("count", *intPtr); + + std::vector threads; + //for (int i=0; i < 3; i++) + { + threads.emplace_back(loadingResourcesThread); + threads.emplace_back(renderThread); + threads.emplace_back(modellingThread); + } + + cv_m.lock(); + g_i = 1; + cv_m.unlock(); + cv.notify_all(); + +#ifndef SAMPLE_NETWORK_TEST + std::atomic_bool stop; + stop = false; + auto frame_time_printer_thread = std::thread([&stop]() + { + while (!stop.load(std::memory_order_acquire)) + { + std::cout << "Frame time: max " << profiler::main_thread::frameTimeLocalMax() << " us // avg " << profiler::main_thread::frameTimeLocalAvg() << " us\n"; + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + } + }); +#endif + + modellingThread(); + +#ifndef SAMPLE_NETWORK_TEST + stop.store(true, std::memory_order_release); + frame_time_printer_thread.join(); +#endif + + for(auto& t : threads) + t.join(); + + auto end = std::chrono::system_clock::now(); + auto elapsed = + std::chrono::duration_cast(end - start); + + std::cout << "Elapsed time: " << elapsed.count() << " usec" << std::endl; + + auto blocks_count = profiler::dumpBlocksToFile("test.prof"); + + std::cout << "Blocks count: " << blocks_count << std::endl; + + return 0; +} diff --git a/recipes/easy_profiler/config.yml b/recipes/easy_profiler/config.yml new file mode 100644 index 0000000000..dfff490f9a --- /dev/null +++ b/recipes/easy_profiler/config.yml @@ -0,0 +1,3 @@ +versions: + "2.1.0": + folder: all From 9e6b4ae03270378f1b1092d72341e199d675f951 Mon Sep 17 00:00:00 2001 From: Gavin Date: Thu, 6 Aug 2020 15:31:42 -0400 Subject: [PATCH 07/18] Added license files --- recipes/easy_profiler/all/conanfile.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index 89da6d0026..c77833d3a4 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -60,10 +60,14 @@ class easy_profilerConan(ConanFile): return self._cmake def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + self.copy("LICENSE.MIT", dst="licenses", src=self._source_subfolder) + self.copy("LICENSE.APACHE", dst="licenses", src=self._source_subfolder) cmake = self._configure_cmake() cmake.install() tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + os.remove(os.path.join(self.package_folder, "LICENSE.MIT")) + os.remove(os.path.join(self.package_folder, "LICENSE.APACHE")) def package_info(self): self.cpp_info.libs = ["easy_profiler"] From ffba2c3dd8c72d0f42a972412aee379a1db0f1a6 Mon Sep 17 00:00:00 2001 From: Gavin Date: Fri, 7 Aug 2020 08:56:14 -0400 Subject: [PATCH 08/18] Fixed merge request suggestions - Fixed CXX_STANDARD_11 - CMAKE version set to 3.1 - fixed license - fixed test package run cmd - fixed class name - simplified test package size --- recipes/easy_profiler/all/CMakeLists.txt | 2 +- recipes/easy_profiler/all/conanfile.py | 7 +- .../all/test_package/CMakeLists.txt | 3 +- .../all/test_package/conanfile.py | 3 +- .../all/test_package/example.cpp | 275 +----------------- 5 files changed, 17 insertions(+), 273 deletions(-) diff --git a/recipes/easy_profiler/all/CMakeLists.txt b/recipes/easy_profiler/all/CMakeLists.txt index 1848ca5a77..c986d294c7 100644 --- a/recipes/easy_profiler/all/CMakeLists.txt +++ b/recipes/easy_profiler/all/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.1) project(cmake_wrapper) include(conanbuildinfo.cmake) diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index c77833d3a4..88e7df4834 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -1,12 +1,11 @@ from conans import ConanFile, tools, CMake import os -import glob -class easy_profilerConan(ConanFile): +class EasyProfilerConan(ConanFile): name = "easy_profiler" description = "Lightweight profiler library for c++" - license = "BSD" + license = "MIT" topics = ("conan", "easy_profiler") homepage = "https://github.com/yse/easy_profiler/" url = "https://github.com/conan-io/conan-center-index" @@ -73,5 +72,3 @@ class easy_profilerConan(ConanFile): self.cpp_info.libs = ["easy_profiler"] if self.settings.os == "Linux": self.cpp_info.system_libs = ["m", "pthread"] - self.cpp_info.names["cmake_find_package"] = "easy_profiler" - self.cpp_info.names["cmake_find_package_multi"] = "easy_profiler" diff --git a/recipes/easy_profiler/all/test_package/CMakeLists.txt b/recipes/easy_profiler/all/test_package/CMakeLists.txt index ed914caca5..0b46954340 100644 --- a/recipes/easy_profiler/all/test_package/CMakeLists.txt +++ b/recipes/easy_profiler/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) @@ -6,3 +6,4 @@ conan_basic_setup() add_executable(${PROJECT_NAME} example.cpp) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/easy_profiler/all/test_package/conanfile.py b/recipes/easy_profiler/all/test_package/conanfile.py index ca8796e17c..5934fccac4 100644 --- a/recipes/easy_profiler/all/test_package/conanfile.py +++ b/recipes/easy_profiler/all/test_package/conanfile.py @@ -12,5 +12,4 @@ class TestPackageConan(ConanFile): def test(self): if not tools.cross_building(self.settings): - src = os.path.join(self.source_folder, "tng_example.tng") - self.run("{} {}".format(os.path.join("bin", "test_package"), src), run_environment=True) + self.run( os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/easy_profiler/all/test_package/example.cpp b/recipes/easy_profiler/all/test_package/example.cpp index 4dc18e8d44..fc452d1c9f 100644 --- a/recipes/easy_profiler/all/test_package/example.cpp +++ b/recipes/easy_profiler/all/test_package/example.cpp @@ -12,14 +12,7 @@ #include #include -std::condition_variable cv; -std::mutex cv_m; -int g_i = 0; - -int OBJECTS = 500; -int MODELLING_STEPS = 1500; -int RENDER_STEPS = 1500; -int RESOURCE_LOADING_COUNT = 50; +int RENDER_STEPS = 300; //#define SAMPLE_NETWORK_TEST @@ -30,184 +23,12 @@ void localSleep(uint64_t magic=200000) for (; i < magic; ++i); } -void loadingResources(){ - EASY_FUNCTION(profiler::colors::DarkCyan); - localSleep(); -// std::this_thread::sleep_for(std::chrono::milliseconds(50)); -} - -void prepareMath(){ - EASY_FUNCTION(profiler::colors::Green); - uint64_t sum = 0; - int* intarray = new int[OBJECTS]; - for (int i = 0; i < OBJECTS; ++i) - { - intarray[i] = i * i; - sum += i * i; - } - delete[] intarray; - //std::this_thread::sleep_for(std::chrono::milliseconds(3)); - - EASY_VALUE("sum", sum, profiler::colors::Blue); -} - -void calcIntersect(){ - EASY_FUNCTION(profiler::colors::Gold); - //int* intarray = new int[OBJECTS * OBJECTS]; - int* intarray = new int[OBJECTS]; - for (int i = 0; i < OBJECTS; ++i) - { - for (int j = i; j < OBJECTS; ++j) - //intarray[i * OBJECTS + j] = i * j - i / 2 + (OBJECTS - j) * 5; - intarray[j] = i * j - i / 2 + (OBJECTS - j) * 5; - } - delete[] intarray; - //std::this_thread::sleep_for(std::chrono::milliseconds(4)); -} - -double multModel(double i) -{ - EASY_FUNCTION(profiler::colors::PaleGold); - return i * sin(i) * cos(i); -} - -void calcPhys(){ - EASY_FUNCTION(profiler::colors::Amber); - double* intarray = new double[OBJECTS]; - for (int i = 0; i < OBJECTS; ++i) - intarray[i] = multModel(double(i)) + double(i / 3) - double((OBJECTS - i) / 2); - calcIntersect(); - delete[] intarray; -} - -double calcSubbrain(int i) -{ - EASY_FUNCTION(profiler::colors::Navy); - auto val = i * i * i - i / 10 + (OBJECTS - i) * 7 ; - EASY_VALUE("subbrainResult", val, profiler::colors::DarkRed); - return val; -} - -void calcBrain(){ - EASY_FUNCTION(profiler::colors::LightBlue); - double* intarray = new double[OBJECTS]; - for (int i = 0; i < OBJECTS; ++i) - intarray[i] = calcSubbrain(i) + double(i * 180 / 3); - delete[] intarray; - //std::this_thread::sleep_for(std::chrono::milliseconds(3)); -} - -void calculateBehavior(){ - EASY_FUNCTION(profiler::colors::Blue); - calcPhys(); - calcBrain(); -} - -void modellingStep(){ - EASY_FUNCTION(); - prepareMath(); - calculateBehavior(); -} - -void prepareRender(){ - EASY_FUNCTION(profiler::colors::Brick); - localSleep(); - //std::this_thread::sleep_for(std::chrono::milliseconds(8)); - -} - -int multPhys(int i) -{ - EASY_FUNCTION(profiler::colors::Red700, profiler::ON); - return i * i * i * i / 100; -} - -int calcPhysicForObject(int i) -{ - EASY_FUNCTION(profiler::colors::Red); - return multPhys(i) + i / 3 - (OBJECTS - i) * 15; -} - -void calculatePhysics(){ - EASY_FUNCTION(profiler::colors::Red); - unsigned int* intarray = new unsigned int[OBJECTS]; - for (int i = 0; i < OBJECTS; ++i) - intarray[i] = calcPhysicForObject(i); - delete[] intarray; - //std::this_thread::sleep_for(std::chrono::milliseconds(8)); -} - -void quadratic_loop(uint64_t n) -{ - EASY_FUNCTION(profiler::colors::Blue); - EASY_VALUE("N", n); - volatile int i = 0; - for (; i < n; ++i) - localSleep(n); -} - -void frame(uint64_t n){ - EASY_FUNCTION(profiler::colors::Magenta); - prepareRender(); - calculatePhysics(); - quadratic_loop(n); -} - -void loadingResourcesThread(){ - //std::unique_lock lk(cv_m); - //cv.wait(lk, []{return g_i == 1; }); - EASY_THREAD("Resource loading"); -#ifdef SAMPLE_NETWORK_TEST - while (true) { -#else - for(int i = 0; i < RESOURCE_LOADING_COUNT; i++){ -#endif - loadingResources(); - EASY_EVENT("Resources Loading!", profiler::colors::Cyan); - localSleep(1200000); - //std::this_thread::sleep_for(std::chrono::milliseconds(20)); - } -} - -void modellingThread(){ - //std::unique_lock lk(cv_m); - //cv.wait(lk, []{return g_i == 1; }); - EASY_THREAD("Modelling"); - uint64_t step = 0; -#ifdef SAMPLE_NETWORK_TEST - while (true) { -#else - for (int i = 0; i < MODELLING_STEPS; i++){ -#endif - EASY_END_BLOCK; - EASY_NONSCOPED_BLOCK("Frame", true, 15., profiler::ON, -5.f, profiler::colors::Red); - modellingStep(); - - localSleep(1200000); - - ++step; - double vals[] = {(double)step, sin((double)step), cos((double)step)}; - EASY_VALUE("step", vals, profiler::colors::Gold, EASY_VIN(step)); - if (step > 10000000) - step = 0; - - EASY_TEXT("Test String", "Some short text. Hey!", profiler::colors::Red); - //std::this_thread::sleep_for(std::chrono::milliseconds(20)); - } - EASY_END_BLOCK; -} - void renderThread(){ - //std::unique_lock lk(cv_m); - //cv.wait(lk, []{return g_i == 1; }); EASY_THREAD("Render"); uint64_t n = 20; -#ifdef SAMPLE_NETWORK_TEST - while (true) { -#else - for (int i = 0; i < RENDER_STEPS; i++){ -#endif - frame(n); + + for (int i = 0; i < RENDER_STEPS; i++) + { localSleep(1200000); n += 20; if (n >= 700) @@ -220,87 +41,13 @@ void renderThread(){ int main(int argc, char* argv[]) { - if (argc > 1 && argv[1]){ - OBJECTS = std::atoi(argv[1]); - } - if (argc > 2 && argv[2]){ - MODELLING_STEPS = std::atoi(argv[2]); - } - if (argc > 3 && argv[3]){ - RENDER_STEPS = std::atoi(argv[3]); - } - if (argc > 4 && argv[4]){ - RESOURCE_LOADING_COUNT = std::atoi(argv[4]); - } + #ifndef SAMPLE_NETWORK_TEST + EASY_PROFILER_ENABLE; + #endif + EASY_MAIN_THREAD; + profiler::startListen(); - std::cout << "Objects count: " << OBJECTS << std::endl; - std::cout << "Render steps: " << MODELLING_STEPS << std::endl; - std::cout << "Modelling steps: " << RENDER_STEPS << std::endl; - std::cout << "Resource loading count: " << RESOURCE_LOADING_COUNT << std::endl; + renderThread(); - auto start = std::chrono::system_clock::now(); - -#ifndef SAMPLE_NETWORK_TEST - EASY_PROFILER_ENABLE; -#endif - - EASY_MAIN_THREAD; - profiler::startListen(); - -#ifdef EASY_CONSTEXPR_AVAILABLE - constexpr int grrr[] {2, -3, 4}; - auto pppp = &grrr; - EASY_ARRAY("threads count", grrr, 3, false, true, "blabla", profiler::colors::Blue/*, EASY_VIN("threads count")*/, profiler::OFF); -#endif - - int* intPtr = new int(2); - EASY_VALUE("count", *intPtr); - - std::vector threads; - //for (int i=0; i < 3; i++) - { - threads.emplace_back(loadingResourcesThread); - threads.emplace_back(renderThread); - threads.emplace_back(modellingThread); - } - - cv_m.lock(); - g_i = 1; - cv_m.unlock(); - cv.notify_all(); - -#ifndef SAMPLE_NETWORK_TEST - std::atomic_bool stop; - stop = false; - auto frame_time_printer_thread = std::thread([&stop]() - { - while (!stop.load(std::memory_order_acquire)) - { - std::cout << "Frame time: max " << profiler::main_thread::frameTimeLocalMax() << " us // avg " << profiler::main_thread::frameTimeLocalAvg() << " us\n"; - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - } - }); -#endif - - modellingThread(); - -#ifndef SAMPLE_NETWORK_TEST - stop.store(true, std::memory_order_release); - frame_time_printer_thread.join(); -#endif - - for(auto& t : threads) - t.join(); - - auto end = std::chrono::system_clock::now(); - auto elapsed = - std::chrono::duration_cast(end - start); - - std::cout << "Elapsed time: " << elapsed.count() << " usec" << std::endl; - - auto blocks_count = profiler::dumpBlocksToFile("test.prof"); - - std::cout << "Blocks count: " << blocks_count << std::endl; - - return 0; + return 0; } From 770bad2c42e3ef80bb1fcd8ce21e978b134419d1 Mon Sep 17 00:00:00 2001 From: Gavin Date: Fri, 7 Aug 2020 13:04:08 -0400 Subject: [PATCH 09/18] Update recipes/easy_profiler/all/conanfile.py added short_path Co-authored-by: Uilian Ries --- recipes/easy_profiler/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index 88e7df4834..a7a7a3ba83 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -20,6 +20,7 @@ class EasyProfilerConan(ConanFile): "shared": False, "fPIC": True } + short_path = True _cmake = None From 4e4bcaf721fd77db0490ff51354d96700163e7e5 Mon Sep 17 00:00:00 2001 From: Gavin Date: Fri, 7 Aug 2020 14:27:58 -0400 Subject: [PATCH 10/18] Fixed short_path -> short_paths --- recipes/easy_profiler/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index a7a7a3ba83..8d515b3aa5 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -20,7 +20,7 @@ class EasyProfilerConan(ConanFile): "shared": False, "fPIC": True } - short_path = True + short_paths = True _cmake = None From 064ed11137900f2d8eedf64342f269aead425b1f Mon Sep 17 00:00:00 2001 From: Gavin Date: Fri, 7 Aug 2020 15:20:44 -0400 Subject: [PATCH 11/18] Removing windows dll files --- recipes/easy_profiler/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index 8d515b3aa5..76487e9e82 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -68,6 +68,10 @@ class EasyProfilerConan(ConanFile): tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) os.remove(os.path.join(self.package_folder, "LICENSE.MIT")) os.remove(os.path.join(self.package_folder, "LICENSE.APACHE")) + if self.settings.os == "Windows": + for dll_file in glob.glob(os.path.join(self.package_folder, "bin", "*.dll")): + if os.path.basename(dll_file).startswith(("concrt", "msvcp", "vcruntime")): + os.remove(dll_file) def package_info(self): self.cpp_info.libs = ["easy_profiler"] From 3af2c0b221cdf8d84aa59e4b01c1759c25dc9a5b Mon Sep 17 00:00:00 2001 From: Gavin Date: Fri, 7 Aug 2020 15:33:45 -0400 Subject: [PATCH 12/18] import glob --- recipes/easy_profiler/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index 76487e9e82..25dbb76052 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -1,6 +1,6 @@ from conans import ConanFile, tools, CMake import os - +import glob class EasyProfilerConan(ConanFile): name = "easy_profiler" From 230f1a83dca5db1c22d04ed4bd5ae6818e77317e Mon Sep 17 00:00:00 2001 From: Gavin Date: Sat, 8 Aug 2020 09:29:20 -0400 Subject: [PATCH 13/18] Disabled Static builds on windows - Default option is shared library --- recipes/easy_profiler/all/conanfile.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index 25dbb76052..5a6cfeb5eb 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -2,6 +2,7 @@ from conans import ConanFile, tools, CMake import os import glob + class EasyProfilerConan(ConanFile): name = "easy_profiler" description = "Lightweight profiler library for c++" @@ -17,7 +18,7 @@ class EasyProfilerConan(ConanFile): "fPIC": [True, False] } default_options = { - "shared": False, + "shared": True, "fPIC": True } short_paths = True @@ -39,6 +40,11 @@ class EasyProfilerConan(ConanFile): def configure(self): if self.options.shared: del self.options.fPIC + # The windows build seems to be giving problems due to certain symbols + # not being exported properly for static libraries. + if self.options.shared is False and self.settings.os == "Windows": + raise ConanInvalidConfiguration("Must be built as shared on \ + Windows") def source(self): tools.get(**self.conan_data["sources"][self.version]) @@ -69,8 +75,10 @@ class EasyProfilerConan(ConanFile): os.remove(os.path.join(self.package_folder, "LICENSE.MIT")) os.remove(os.path.join(self.package_folder, "LICENSE.APACHE")) if self.settings.os == "Windows": - for dll_file in glob.glob(os.path.join(self.package_folder, "bin", "*.dll")): - if os.path.basename(dll_file).startswith(("concrt", "msvcp", "vcruntime")): + for dll_file in \ + glob.glob(os.path.join(self.package_folder, "bin", "*.dll")): + if os.path.basename(dll_file).startswith(("concrt", "msvcp", + "vcruntime")): os.remove(dll_file) def package_info(self): From 09697508a372fb2ce5a42a330502cda264e498a3 Mon Sep 17 00:00:00 2001 From: Gavin Date: Mon, 10 Aug 2020 07:54:22 -0400 Subject: [PATCH 14/18] Update recipes/easy_profiler/all/conanfile.py Co-authored-by: Javier G. Sogo --- recipes/easy_profiler/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index 5a6cfeb5eb..9289ade27c 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -42,7 +42,7 @@ class EasyProfilerConan(ConanFile): del self.options.fPIC # The windows build seems to be giving problems due to certain symbols # not being exported properly for static libraries. - if self.options.shared is False and self.settings.os == "Windows": + if not self.options.shared and self.settings.os == "Windows": raise ConanInvalidConfiguration("Must be built as shared on \ Windows") From b9ee5f4dbcd4de70150e78c629b911c3c067f0b3 Mon Sep 17 00:00:00 2001 From: Gavin Date: Mon, 10 Aug 2020 08:00:13 -0400 Subject: [PATCH 15/18] import ConanInvalidConfiguration --- recipes/easy_profiler/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index 9289ade27c..c58379d732 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, tools, CMake +from conans.errors import ConanInvalidConfiguration import os import glob From d446efb798077fb01a87ec59b2f7a9594011e5ba Mon Sep 17 00:00:00 2001 From: Gavin Date: Mon, 10 Aug 2020 18:40:42 -0400 Subject: [PATCH 16/18] Apply suggestions from code review Added suggested changes for Static builds on windows Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/easy_profiler/all/conanfile.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index c58379d732..90a431c61a 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -1,5 +1,4 @@ from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration import os import glob @@ -19,7 +18,7 @@ class EasyProfilerConan(ConanFile): "fPIC": [True, False] } default_options = { - "shared": True, + "shared": False, "fPIC": True } short_paths = True @@ -41,11 +40,6 @@ class EasyProfilerConan(ConanFile): def configure(self): if self.options.shared: del self.options.fPIC - # The windows build seems to be giving problems due to certain symbols - # not being exported properly for static libraries. - if not self.options.shared and self.settings.os == "Windows": - raise ConanInvalidConfiguration("Must be built as shared on \ - Windows") def source(self): tools.get(**self.conan_data["sources"][self.version]) @@ -86,3 +80,7 @@ class EasyProfilerConan(ConanFile): self.cpp_info.libs = ["easy_profiler"] if self.settings.os == "Linux": self.cpp_info.system_libs = ["m", "pthread"] + elif self.settings.os == "Windows": + self.cpp_info.system_libs = ["psapi", "ws2_32"] + if not self.options.shared: + self.cpp_info.defines.append("EASY_PROFILER_STATIC") From 2c563f0e3feaea715cfe443b21294b043ed4b7b6 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Tue, 11 Aug 2020 14:09:00 +0200 Subject: [PATCH 17/18] update template --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5bb29ab50e..9f4da5dab8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ Specify library name and version: **lib/1.0** -- [ ] I've read the [guidelines](https://github.com/conan-io/conan-center-index/wiki#how-to-submit-a-pull-request) for contributing. +- [ ] I've read the [guidelines](https://github.com/conan-io/conan-center-index/blob/master/docs/how_to_add_packages.mdt) for contributing. - [ ] I've followed the [PEP8](https://www.python.org/dev/peps/pep-0008/) style guides for Python code in the recipes. - [ ] I've used the [latest](https://github.com/conan-io/conan/releases/latest) Conan client version. - [ ] I've tried at least one configuration locally with the From 2e99ff183c5f96f782b8514383674227f4549afe Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Tue, 11 Aug 2020 14:13:05 +0200 Subject: [PATCH 18/18] Update .github/PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9f4da5dab8..1ac80e0d91 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,8 +1,7 @@ Specify library name and version: **lib/1.0** -- [ ] I've read the [guidelines](https://github.com/conan-io/conan-center-index/blob/master/docs/how_to_add_packages.mdt) for contributing. +- [ ] I've read the [guidelines](https://github.com/conan-io/conan-center-index/blob/master/docs/how_to_add_packages.md) for contributing. - [ ] I've followed the [PEP8](https://www.python.org/dev/peps/pep-0008/) style guides for Python code in the recipes. - [ ] I've used the [latest](https://github.com/conan-io/conan/releases/latest) Conan client version. - [ ] I've tried at least one configuration locally with the [conan-center hook](https://github.com/conan-io/hooks.git) activated. -