Implement better way of dealing with native codebook generator when cross-compiling.
authorhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 30 Jun 2015 19:21:57 +0000 (19:21 +0000)
committerhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 30 Jun 2015 19:21:57 +0000 (19:21 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2231 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/CMakeLists.txt

index 206f9ee2bc8528480c4f17c26e4a29190ea60867..d72b91e9ba7463a0aca44b00751d6e6878647224 100644 (file)
@@ -89,12 +89,17 @@ set(CODEBOOKSMEL
 
 set(CODEBOOKSGE ${D}/gecb.txt)
 
-# when crosscompiling import the executable targets from a file
+# when crosscompiling we need a native executable
 if(CMAKE_CROSSCOMPILING)
-    set(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Point to the export file from a native build")
-    include(${IMPORT_EXECUTABLES})
-    #add_executable(generate_codebook IMPORTED)
-    set_property(TARGET generate_codebook PROPERTY IMPORTED_LOCATION ${GENERATE_CODEBOOK})
+    include(ExternalProject)
+    ExternalProject_Add(codec2_native
+       SOURCE_DIR ${CMAKE_SOURCE_DIR}
+       BUILD_COMMAND $(MAKE) generate_codebook
+       INSTALL_COMMAND ${CMAKE_COMMAND} -E copy src/generate_codebook ${CMAKE_CURRENT_BINARY_DIR}
+    )
+    add_executable(generate_codebook IMPORTED)
+    set_property(TARGET generate_codebook PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/generate_codebook)
+
 else(CMAKE_CROSSCOMPILING)
 # Build code generator binaries. These do not get installed.
     # generate_codebook