diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml deleted file mode 100644 index 3ea112a2b..000000000 --- a/.github/workflows/cmake.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: CMake Linux Qt5 - -on: - push: - branches: [ "master", "current", "release/*" ] - paths: [ "**.cpp", "**.h", "**/CMakeLists.txt" ] - pull_request: - branches: [ "master", "current", "release/*" ] - paths: [ "**.cpp", "**.h", "**/CMakeLists.txt" ] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - - - - build: - # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. - # You can convert this to a matrix build if you need cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: InstallQt5 - run: | - sudo apt-get update - sudo apt-get install -y qtbase5-dev qttools5-dev qtscript5-dev libqt5svg5-dev flex bison libqt5charts5-dev - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build -j`nproc` --config ${{env.BUILD_TYPE}} - - #- name: Test - # working-directory: ${{github.workspace}}/build - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - # run: ctest -C ${{env.BUILD_TYPE}} - diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index acc0d6f46..e76b21487 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,7 +11,6 @@ on: env: APP_NAME: "Qucs-S" - CI_VERSION: 24.4.99 EXECUTABLE_NAME: "qucs-s" PUBLISHER_NAME: "The Qucs-S Team" BUILD_TYPE: Release @@ -25,6 +24,7 @@ jobs: runs-on: ubuntu-latest outputs: version: ${{ steps.read_version.outputs.version }} + short_hash: ${{ steps.read_version.outputs.short_hash }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -32,18 +32,75 @@ jobs: - name: Read version from file id: read_version run: | - if [ "${{github.ref_type}}" == "tag" ]; then + if [ "${{ github.ref_type }}" == "tag" ]; then VERSION=${{ github.ref_name }} - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "version=$VERSION" >> $GITHUB_OUTPUT - else - VERSION=${{ env.CI_VERSION }} - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "version=$VERSION" >> $GITHUB_OUTPUT + SHORT_HASH="" + else + MAJOR_MINOR=$(cut -d. -f1-2 VERSION) + VERSION="${MAJOR_MINOR}.99" + # Get the short hash of the current commit + COMMIT_HASH=$(echo ${{ github.sha }} | cut -c1-7) + SHORT_HASH="-$COMMIT_HASH" fi - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "SHORT_HASH=$SHORT_HASH" >> $GITHUB_ENV + echo "short_hash=$SHORT_HASH" >> $GITHUB_OUTPUT + + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" + + build-linux-qt5: + runs-on: ubuntu-22.04 + continue-on-error: true + needs: setup + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set version environment variable + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV + + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y libglx-dev libgl1-mesa-dev flex bison gperf dos2unix flex bison gperf dos2unix cups libcups2-dev + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 + + - name: 'Install Qt5' + uses: jurplel/install-qt-action@v4 + with: + version: 5.15.2 + host: 'linux' + target: 'desktop' + cache: true + arch: 'gcc_64' + install-deps: 'true' + modules: 'qtcharts' + + - name: 'Configure CMake' + run: | + cmake -B ${{github.workspace}}/build \ + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + -DCI_VERSION="${{env.VERSION}}" + + - name: 'Build' + # Build your program with the given configuration + run: | + cmake --build ${{github.workspace}}/build -j`nproc` --config ${{env.BUILD_TYPE}} + build-linux-appimage-qt6: runs-on: ubuntu-22.04 @@ -54,10 +111,14 @@ jobs: submodules: recursive - name: Set version environment variable - run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - name: Install Dependencies run: | @@ -109,13 +170,13 @@ jobs: --plugin=qt --output appimage rm linuxdeploy-x86_64.AppImage rm linuxdeploy-plugin-qt-x86_64.AppImage - mv *.AppImage ${{ env.APP_NAME }}-${{env.VERSION}}-linux-x86_64.AppImage + mv *.AppImage ${{ env.APP_NAME }}-${{env.VERSION}}${{env.SHORT_HASH}}-linux-x86_64.AppImage - name: 'Upload artifact: AppImage' uses: actions/upload-artifact@v4 with: - name: ${{ env.APP_NAME }}-${{env.VERSION}}-linux-x86_64 - path: ${{ env.APP_NAME }}-${{env.VERSION}}-linux-x86_64.AppImage + name: ${{ env.APP_NAME }}-${{env.VERSION}}${{env.SHORT_HASH}}-linux-x86_64 + path: ${{ env.APP_NAME }}-${{env.VERSION}}${{env.SHORT_HASH}}-linux-x86_64.AppImage build-mac-intel: @@ -129,10 +190,14 @@ jobs: xcode-version: latest-stable - name: Set version environment variable - run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - uses: actions/checkout@v4 with: @@ -221,10 +286,14 @@ jobs: xcode-version: latest-stable - name: Set version environment variable - run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - uses: actions/checkout@v4 with: @@ -300,9 +369,69 @@ jobs: with: name: ${{ env.APP_NAME }}-${{env.VERSION}}-macOS path: ${{ env.APP_NAME }}-${{env.VERSION}}-macOS.dmg + + build-windows-msvc: + runs-on: windows-latest + needs: setup + strategy: + fail-fast: false + defaults: + run: + shell: pwsh + steps: + - name: Disable autocrlf in Git + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: Set version environment variable + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: 'Install Qt6' + uses: jurplel/install-qt-action@v4 + with: + version: ${{env.QT_VERSION}} + host: 'windows' + target: 'desktop' + cache: true + arch: 'win64_msvc2022_64' + install-deps: 'true' + modules: 'qtcharts' + + - name: '⚙️ Install CMake' + uses: lukka/get-cmake@latest + with: + useLocalCache: true + + - name: '🛠 Setup MSVC Development Environment' + uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: x64 + + - name: 'Configure CMake' + run: | + cmake -B ${{github.workspace}}/build -DWITH_QT6=1 ` + -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl ` + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ` + -DCI_VERSION="${{env.VERSION}}" + + - name: 'Build Qucs-s' + run: | + cmake --build ${{github.workspace}}/build -j 16 --config=${{env.BUILD_TYPE}} build-windows: runs-on: windows-2022 + continue-on-error: true needs: setup strategy: fail-fast: false @@ -320,10 +449,13 @@ jobs: shell: pwsh run: | echo "VERSION=${{ needs.setup.outputs.version }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - name: Print version + - name: Print version and hash shell: pwsh - run: echo "Qucs-S version is ${{ env.VERSION }}" + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - name: Checkout repository uses: actions/checkout@v4 @@ -404,26 +536,26 @@ jobs: mkdir -p build/qucs-suite/misc cp -rf contrib/InnoSetup/misc build/qucs-suite/ cd build/qucs-suite - zip -r ../../${{ env.APP_NAME }}-${{ env.VERSION }}-win64.zip ./bin ./share ./lib ./misc + zip -r ../../${{ env.APP_NAME }}-${{ env.VERSION }}${{ env.SHORT_HASH }}-win64.zip ./bin ./share ./lib ./misc cd ../.. - name: Compile .ISS to .EXE Installer - uses: Minionguyjpro/Inno-Setup-Action@v1.2.4 + uses: Minionguyjpro/Inno-Setup-Action@v1.2.5 with: path: contrib/InnoSetup/qucs.iss - options: /Qp /O"${{github.workspace}}" /DAPPNAME=${{ env.APP_NAME }} /DRELEASE="${{ env.VERSION }}" + options: /Qp /O"${{github.workspace}}" /DAPPNAME=${{ env.APP_NAME }} /DRELEASE="${{ env.VERSION }}${{ env.SHORT_HASH }}" - name: Upload build artifacts uses: actions/upload-artifact@v4 with: - name: ${{ env.APP_NAME }}-${{ env.VERSION }}-win64 - path: ${{ env.APP_NAME }}-${{ env.VERSION }}-win64.zip + name: ${{ env.APP_NAME }}-${{ env.VERSION }}${{ env.SHORT_HASH }}-win64 + path: ${{ env.APP_NAME }}-${{ env.VERSION }}${{ env.SHORT_HASH }}-win64.zip - name: Upload exe artifacts uses: actions/upload-artifact@v4 with: - name: ${{ env.APP_NAME }}-${{ env.VERSION }}-setup - path: ${{ env.APP_NAME }}-${{ env.VERSION }}-setup.exe + name: ${{ env.APP_NAME }}-${{ env.VERSION }}${{ env.SHORT_HASH }}-setup + path: ${{ env.APP_NAME }}-${{ env.VERSION }}${{ env.SHORT_HASH }}-setup.exe create-release: runs-on: ubuntu-latest @@ -434,10 +566,14 @@ jobs: uses: actions/checkout@v4 - name: Set version environment variable - run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - name: Download build artifacts uses: actions/download-artifact@v4 diff --git a/qucs-activefilter/CMakeLists.txt b/qucs-activefilter/CMakeLists.txt index f506e5aa6..3629d0f94 100644 --- a/qucs-activefilter/CMakeLists.txt +++ b/qucs-activefilter/CMakeLists.txt @@ -80,8 +80,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() diff --git a/qucs-attenuator/CMakeLists.txt b/qucs-attenuator/CMakeLists.txt index bb1f9576e..f9086f144 100644 --- a/qucs-attenuator/CMakeLists.txt +++ b/qucs-attenuator/CMakeLists.txt @@ -69,8 +69,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() diff --git a/qucs-filter/CMakeLists.txt b/qucs-filter/CMakeLists.txt index d3346e025..72c5c9b23 100644 --- a/qucs-filter/CMakeLists.txt +++ b/qucs-filter/CMakeLists.txt @@ -71,8 +71,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() diff --git a/qucs-powercombining/CMakeLists.txt b/qucs-powercombining/CMakeLists.txt index f19d6b635..e8933b2d1 100644 --- a/qucs-powercombining/CMakeLists.txt +++ b/qucs-powercombining/CMakeLists.txt @@ -80,8 +80,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() diff --git a/qucs-s-spar-viewer/CMakeLists.txt b/qucs-s-spar-viewer/CMakeLists.txt index 7c421debf..c42ec072e 100644 --- a/qucs-s-spar-viewer/CMakeLists.txt +++ b/qucs-s-spar-viewer/CMakeLists.txt @@ -6,9 +6,14 @@ SET(QUCS_NAME "qucs-s") # use top VERSION file file (STRINGS ${PROJECT_SOURCE_DIR}/../VERSION QUCS_VERSION) -message(STATUS "Configuring ${PROJECT_NAME} (GUI): VERSION ${QUCS_VERSION}") -set(PROJECT_VERSION "${QUCS_VERSION}") +if(DEFINED CI_VERSION) + set(PROJECT_VERSION "${CI_VERSION}") +else() + set(PROJECT_VERSION "${QUCS_VERSION}") +endif() + +message(STATUS "Configuring ${PROJECT_NAME} (GUI): VERSION ${PROJECT_VERSION}") set(PROJECT_VENDOR "Qucs-S team. This program is licensed under the GNU GPL") set(PROJECT_COPYRIGHT_YEAR "2024") @@ -40,20 +45,36 @@ include_directories( ) -IF(QT_VERSION_MAJOR EQUAL 6) -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -ELSE() -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -ENDIF() - -if (MSVC) - add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor) +if (${QT_VERSION} VERSION_LESS "6.7.0") + set(CMAKE_CXX_STANDARD 17) else() - # additional warnings - add_compile_options(-Wall -Wextra) + set(CMAKE_CXX_STANDARD 20) endif() +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) + add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /Od /vmg) + add_compile_options(/wd4244 /wd4267 /wd4312) + else() + add_compile_options(-Wall -Wextra -O0 -g) + if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$|^Clang$") + add_compile_options(-Wno-ignored-attributes) + endif() + endif() +elseif(CMAKE_BUILD_TYPE STREQUAL "Release") + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) + else() + add_compile_options(-w) + endif() +endif() + ADD_DEFINITIONS(${QT_DEFINITIONS}) #ADD_SUBDIRECTORY( bitmaps ) -> added as resources diff --git a/qucs-transcalc/CMakeLists.txt b/qucs-transcalc/CMakeLists.txt index 93cb4ab7e..ffbc092e9 100644 --- a/qucs-transcalc/CMakeLists.txt +++ b/qucs-transcalc/CMakeLists.txt @@ -70,13 +70,13 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() endif() - ADD_DEFINITIONS(${QT_DEFINITIONS}) SET(QUCSTRANS_SRCS diff --git a/qucs/CMakeLists.txt b/qucs/CMakeLists.txt index d78e779c3..8d8c571e7 100755 --- a/qucs/CMakeLists.txt +++ b/qucs/CMakeLists.txt @@ -115,8 +115,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif()