diff --git a/.github/workflows/cmake-and-release.yml b/.github/workflows/cmake-and-release.yml index cd15ed18..f722a3dd 100644 --- a/.github/workflows/cmake-and-release.yml +++ b/.github/workflows/cmake-and-release.yml @@ -141,14 +141,16 @@ jobs: run: ./gradlew :gpupixel:assemble - name: Create zip - working-directory: ${{github.workspace}}/src/android/java/gpupixel/build/outputs/aar - run: zip -r gpupixel_android_arm64_v8a_aar.zip . + working-directory: ${{github.workspace}}/output + run: | + cp -r ${{github.workspace}}/src/android/java/gpupixel/build/outputs/aar ${{github.workspace}}/output/library/android + zip -r gpupixel_android_arm64_v8a_aar.zip . - name: Upload Android Artifact uses: actions/upload-artifact@v4 with: name: gpupixel_android_arm64_v8a_aar - path: ${{github.workspace}}/src/android/java/gpupixel/build/outputs/aar/gpupixel_android_arm64_v8a_aar.zip + path: ${{github.workspace}}/output/gpupixel_android_arm64_v8a_aar.zip # Deployment job deploy: diff --git a/CHANGELOG.md b/CHANGELOG.md index 103c7827..72ff3551 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -GPUPixel Version: v1.2.3 +GPUPixel Version: v1.2.4 ## What's New -1. Add ci script for building libs and demo. \ No newline at end of file +1. opt cmake and update demo \ No newline at end of file diff --git a/examples/app.cmake b/examples/app.cmake index b7f69e6d..378b4b81 100644 --- a/examples/app.cmake +++ b/examples/app.cmake @@ -21,25 +21,17 @@ SET(CMAKE_INCLUDE_OUTPUT_DIRECTORY "${OUTPUT_INSTALL_PATH}/include") SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OUTPUT_INSTALL_PATH}/library/${CURRENT_OS}") SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_INSTALL_PATH}/library/${CURRENT_OS}") SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_INSTALL_PATH}/app/${CURRENT_OS}") -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/debug) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/debug) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/debug) -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/release) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/release) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/release) +SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - SET(CMAKE_BUILD_TYPE Debug) - LINK_DIRECTORIES(${CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG}) - SET(APP_RESOURCE_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}) - set(COPY_DST_RUNTIME_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}) -else() - SET(CMAKE_BUILD_TYPE Release) - LINK_DIRECTORIES(${CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE}) - SET(APP_RESOURCE_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}) - set(COPY_DST_RUNTIME_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}) -endif() +LINK_DIRECTORIES(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +SET(APP_RESOURCE_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +SET(COPY_DST_RUNTIME_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) # Config source and header file @@ -80,13 +72,7 @@ IF(${CURRENT_OS} STREQUAL "linux") gpupixel GL glfw) - - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - SET(GPUPIXEL_LIBS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG}/libgpupixel.so) - else() - SET(GPUPIXEL_LIBS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE}/libgpupixel.so) - endif() - + SET(GPUPIXEL_LIBS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libgpupixel.so) FIlE(GLOB VNN_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/../src/third_party/vnn/libs/${CURRENT_OS}/* ) @@ -101,11 +87,7 @@ ELSEIF(${CURRENT_OS} STREQUAL "windows") ${CMAKE_CURRENT_SOURCE_DIR}/../src/third_party/vnn/libs/${CURRENT_OS}/x64/* ) - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - SET(GPUPIXEL_LIBS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG}/libgpupixel.dll) - else() - SET(GPUPIXEL_LIBS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE}/libgpupixel.dll) - endif() + SET(GPUPIXEL_LIBS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libgpupixel.dll) ENDIF() # copy resource file diff --git a/examples/ios/GPUPixelApp.xcodeproj/project.pbxproj b/examples/ios/GPUPixelApp.xcodeproj/project.pbxproj index bacda8f8..6cec69f0 100644 --- a/examples/ios/GPUPixelApp.xcodeproj/project.pbxproj +++ b/examples/ios/GPUPixelApp.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 840CD3D42B88448900EEF7B0 /* gpupixel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 840CD3D32B88448900EEF7B0 /* gpupixel.framework */; }; + 840CD3D52B88448900EEF7B0 /* gpupixel.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 840CD3D32B88448900EEF7B0 /* gpupixel.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 840FD5CF2B82455100781FA6 /* vnn_kit_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 840FD5CC2B82455100781FA6 /* vnn_kit_ios.framework */; }; 840FD5D02B82455100781FA6 /* vnn_kit_ios.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 840FD5CC2B82455100781FA6 /* vnn_kit_ios.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 840FD5D12B82455100781FA6 /* vnn_face_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 840FD5CD2B82455100781FA6 /* vnn_face_ios.framework */; }; @@ -23,8 +25,6 @@ 84307E9F261F2CDC003EAC98 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84307E9D261F2CDC003EAC98 /* LaunchScreen.storyboard */; }; 84307EA2261F2CDC003EAC98 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 84307EA1261F2CDC003EAC98 /* main.m */; }; 843580EE276352260053E16A /* ImageFilterController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 843580EC276352260053E16A /* ImageFilterController.mm */; }; - 8453D7092B67C42A009C0532 /* gpupixel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8453D7082B67C42A009C0532 /* gpupixel.framework */; }; - 8453D70A2B67C42A009C0532 /* gpupixel.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8453D7082B67C42A009C0532 /* gpupixel.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 847244A22A6034BF009D1488 /* VideoCapturer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8472449E2A603368009D1488 /* VideoCapturer.m */; }; 84A0D77A2B7DAB49007A86EF /* sample_face.png in Resources */ = {isa = PBXBuildFile; fileRef = 84A0D7792B7DAB49007A86EF /* sample_face.png */; }; 84C1D161266F5D69006D1AB4 /* VideoFilterController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84C1D15F266F5D69006D1AB4 /* VideoFilterController.mm */; }; @@ -37,8 +37,8 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( + 840CD3D52B88448900EEF7B0 /* gpupixel.framework in Embed Frameworks */, 840FD5D02B82455100781FA6 /* vnn_kit_ios.framework in Embed Frameworks */, - 8453D70A2B67C42A009C0532 /* gpupixel.framework in Embed Frameworks */, 840FD5D42B82455100781FA6 /* vnn_core_ios.framework in Embed Frameworks */, 840FD5D22B82455100781FA6 /* vnn_face_ios.framework in Embed Frameworks */, ); @@ -48,6 +48,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 840CD3D32B88448900EEF7B0 /* gpupixel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = gpupixel.framework; path = ../../output/library/ios/gpupixel.framework; sourceTree = ""; }; 840FD5CC2B82455100781FA6 /* vnn_kit_ios.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vnn_kit_ios.framework; path = ../../src/third_party/vnn/libs/ios/vnn_kit_ios.framework; sourceTree = ""; }; 840FD5CD2B82455100781FA6 /* vnn_face_ios.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vnn_face_ios.framework; path = ../../src/third_party/vnn/libs/ios/vnn_face_ios.framework; sourceTree = ""; }; 840FD5CE2B82455100781FA6 /* vnn_core_ios.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vnn_core_ios.framework; path = ../../src/third_party/vnn/libs/ios/vnn_core_ios.framework; sourceTree = ""; }; @@ -83,8 +84,8 @@ buildActionMask = 2147483647; files = ( 840FD5CF2B82455100781FA6 /* vnn_kit_ios.framework in Frameworks */, - 8453D7092B67C42A009C0532 /* gpupixel.framework in Frameworks */, 840FD5D32B82455100781FA6 /* vnn_core_ios.framework in Frameworks */, + 840CD3D42B88448900EEF7B0 /* gpupixel.framework in Frameworks */, 8417C43C267F5B470074DDEF /* CoreMedia.framework in Frameworks */, 840FD5D12B82455100781FA6 /* vnn_face_ios.framework in Frameworks */, 8417C43A267F5AF10074DDEF /* AVFoundation.framework in Frameworks */, @@ -139,6 +140,7 @@ 84EEBF41261F2DC5000AD4AE /* Frameworks */ = { isa = PBXGroup; children = ( + 840CD3D32B88448900EEF7B0 /* gpupixel.framework */, 840FD5CE2B82455100781FA6 /* vnn_core_ios.framework */, 840FD5CD2B82455100781FA6 /* vnn_face_ios.framework */, 840FD5CC2B82455100781FA6 /* vnn_kit_ios.framework */, @@ -380,7 +382,7 @@ DEVELOPMENT_TEAM = QFCE3TAQXQ; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( - "$(SRCROOT)/../../output/library/ios/$(CONFIGURATION)", + "$(SRCROOT)/../../output/library/ios", "$(SRCROOT)/../../src/third_party/vnn/libs/ios", ); GCC_PREPROCESSOR_DEFINITIONS = ( @@ -420,7 +422,7 @@ DEVELOPMENT_TEAM = QFCE3TAQXQ; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( - "$(SRCROOT)/../..//output/library/ios/$(CONFIGURATION)", + "$(SRCROOT)/../..//output/library/ios", "$(SRCROOT)/../../src/third_party/vnn/libs/ios", ); HEADER_SEARCH_PATHS = ""; diff --git a/examples/mac/GPUPixelMacApp.xcodeproj/project.pbxproj b/examples/mac/GPUPixelMacApp.xcodeproj/project.pbxproj index fd440f19..52b8c692 100644 --- a/examples/mac/GPUPixelMacApp.xcodeproj/project.pbxproj +++ b/examples/mac/GPUPixelMacApp.xcodeproj/project.pbxproj @@ -7,14 +7,14 @@ objects = { /* Begin PBXBuildFile section */ + 840CD3D12B8843CD00EEF7B0 /* gpupixel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 840CD3CF2B88431900EEF7B0 /* gpupixel.framework */; }; + 840CD3D22B8843CD00EEF7B0 /* gpupixel.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 840CD3CF2B88431900EEF7B0 /* gpupixel.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 840FD5BD2B7E523D00781FA6 /* vnn_face_osx.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 840FD5BA2B7E523D00781FA6 /* vnn_face_osx.framework */; }; 840FD5BE2B7E523D00781FA6 /* vnn_face_osx.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 840FD5BA2B7E523D00781FA6 /* vnn_face_osx.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 840FD5BF2B7E523D00781FA6 /* vnn_core_osx.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 840FD5BB2B7E523D00781FA6 /* vnn_core_osx.framework */; }; 840FD5C02B7E523D00781FA6 /* vnn_core_osx.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 840FD5BB2B7E523D00781FA6 /* vnn_core_osx.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 840FD5C12B7E523D00781FA6 /* vnn_kit_osx.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 840FD5BC2B7E523D00781FA6 /* vnn_kit_osx.framework */; }; 840FD5C22B7E523D00781FA6 /* vnn_kit_osx.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 840FD5BC2B7E523D00781FA6 /* vnn_kit_osx.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 8453D7052B67BE5B009C0532 /* gpupixel.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8453D7032B67BE5B009C0532 /* gpupixel.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 8453D7062B67C1C9009C0532 /* gpupixel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8453D7032B67BE5B009C0532 /* gpupixel.framework */; }; 84AE136B26FCBCAA00E215AE /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84AE136A26FCBCAA00E215AE /* AVFoundation.framework */; }; 84AE137526FCBCDA00E215AE /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84AE137426FCBCDA00E215AE /* CoreMedia.framework */; }; 84AE137A26FCBCFA00E215AE /* VideoCameraManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84AE137926FCBCFA00E215AE /* VideoCameraManager.mm */; }; @@ -32,7 +32,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 8453D7052B67BE5B009C0532 /* gpupixel.framework in Embed Frameworks */, + 840CD3D22B8843CD00EEF7B0 /* gpupixel.framework in Embed Frameworks */, 840FD5C02B7E523D00781FA6 /* vnn_core_osx.framework in Embed Frameworks */, 840FD5BE2B7E523D00781FA6 /* vnn_face_osx.framework in Embed Frameworks */, 840FD5C22B7E523D00781FA6 /* vnn_kit_osx.framework in Embed Frameworks */, @@ -44,6 +44,7 @@ /* Begin PBXFileReference section */ 840303632B5C2737001A8B3C /* VideoCameraManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VideoCameraManager.h; sourceTree = ""; }; + 840CD3CF2B88431900EEF7B0 /* gpupixel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = gpupixel.framework; path = ../../output/library/macos/gpupixel.framework; sourceTree = ""; }; 840FD5BA2B7E523D00781FA6 /* vnn_face_osx.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vnn_face_osx.framework; path = ../../src/third_party/vnn/libs/macos/vnn_face_osx.framework; sourceTree = ""; }; 840FD5BB2B7E523D00781FA6 /* vnn_core_osx.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vnn_core_osx.framework; path = ../../src/third_party/vnn/libs/macos/vnn_core_osx.framework; sourceTree = ""; }; 840FD5BC2B7E523D00781FA6 /* vnn_kit_osx.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vnn_kit_osx.framework; path = ../../src/third_party/vnn/libs/macos/vnn_kit_osx.framework; sourceTree = ""; }; @@ -69,9 +70,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8453D7062B67C1C9009C0532 /* gpupixel.framework in Frameworks */, 840FD5C12B7E523D00781FA6 /* vnn_kit_osx.framework in Frameworks */, 84AE137526FCBCDA00E215AE /* CoreMedia.framework in Frameworks */, + 840CD3D12B8843CD00EEF7B0 /* gpupixel.framework in Frameworks */, 84AE136B26FCBCAA00E215AE /* AVFoundation.framework in Frameworks */, 840FD5BD2B7E523D00781FA6 /* vnn_face_osx.framework in Frameworks */, 840FD5BF2B7E523D00781FA6 /* vnn_core_osx.framework in Frameworks */, @@ -84,6 +85,7 @@ 84AE136526FCBC9B00E215AE /* Frameworks */ = { isa = PBXGroup; children = ( + 840CD3CF2B88431900EEF7B0 /* gpupixel.framework */, 840FD5BB2B7E523D00781FA6 /* vnn_core_osx.framework */, 840FD5BA2B7E523D00781FA6 /* vnn_face_osx.framework */, 840FD5BC2B7E523D00781FA6 /* vnn_kit_osx.framework */, @@ -345,7 +347,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/GPUPixelMacApp", - "$(PROJECT_DIR)/../../output/library/macos/$(CONFIGURATION)", + "$(PROJECT_DIR)/../../output/library/macos", "$(PROJECT_DIR)/../../src/third_party/vnn/libs/macos", ); GCC_PREPROCESSOR_DEFINITIONS = ( @@ -381,7 +383,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/GPUPixelMacApp", - "$(PROJECT_DIR)/../../output/library/macos/$(CONFIGURATION)", + "$(PROJECT_DIR)/../../output/library/macos", ); GCC_PREPROCESSOR_DEFINITIONS = ""; INFOPLIST_FILE = GPUPixelMacApp/Info.plist; diff --git a/src/lib.cmake b/src/lib.cmake index 461a65b5..9cc30621 100644 --- a/src/lib.cmake +++ b/src/lib.cmake @@ -25,12 +25,12 @@ SET(CMAKE_INCLUDE_OUTPUT_DIRECTORY "${OUTPUT_INSTALL_PATH}/include") SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OUTPUT_INSTALL_PATH}/library/${CURRENT_OS}") SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_INSTALL_PATH}/library/${CURRENT_OS}") SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_INSTALL_PATH}/library/${CURRENT_OS}") -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/debug) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/debug) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/debug) -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/release) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/release) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/release) +SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) # Config source and header file # --------- @@ -76,11 +76,13 @@ FILE(GLOB RESOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/*" ) if(${CURRENT_OS} STREQUAL "ios" OR ${CURRENT_OS} STREQUAL "android") - list(APPEND SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/models/vnn_face278_data/face_pc[1.0.0].vnnmodel") + list(APPEND RESOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/models/vnn_face278_data/face_mobile[1.0.0].vnnmodel") else() - list(APPEND SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/models/vnn_face278_data/face_mobile[1.0.0].vnnmodel") + list(APPEND RESOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/models/vnn_face278_data/face_pc[1.0.0].vnnmodel") endif() +set(VNN_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/libs/${CURRENT_OS}) + # Add platform source and header and lib link search path IF(${CURRENT_OS} STREQUAL "windows") # windows # Source @@ -89,13 +91,10 @@ IF(${CURRENT_OS} STREQUAL "windows") # windows # link libs find path LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/third_party/glfw/lib-mingw-w64) - FILE(GLOB VNN_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/libs/${CURRENT_OS}/x64/*) ELSEIF(${CURRENT_OS} STREQUAL "linux" OR ${CURRENT_OS} STREQUAL "wasm") # Source FILE(GLOB GLAD_SOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/third_party/glad/src/*.c" ) list(APPEND SOURCE_FILES ${GLAD_SOURCE_FILE}) - - FILE(GLOB VNN_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/libs/${CURRENT_OS}/*) ELSEIF(${CURRENT_OS} STREQUAL "macos" OR ${CURRENT_OS} STREQUAL "ios") # ios and mac # Header FILE(GLOB OBJC_HEADER_FILE "${CMAKE_CURRENT_SOURCE_DIR}/target/objc/*.h") @@ -105,7 +104,7 @@ ELSEIF(${CURRENT_OS} STREQUAL "macos" OR ${CURRENT_OS} STREQUAL "ios") # io FILE(GLOB OBJC_SOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/target/objc/*") list(APPEND SOURCE_FILES ${OBJC_SOURCE_FILE}) - FILE(GLOB VNN_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/vnn/libs/${CURRENT_OS}/*) + ELSEIF(${CURRENT_OS} STREQUAL "android") # android # Header FILE(GLOB OBJC_HEADER_FILE "${CMAKE_CURRENT_SOURCE_DIR}/android/jni/*.h") @@ -252,38 +251,29 @@ ELSEIF(${CURRENT_OS} STREQUAL "android") vnn_face) ENDIF() -# copy header to install dir -# -------- -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - set(COPY_DST_OUTPUT_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG}) -else() - set(COPY_DST_OUTPUT_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE}) -endif() - MACRO(EXPORT_INCLUDE) -# copy header -ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -E copy - ${EXPORT_HEADER} ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} + # copy header + ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPUT_RESOURCE_PATH} COMMAND ${CMAKE_COMMAND} -E copy ${RESOURCE_FILES} ${OUTPUT_RESOURCE_PATH} + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy + ${EXPORT_HEADER} ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} COMMENT "Copying headers and resource to output directory.") # copy gpupixel and vnn lib if(${CURRENT_OS} STREQUAL "ios" OR ${CURRENT_OS} STREQUAL "macos") -ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${VNN_LIBS} ${COPY_DST_OUTPUT_DIR} + ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vnn + COMMAND cp -a ${VNN_LIBS} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vnn ) else() -ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${VNN_LIBS} ${COPY_DST_OUTPUT_DIR} + ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${VNN_LIBS} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vnn ) endif() ENDMACRO() -if(NOT ${CURRENT_OS} STREQUAL "android") - EXPORT_INCLUDE() -endif() \ No newline at end of file + +EXPORT_INCLUDE() \ No newline at end of file