From e7372f22280c3327ecab5d659b22f2e4ccd07a4e Mon Sep 17 00:00:00 2001
From: Matus Novak <mn00272@surrey.ac.uk>
Date: Mon, 11 Mar 2019 16:46:24 +0000
Subject: [PATCH] Fixing AppVeyor publishing of artifacts

---
 .gitignore                         |  1 +
 appveyor.yml                       | 11 ++++++++++-
 publish.bat                        |  2 ++
 src/rew/decoder-cli/CMakeLists.txt |  1 +
 src/rew/decoder/CMakeLists.txt     |  2 +-
 src/rew/encoder-cli/CMakeLists.txt |  1 +
 src/rew/encoder/CMakeLists.txt     |  2 +-
 7 files changed, 17 insertions(+), 3 deletions(-)
 create mode 100644 publish.bat

diff --git a/.gitignore b/.gitignore
index 6acf428..4102961 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@
 # Build folders
 build/
 cmake-build-*/
+install*/
 
 # Clion + Intellij
 .idea/
diff --git a/appveyor.yml b/appveyor.yml
index 6c25d71..236185a 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -25,6 +25,8 @@ environment:
     MINGW_DIR_BIN: C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin
     CMAKE_C_COMPILER: C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/gcc.exe
     CMAKE_CXX_COMPILER: C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/g++.exe
+    BINTRAY_API_KEY:
+      secure: rIlpnd+V2lGd4D3H8UniaVHhzX0qmJQx4AhaKgd6pD9iFURsxu8IiM8dAWElSalo
   - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
     COMPILER: mingw
     TOOLSET: w64-mingw32
@@ -33,18 +35,24 @@ environment:
     MINGW_DIR_BIN: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin
     CMAKE_C_COMPILER: C:/mingw-w64/x86_64-6.3.0-posix-seh-rt_v5-rev1/mingw64/bin/gcc.exe
     CMAKE_CXX_COMPILER: C:/mingw-w64/x86_64-6.3.0-posix-seh-rt_v5-rev1/mingw64/bin/g++.exe
+    BINTRAY_API_KEY:
+      secure: rIlpnd+V2lGd4D3H8UniaVHhzX0qmJQx4AhaKgd6pD9iFURsxu8IiM8dAWElSalo
   - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
     COMPILER: msvc
     MINGW_DIR_BIN: ''
     TOOLSET: vc15
     ARCH: win32
     GENERATOR: '"Visual Studio 15 2017"'
+    BINTRAY_API_KEY:
+      secure: rIlpnd+V2lGd4D3H8UniaVHhzX0qmJQx4AhaKgd6pD9iFURsxu8IiM8dAWElSalo
   - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
     COMPILER: msvc
     MINGW_DIR_BIN: ''
     TOOLSET: vc15
     ARCH: win64
     GENERATOR: '"Visual Studio 15 2017 Win64"'
+    BINTRAY_API_KEY:
+      secure: rIlpnd+V2lGd4D3H8UniaVHhzX0qmJQx4AhaKgd6pD9iFURsxu8IiM8dAWElSalo
 
 #---------------------------------#
 #            steps                #
@@ -66,7 +74,8 @@ build_script:
 - cmd: if [%COMPILER%]==[msvc] (cd build & cmake --build . --target INSTALL --config Debug || exit 1 & cd ..)
 - cmd: if [%COMPILER%]==[msvc] (cd build & cmake --build . --target INSTALL --config MinSizeRel || exit 1 & cd ..)
 - ps: $env:GITHUB_REPO_TAG = git describe
-- ps: 7z.exe a rew-windows-$env:GITHUB_REPO_TAG.zip .\install\*
+- ps: 7z.exe a rew-windows-$env:ARCH-$env:TOOLSET.zip .\install\*
+- ps: publish.bat rew-windows-$env:ARCH-$env:TOOLSET.zip $env:GITHUB_REPO_TAG
 
 test_script:
 - cmd: if [%COMPILER%]==[mingw] (cd build-debug & ctest --verbose --output-on-failure || exit 1 & cd ..)
diff --git a/publish.bat b/publish.bat
new file mode 100644
index 0000000..08125a4
--- /dev/null
+++ b/publish.bat
@@ -0,0 +1,2 @@
+echo off
+curl -T %1 -umatusnov:%BINTRAY_API_KEY% https://api.bintray.com/content/matusnov/radio-enabled-web/release/%2/
diff --git a/src/rew/decoder-cli/CMakeLists.txt b/src/rew/decoder-cli/CMakeLists.txt
index 1e315ab..cb47226 100644
--- a/src/rew/decoder-cli/CMakeLists.txt
+++ b/src/rew/decoder-cli/CMakeLists.txt
@@ -14,6 +14,7 @@ file(GLOB HEADERS ${CMAKE_SOURCE_DIR}/src/rew/decoder-cli/*.h)
 # Create the executable
 add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
 set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "rew/cli") 
+set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
 
 # Dependencies
 target_include_directories(${PROJECT_NAME} PRIVATE ${ARGAGG_INCLUDE_DIR})
diff --git a/src/rew/decoder/CMakeLists.txt b/src/rew/decoder/CMakeLists.txt
index 199b39c..153bcad 100644
--- a/src/rew/decoder/CMakeLists.txt
+++ b/src/rew/decoder/CMakeLists.txt
@@ -32,7 +32,7 @@ set(DECODER_PROJECT ${PROJECT_NAME} PARENT_SCOPE)
 
 # Add install step
 if(BUILD_INSTALL)
-  install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/rew/decoder DESTINATION include/rew/decoder)
+  install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/rew DESTINATION include/rew)
 
   if(MSVC)
     install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION bin OPTIONAL)
diff --git a/src/rew/encoder-cli/CMakeLists.txt b/src/rew/encoder-cli/CMakeLists.txt
index 900f1fd..2c2b819 100644
--- a/src/rew/encoder-cli/CMakeLists.txt
+++ b/src/rew/encoder-cli/CMakeLists.txt
@@ -14,6 +14,7 @@ file(GLOB HEADERS ${CMAKE_SOURCE_DIR}/src/rew/encoder-cli/*.h)
 # Create the executable
 add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
 set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "rew/cli") 
+set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
 
 # Dependencies
 target_include_directories(${PROJECT_NAME} PRIVATE ${ARGAGG_INCLUDE_DIR} ${DIRENT_INCLUDE_DIR})
diff --git a/src/rew/encoder/CMakeLists.txt b/src/rew/encoder/CMakeLists.txt
index 5fa105c..0d313d4 100644
--- a/src/rew/encoder/CMakeLists.txt
+++ b/src/rew/encoder/CMakeLists.txt
@@ -27,7 +27,7 @@ set(ENCODER_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/encoder PARENT_SCOPE)
 
 # Add install step
 if(BUILD_INSTALL)
-  install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/rew/encoder DESTINATION include/rew/encoder)
+  install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/rew DESTINATION include/rew)
 
   if(MSVC)
     install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION bin OPTIONAL)
-- 
GitLab