waifu2x-converter-cpp: fix cross

This commit is contained in:
maxice8 2019-01-25 21:38:05 -02:00 committed by maxice8
parent c8e680fa56
commit fba3e96c06
2 changed files with 37 additions and 1 deletions

View file

@ -0,0 +1,30 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 12884cc..6139ae2 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -36,7 +36,14 @@ if(UNIX OR MINGW)
set(FILE_SYSTEM_LIB "stdc++fs")
endif()
-add_executable(conv conv.c)
+add_custom_target("conv")
+add_custom_command(
+ OUTPUT "build/conv"
+ COMMAND cc
+ ARGS -o conv conv.c
+ DEPENDS "build/conv"
+ COMMENT "Generator"
+)
if(UNIX)
set(OPENCV_PREFIX "/usr" CACHE FILEPATH "OpenCV path")
find_package(OpenCV)
@@ -269,7 +276,7 @@ else() # We are on linux and build for linux
target_link_libraries(w2xc ${OpenCV_LIBS} ${CMAKE_DL_LIBS} pthread stdc++fs stdc++)
endif()
-set(CONV_EXE "$<TARGET_FILE_DIR:conv>/conv")
+set(CONV_EXE ${CMAKE_BINARY_DIR}/conv)
add_custom_command(
OUTPUT modelHandler_OpenCL.cl.h

View file

@ -12,7 +12,13 @@ license="MIT"
homepage="https://github.com/DeadSix27/waifu2x-converter-cpp"
distfiles="${homepage}/archive/v${version}.tar.gz"
checksum=fc1f6317dce9ca7a4cb8e36be5c9e18d46e7ac41f7a444eaab2df8be5e44fd43
nocross="Builds intermediate executable, which should be ran on host, for the target architecture"
pre_configure() {
# conv is a generator built with add_executable
# build it before so it is built with the correct
# toolchain
cc -o build/conv conv.c
}
post_install() {
vlicense LICENSE