cmake support for host applications only (not TAs)
This introduces support for building the host part (what's running in
linux user space) of optee_examples using CMake. TAs are as before built
using TA dev kit.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..b8879b8
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,33 @@
+cmake_minimum_required (VERSION 3.2)
+project (optee_examples C)
+
+# https://cmake.org/Wiki/CMake_Useful_Variables
+set (CMAKE_TOOLCHAIN_FILE CMakeToolchain.txt)
+
+include(GNUInstallDirs)
+
+add_compile_options (-Wall)
+#add_compile_options (
+# -Wall -Wbad-function-cast -Wcast-align
+# -Werror-implicit-function-declaration -Wextra
+# -Wfloat-equal -Wformat-nonliteral -Wformat-security
+# -Wformat=2 -Winit-self -Wmissing-declarations
+# -Wmissing-format-attribute -Wmissing-include-dirs
+# -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs
+# -Wpointer-arith -Wshadow -Wstrict-prototypes
+# -Wswitch-default -Wunsafe-loop-optimizations
+# -Wwrite-strings -Werror -fPIC
+#)
+
+find_program(CCACHE_FOUND ccache)
+if(CCACHE_FOUND)
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
+endif(CCACHE_FOUND)
+
+file(GLOB dirs *)
+foreach(dir ${dirs})
+ if(EXISTS ${dir}/CMakeLists.txt)
+ add_subdirectory(${dir})
+ endif()
+endforeach()
diff --git a/CMakeToolchain.txt b/CMakeToolchain.txt
new file mode 100644
index 0000000..3c10f45
--- /dev/null
+++ b/CMakeToolchain.txt
@@ -0,0 +1 @@
+set (CMAKE_SYSTEM_NAME Linux)
diff --git a/aes/CMakeLists.txt b/aes/CMakeLists.txt
new file mode 100644
index 0000000..3972ff5
--- /dev/null
+++ b/aes/CMakeLists.txt
@@ -0,0 +1,13 @@
+project (aes C)
+
+set (SRC host/main.c)
+
+add_executable (${PROJECT_NAME} ${SRC})
+
+target_include_directories(${PROJECT_NAME}
+ PRIVATE ta/include
+ PRIVATE include)
+
+target_link_libraries (${PROJECT_NAME} PRIVATE teec)
+
+install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/hello_world/CMakeLists.txt b/hello_world/CMakeLists.txt
new file mode 100644
index 0000000..1b46b4c
--- /dev/null
+++ b/hello_world/CMakeLists.txt
@@ -0,0 +1,13 @@
+project (hello_world C)
+
+set (SRC host/main.c)
+
+add_executable (${PROJECT_NAME} ${SRC})
+
+target_include_directories(${PROJECT_NAME}
+ PRIVATE ta/include
+ PRIVATE include)
+
+target_link_libraries (${PROJECT_NAME} PRIVATE teec)
+
+install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/hotp/CMakeLists.txt b/hotp/CMakeLists.txt
new file mode 100644
index 0000000..8d61852
--- /dev/null
+++ b/hotp/CMakeLists.txt
@@ -0,0 +1,13 @@
+project (hotp C)
+
+set (SRC host/main.c)
+
+add_executable (${PROJECT_NAME} ${SRC})
+
+target_include_directories(${PROJECT_NAME}
+ PRIVATE ta/include
+ PRIVATE include)
+
+target_link_libraries (${PROJECT_NAME} PRIVATE teec)
+
+install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/random/CMakeLists.txt b/random/CMakeLists.txt
new file mode 100644
index 0000000..c0f1a8a
--- /dev/null
+++ b/random/CMakeLists.txt
@@ -0,0 +1,13 @@
+project (random C)
+
+set (SRC host/main.c)
+
+add_executable (${PROJECT_NAME} ${SRC})
+
+target_include_directories(${PROJECT_NAME}
+ PRIVATE ta/include
+ PRIVATE include)
+
+target_link_libraries (${PROJECT_NAME} PRIVATE teec)
+
+install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})