From 809f0c20775a20855086141773f36d025be061e4 Mon Sep 17 00:00:00 2001 From: milek7 Date: Tue, 19 Jan 2021 19:03:42 +0100 Subject: [PATCH] macos tweaks --- PyInt.cpp | 10 ++++++---- application.cpp | 5 ++++- azure-pipelines.yml | 19 +++++++++++++++---- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/PyInt.cpp b/PyInt.cpp index 9fb148f9..cd8bd2d4 100644 --- a/PyInt.cpp +++ b/PyInt.cpp @@ -163,10 +163,9 @@ auto python_taskqueue::init() -> bool { else Py_SetPythonHome("macpython"); #endif - Py_Initialize(); - PyEval_InitThreads(); + Py_InitializeEx(0); - m_initialized = true; + PyEval_InitThreads(); PyObject *stringiomodule { nullptr }; PyObject *stringioclassname { nullptr }; @@ -213,6 +212,8 @@ auto python_taskqueue::init() -> bool { if( false == worker.joinable() ) { return false; } } + m_initialized = true; + return true; release_and_exit: @@ -246,7 +247,8 @@ void python_taskqueue::exit() { // adds specified task along with provided collection of data to the work queue. returns true on success auto python_taskqueue::insert( task_request const &Task ) -> bool { - if( ( false == Global.python_enabled ) + if( !m_initialized + || ( false == Global.python_enabled ) || ( Task.renderer.empty() ) || ( Task.input == nullptr ) || ( Task.target == 0 ) ) { return false; } diff --git a/application.cpp b/application.cpp index a1fad067..e24dcda1 100644 --- a/application.cpp +++ b/application.cpp @@ -143,7 +143,9 @@ eu07_application::init( int Argc, char *Argv[] ) { if( ( result = init_data() ) != 0 ) { return result; } - m_taskqueue.init(); + if( Global.python_enabled ) { + m_taskqueue.init(); + } if( ( result = init_modes() ) != 0 ) { return result; } @@ -735,6 +737,7 @@ eu07_application::init_glfw() { // activate core profile for opengl 3.3 renderer if( !Global.gfx_usegles ) { glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE ); + glfwWindowHint( GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE ); glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 3 ); glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 3 ); } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 50b02941..82af7ff8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -35,12 +35,22 @@ jobs: sudo xcode-select -s /Applications/Xcode_12.3.app displayName: 'Setup Xcode' - script: | - HOMEBREW_NO_AUTO_UPDATE=1 brew install glew glfw libpng glm luajit libserialport libsndfile asio pkg-config + cd /tmp + git clone https://github.com/microsoft/vcpkg + cd vcpkg + git remote add milek https://github.com/Milek7/vcpkg + git fetch milek + git checkout c0020eb4 + ./bootstrap-vcpkg.sh + ./vcpkg install glfw3:x64-osx libpng:x64-osx libsndfile:x64-osx asio:x64-osx + git cherry-pick 9b7f342 + git cherry-pick f1b4a0e + MACOSX_DEPLOYMENT_TARGET="10.12" ./vcpkg install luajit:x64-osx displayName: 'Install dependencies' - script: | mkdir build cd build - cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_ZMQ=OFF -DWITH_OPENVR=OFF + cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_TOOLCHAIN_FILE=/tmp/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-osx -DWITH_ZMQ=OFF -DWITH_OPENVR=OFF -DWITH_UART=OFF cmake --build . displayName: 'Build' - task: PublishBuildArtifacts@1 @@ -49,10 +59,10 @@ jobs: artifactName: binaries_macos displayName: 'Publish binaries' - - job: macos1015_arm64 + - job: macos11_arm64 pool: vmImage: 'macOS-10.15' - displayName: 'MacOS 10.15 ARM64' + displayName: 'MacOS 11.1 ARM64' steps: - script: | sudo xcode-select -s /Applications/Xcode_12.3.app @@ -67,6 +77,7 @@ jobs: ./bootstrap-vcpkg.sh ./vcpkg install glfw3:arm64-osx libpng:arm64-osx libsndfile:arm64-osx asio:arm64-osx git cherry-pick 9b7f342 + git cherry-pick ea5d2d7 ./vcpkg install luajit:arm64-osx displayName: 'Install dependencies' - script: |