CMake: Improve support to build python bindings

* Refactors `iree_pybind_cc_library()`
* Adds `iree_py_extension()`
* Updates and CMake targets for python bindings

The bindings are still not complete and currently only implements support for Linux.

Depends on #693 and #694. I will drop these commits and rebase if these patches get merged separately into master.

Closes https://github.com/google/iree/pull/695

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/iree/pull/695 from iml130:cmake-python-bindings b28394d9c691e855ea35502c329184bbc49a280b
PiperOrigin-RevId: 293657669
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ce1f94..c495ba8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,6 +72,7 @@
 include(iree_glsl_vulkan)
 include(iree_spirv_kernel_cc_library)
 include(iree_pybind_cc_library)
+include(iree_py_extension)
 include(iree_glob_lit_tests)
 include(iree_lit_test)
 include(iree_alwayslink)
@@ -101,11 +102,8 @@
 # Third-party dependencies
 #-------------------------------------------------------------------------------
 
-if(${IREE_BUILD_COMPILER})
-  # Compiler dependencies require Python.
-  # Find version 3+ first, so CMake doesn't find a lower version like 2.7 first.
-  find_package(PythonInterp 3 REQUIRED)
-  find_package(PythonLibs 3 REQUIRED)
+if(${IREE_BUILD_COMPILER} OR ${IREE_BUILD_PYTHON_BINDINGS})
+  find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
 endif()
 
 list(APPEND CMAKE_MODULE_PATH