From f1c49af200c4a1406d38c33224d5c26ab2c7a058 Mon Sep 17 00:00:00 2001 From: Ben Hall Date: Sat, 23 Dec 2023 18:53:51 -0500 Subject: [PATCH] adding in attempt to create windows release --- .github/workflows/create_releases.yml | 27 +++++++++++++++++++++ generator/install-dbcppp.sh | 9 +++++++ generator/pio_lib_gen.py | 20 ++++++++++++++- third-party/CMakeLists.txt | 35 +++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/create_releases.yml create mode 100755 generator/install-dbcppp.sh create mode 100644 third-party/CMakeLists.txt diff --git a/.github/workflows/create_releases.yml b/.github/workflows/create_releases.yml new file mode 100644 index 0000000..29d5907 --- /dev/null +++ b/.github/workflows/create_releases.yml @@ -0,0 +1,27 @@ +name: CI + +on: + push: + branches: + - main # Adjust branch name as needed + +jobs: + build: + runs-on: windows-latest # Choose the appropriate OS for your project + + steps: + - uses: actions/checkout@v2 # Check out your repository + + - name: Set up CMake + uses: cmake-actions/setup-cmake@v1 + with: + cmake-version: '3.21' # Adjust version as needed + + - name: Build and Package + run: | + cd third-party + mkdir build + cd build + cmake .. + cmake --build . --target package # Generate installer + # Add commands to upload the installer artifact (e.g., using GitHub Actions' upload-artifact) diff --git a/generator/install-dbcppp.sh b/generator/install-dbcppp.sh new file mode 100755 index 0000000..a95e3b5 --- /dev/null +++ b/generator/install-dbcppp.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# git clone --recurse-submodules https://github.com/xR3b0rn/dbcppp.git +cd dbcppp +# mkdir build +cd build + +cmake -DCMAKE_BUILD_TYPE=Release .. +make -j +make RunTests \ No newline at end of file diff --git a/generator/pio_lib_gen.py b/generator/pio_lib_gen.py index 449ab86..0c4976f 100644 --- a/generator/pio_lib_gen.py +++ b/generator/pio_lib_gen.py @@ -22,6 +22,24 @@ generated_src_dir = os.path.join(build_dir, 'dbcppp', 'generated-src') generated_build_dir = os.path.join(build_dir, 'dbcppp', 'generated-build') +def install_dbcppp(): + try: + print(subprocess.Popen(["./install-dbcppp.sh"], stdout=subprocess.PIPE)) + except OSError as error: + print("ERROR occured while trying to install dep") +try: + subprocess.Popen(["cmake"], stdout = subprocess.PIPE) + print("you have cmake installed") +except OSError as error: + print("ERROR install cmake") + +try: + subprocess.Popen([build_dir+"/dbcppp-bin/dbcppp"], stdout = subprocess.PIPE) +except OSError as error: + print("[pio_lib_gen] Installing dependencies"); + install_dbcppp() + + user_dbc_files = env.subst(env.GetProjectOption("user_dbcs", "")) dbc_files = fs.match_src_files(project_dir, user_dbc_files) @@ -30,4 +48,4 @@ print(f"user_dbcs: {user_dbc_files}") exit(1) -print("hello from lib") \ No newline at end of file +print("hello from lib2") diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt new file mode 100644 index 0000000..b8726cf --- /dev/null +++ b/third-party/CMakeLists.txt @@ -0,0 +1,35 @@ + +include(ExternalProject) + +# Set up an external project to pull source code from Git along with submodules +ExternalProject_Add( + dbcppp# Name for this external project + PREFIX ${CMAKE_BINARY_DIR}/external/dbcppp # Directory where the source will be downloaded + GIT_REPOSITORY https://github.com/xR3b0rn/dbcppp.git # Replace with your Git repository URL + GIT_TAG v3.2.6 # Replace with the branch or tag you want to use + TIMEOUT 10 # Adjust as needed + CONFIGURE_COMMAND "" # No configuration needed + BUILD_COMMAND "" # No build commands needed + INSTALL_COMMAND "" # No installation needed + LOG_DOWNLOAD ON # Enable logging for download details + GIT_SUBMODULES_INIT ON # Fetch submodules +) + +# Use the downloaded project as part of your build +ExternalProject_Get_Property(dbcppp source_dir) +add_subdirectory(${source_dir} ${CMAKE_BINARY_DIR}/external/dbcppp-build) + +# Enable CPack module +include(CPack) + +# Set the basic CPack settings +set(CPACK_GENERATOR "NSIS") # Use NSIS installer (you can use other generators as needed) +set(CPACK_PACKAGE_NAME "dbcppp") +set(CPACK_PACKAGE_VERSION "3.2.6") +set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") + +# Specify files to be installed (your executable and any other necessary files) +install(TARGETS dbcppp DESTINATION bin) # Replace YourExecutable with your actual target name + +# Other installation instructions for additional files, if any +