Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submodule rename to Odin repo #6

Merged
merged 7 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ jobs:
uses: actions/cache@v4
with:
path: |
deskflow/vcpkg
deskflow/vcpkg_installed
key: vcpkg-${{ runner.os }}-${{ hashFiles('deskflow/vcpkg.json', 'deskflow/vcpkg-configuration.json') }}
odin/vcpkg
odin/vcpkg_installed
key: vcpkg-${{ runner.os }}-${{ hashFiles('odin/vcpkg.json', 'odin/vcpkg-configuration.json') }}

- name: Cache deps dir
uses: actions/cache@v4
with:
path: deskflow/deps
path: odin/deps
key: ${{ runner.os }}-deps-${{ hashFiles('config.yaml') }}

# This effectively runs `vcvarsall.bat`, etc. It's not actually installing
Expand All @@ -90,7 +90,7 @@ jobs:
run: python ./scripts/setup.py

- name: Get version
uses: ./deskflow/.github/actions/get-version
uses: ./odin/.github/actions/get-version

- name: Configure
run: cmake -B build --preset=windows-release
Expand All @@ -99,11 +99,11 @@ jobs:
run: cmake --build build -j8

- name: Tests
uses: ./deskflow/.github/actions/run-tests
uses: ./odin/.github/actions/run-tests
timeout-minutes: 2
with:
job: ${{ matrix.target.name }}
bin-dir: build/deskflow/bin
bin-dir: build/odin/bin

- name: Package
if: ${{ env.PACKAGE_BUILD == 'true' }}
Expand Down Expand Up @@ -161,14 +161,14 @@ jobs:
- name: Cache deps dir
uses: actions/cache@v4
with:
path: deskflow/deps
path: odin/deps
key: ${{ runner.os }}-deps-${{ hashFiles('config.yaml') }}

- name: Install dependencies
run: ./scripts/setup.py

- name: Get version
uses: ./deskflow/.github/actions/get-version
uses: ./odin/.github/actions/get-version

- name: Configure
run: cmake -B build --preset=macos-release
Expand All @@ -177,11 +177,11 @@ jobs:
run: cmake --build build -j8

- name: Tests
uses: ./deskflow/.github/actions/run-tests
uses: ./odin/.github/actions/run-tests
timeout-minutes: 2
with:
job: ${{ matrix.target.name }}
bin-dir: build/deskflow/bin
bin-dir: build/odin/bin

- name: Package
if: ${{ env.PACKAGE_BUILD == 'true' }}
Expand Down Expand Up @@ -221,7 +221,7 @@ jobs:
- name: Get JSON file
id: get
run: |
json_file="./deskflow/.github/workflows/ci-linux.json"
json_file="./odin/.github/workflows/ci-linux.json"
json=$(cat $json_file)
echo "json=$(echo $json)" >> $GITHUB_OUTPUT

Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:
DEBIAN_FRONTEND: noninteractive

- name: Get version
uses: ./deskflow/.github/actions/get-version
uses: ./odin/.github/actions/get-version

- name: Configure
run: cmake -B build --preset=linux-release ${{ matrix.distro.extra-cmake-args }}
Expand All @@ -263,11 +263,11 @@ jobs:
run: cmake --build build -j8

- name: Tests
uses: ./deskflow/.github/actions/run-tests
uses: ./odin/.github/actions/run-tests
timeout-minutes: 2
with:
job: linux-${{ matrix.distro.name }}
bin-dir: build/deskflow/bin
bin-dir: build/odin/bin

- name: Package
if: ${{ env.PACKAGE_BUILD == 'true' }}
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "synergy-deskflow"]
path = deskflow
url = git@github.com:symless/synergy-deskflow.git
[submodule "synergy-odin"]
path = odin
url = git@github.com:symless/synergy-odin.git
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ cmake_minimum_required(VERSION 3.8)

project(synergy C CXX)

include(cmake/Deskflow.cmake)
include(cmake/Odin.cmake)
include(cmake/Licensing.cmake)
include(cmake/Build.cmake)
include(cmake/Libraries.cmake)

configure_deskflow()
configure_odin()
configure_licensing()
configure_build()
configure_libs()

add_subdirectory(deskflow)
add_subdirectory(odin)
add_subdirectory(src)
5 changes: 3 additions & 2 deletions cmake/Deskflow.cmake → cmake/Odin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

macro(configure_deskflow)
# Synergy Odin is our fork of Deskflow.
macro(configure_odin)

set(DESKFLOW_SOURCE_DIR ${CMAKE_SOURCE_DIR}/deskflow)
set(DESKFLOW_SOURCE_DIR ${CMAKE_SOURCE_DIR}/odin)

configure_meta()
configure_dist()
Expand Down
9 changes: 7 additions & 2 deletions scripts/lib/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sys, os, subprocess, venv
import lib.config as config

VENV_DIR = ".venv"


def add_deskflow_path(script):
def add_odin_path(script):
path = os.path.abspath(os.path.join(os.path.dirname(script), f"../{config.ODIN_DIR}/scripts"))
if not os.path.exists(path):
raise RuntimeError(f"Path does not exist: {path}")

sys.path.insert(
0,
os.path.abspath(os.path.join(os.path.dirname(script), "../deskflow/scripts")),
os.path.abspath(path),
)


Expand Down
19 changes: 19 additions & 0 deletions scripts/lib/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3

# Synergy -- mouse and keyboard sharing utility
# Copyright (C) 2024 Symless Ltd.
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file LICENSE that should have accompanied this file.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

ODIN_DIR = "odin"

12 changes: 6 additions & 6 deletions scripts/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

import os, argparse
import lib.bootstrap as bootstrap
import lib.config as config

APP_NAME = "Synergy"
DESKFLOW_SOURCE_DIR = "deskflow"
DESKFLOW_BUILD_DIR = "build/deskflow"
ODIN_BUILD_DIR = f"build/{config.ODIN_DIR}"
VERSION_FILENAME = f"{config.ODIN_DIR}/VERSION"
DEFAULT_PREFIX = "synergy"
DIST_DIR = "dist"
VERSION_FILENAME = "deskflow/VERSION"
TEST_CMD = "synergy-server --version"
PACKAGE_NAME = "synergy"

Expand All @@ -38,7 +38,7 @@ def main():
args = parser.parse_args()

bootstrap.ensure_in_venv(__file__)
bootstrap.add_deskflow_path(__file__)
bootstrap.add_odin_path(__file__)

import package

Expand All @@ -51,12 +51,12 @@ def main():
package.package(
filename_base,
version,
DESKFLOW_BUILD_DIR,
ODIN_BUILD_DIR,
DIST_DIR,
TEST_CMD,
APP_NAME,
PACKAGE_NAME,
source_dir=DESKFLOW_SOURCE_DIR,
source_dir=config.ODIN_DIR,
leave_test_installed=args.leave_test_installed,
)

Expand Down
12 changes: 4 additions & 8 deletions scripts/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
import sys
import os
import lib.bootstrap as bootstrap

DESKFLOW_DIR = "deskflow"

import lib.config as config

def main():
bootstrap.ensure_in_venv(__file__)
Expand All @@ -41,20 +39,18 @@ def setup_deskflow():
"submodule",
"update",
"--init",
"--recursive",
"--remote",
"--merge",
"--recursive"
]
)

# HACK: This proves why we should not be using Meson, and should only use CMake.
args = sys.argv[1:]
if "--build-dir" not in args:
args += ["--build-dir", "../build/deskflow"]
args += ["--build-dir", f"../build/{config.ODIN_DIR}"]

current_dir = os.getcwd()
try:
os.chdir(DESKFLOW_DIR)
os.chdir(config.ODIN_DIR)
subprocess.run([sys.executable, "scripts/install_deps.py"] + sys.argv[1:])
finally:
os.chdir(current_dir)
Expand Down