diff --git a/.travis.yml b/.travis.yml index e44fbcd3..1de74b7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,34 +14,24 @@ jobs: - os: linux env: USE_ASAN=OFF CONFIG=Release - os: windows - env: CONFIG=Release + env: CONFIG=Release CMAKE_GENERATOR_PLATFORM=x64 CMAKE_GENERATOR="Visual Studio 15 2017" VERBOSE=1 -before_install: - - if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then sudo apt-get update -qq; fi - - if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then sudo apt-get install -y p7zip-full build-essential zlib1g-dev libx11-dev libusb-1.0-0-dev freeglut3-dev liblapacke-dev libopenblas-dev libatlas-base-dev libpcap-dev python3 python3-pip; fi +install: + - ./useful_files/travis/$TRAVIS_OS_NAME.install.sh script: - - if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then virtualenv --python=python3 venv; fi - - if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then source ./venv/bin/activate; fi - - if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then python3 setup.py install; fi - - if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then cd bindings/python; fi - - if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then python3 ./example.py --simulator --simulator-time .1 --playback-factor 0; fi - - if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then cd ../..; fi - - mkdir -p bin - - cd bin - - cmake -DENABLE_TESTS=ON -DUSE_ASAN=${USE_ASAN} -DCMAKE_BUILD_TYPE=${CONFIG} .. - - cmake --build . --config ${CONFIG} - - ctest . -C ${CONFIG} --output-on-failure -j30 + - ./useful_files/travis/$TRAVIS_OS_NAME.sh before_deploy: - - if [[ "$TRAVIS_OS_NAME" == 'linux' ]]; then 7z a ../libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME.7z . -xr@../travis-exclusion.lst; fi - - if [[ "$TRAVIS_OS_NAME" == 'windows' ]]; then 7z a libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME.7z ./Release/*; fi + - ./useful_files/travis/$TRAVIS_OS_NAME.before_deploy.sh deploy: - provider: releases api_key: $GITHUB_TOKEN - file: libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME.7z + file: libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME-$CONFIG.7z + skip_cleanup: true on: branch: master condition: $CONFIG=Release tags: true + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 9499690f..3ca437ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,6 +128,18 @@ IF(TARGET survive-cli) install(PROGRAMS ${SURVIVE_WEBSOCKETD} DESTINATION bin) endif() +find_program(DOTNET dotnet) +if(DOTNET) + execute_process( + COMMAND ${DOTNET} build -c Release + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bindings/cs/) + + file(GLOB_RECURSE CS_BINDINGS + "${CMAKE_CURRENT_SOURCE_DIR}/bindings/cs/libsurvive.net/bin/Release/*.dll") + + install(FILES ${CS_BINDINGS} DESTINATION "lib") +endif() + install(DIRECTORY include/libsurvive DESTINATION include) file(GLOB REDIST_HEADERS diff --git a/bindings/cs/Demo/Demo.csproj b/bindings/cs/Demo/Demo.csproj index bb617fca..ec9d23c6 100644 --- a/bindings/cs/Demo/Demo.csproj +++ b/bindings/cs/Demo/Demo.csproj @@ -6,7 +6,7 @@ Exe - netcoreapp3.1 + netcoreapp2.1 diff --git a/useful_files/travis/linux.before_deploy.sh b/useful_files/travis/linux.before_deploy.sh new file mode 100755 index 00000000..b87b832c --- /dev/null +++ b/useful_files/travis/linux.before_deploy.sh @@ -0,0 +1 @@ +7z a libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME-$CONFIG.7z ./bin/INSTALL_ROOT/ ./dist/pysurvive-*.egg diff --git a/useful_files/travis/linux.install.sh b/useful_files/travis/linux.install.sh new file mode 100755 index 00000000..7bd18d69 --- /dev/null +++ b/useful_files/travis/linux.install.sh @@ -0,0 +1,7 @@ +set -o xtrace + +wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb +sudo dpkg -i packages-microsoft-prod.deb + +sudo apt-get update -qq +sudo apt-get install -y p7zip-full build-essential zlib1g-dev libx11-dev libusb-1.0-0-dev freeglut3-dev liblapacke-dev libopenblas-dev libatlas-base-dev libpcap-dev python3 python3-pip apt-transport-https dotnet-sdk-3.1 diff --git a/useful_files/travis/linux.sh b/useful_files/travis/linux.sh new file mode 100755 index 00000000..7e81ce7e --- /dev/null +++ b/useful_files/travis/linux.sh @@ -0,0 +1,10 @@ +virtualenv --python=python3 venv +source ./venv/bin/activate +python3 setup.py install +cd bindings/python +python3 ./example.py --simulator --simulator-time .1 --playback-factor 0 +cd ../.. +./useful_files/travis/shared.sh + +cd bin +sudo make install diff --git a/useful_files/travis/shared.sh b/useful_files/travis/shared.sh new file mode 100755 index 00000000..5212dcb9 --- /dev/null +++ b/useful_files/travis/shared.sh @@ -0,0 +1,8 @@ +set -o xtrace + +mkdir -p bin +cd bin +cmake -DENABLE_TESTS=ON -DUSE_ASAN=${USE_ASAN} -DCMAKE_BUILD_TYPE=${CONFIG} -DCMAKE_INSTALL_PREFIX=INSTALL_ROOT .. +cmake --build . --config ${CONFIG} +ctest . -C ${CONFIG} --output-on-failure -j30 + diff --git a/useful_files/travis/windows.before_deploy.sh b/useful_files/travis/windows.before_deploy.sh new file mode 100755 index 00000000..aa31597a --- /dev/null +++ b/useful_files/travis/windows.before_deploy.sh @@ -0,0 +1 @@ +7z a libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME-$CONFIG.7z ./bin/INSTALL_ROOT/ ./*/pysurvive-*.egg diff --git a/useful_files/travis/windows.install.sh b/useful_files/travis/windows.install.sh new file mode 100755 index 00000000..0e7b8067 --- /dev/null +++ b/useful_files/travis/windows.install.sh @@ -0,0 +1,14 @@ +set -o xtrace + +#choco upgrade dotnetcore +choco install python + +export PATH="/c/Python38/:$PATH" +python -m ensurepip +python -m pip install wheel setuptools ctypesgen + +#choco install visualstudio2019community +#choco install visualstudio2019-workload-nativedesktop + + + diff --git a/useful_files/travis/windows.sh b/useful_files/travis/windows.sh new file mode 100755 index 00000000..fa6a2e98 --- /dev/null +++ b/useful_files/travis/windows.sh @@ -0,0 +1,14 @@ +set -o xtrace + +#export VS160COMNTOOLS="/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools" +export PATH="/c/Python38/:/c/Python38/scripts:$PATH" + +python setup.py install +cd bindings/python +python ./example.py --simulator --simulator-time .1 --playback-factor 0 +cd ../.. + +./useful_files/travis/shared.sh + +cd bin +cmake --build . --target install --config Release