Skip to content

Commit

Permalink
Merge pull request #3 from dsm/develop
Browse files Browse the repository at this point in the history
fixed macOS build and added macOS and MSYS2 actions
  • Loading branch information
ra3xdh authored May 7, 2024
2 parents bd3e7a3 + 681050e commit 7494604
Show file tree
Hide file tree
Showing 12 changed files with 160 additions and 34 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: macos

on:
push:
branches: [ "develop", "release/*" ]
pull_request:
branches: [ "develop", "release/*" ]

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: macos-latest

steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest

- uses: actions/checkout@v4

- name: InstallDependencies
shell: bash
run: |
brew install gperf dos2unix bison flex
echo 'export PATH="/opt/homebrew/opt/bison/bin:$PATH"' >> /Users/runner/.bashrc
export LDFLAGS="-L/opt/homebrew/opt/bison/lib"
source ~/.bashrc
brew link bison --force
- 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 -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build -j16 --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}}

54 changes: 54 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: windows

on:
push:
branches: [ "develop", "release/*" ]
pull_request:
branches: [ "develop", "release/*" ]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: windows-latest

defaults:
run:
shell: msys2 {0}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msys2-root: ${{ runner.workspace }}/msys2
msystem: UCRT64
cache: true
update: true
install: >-
git
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-qt6-base
mingw-w64-ucrt-x86_64-qt6-tools
mingw-w64-ucrt-x86_64-qt6-svg
mingw-w64-ucrt-x86_64-make
mingw-w64-ucrt-x86_64-ninja
mingw-w64-ucrt-x86_64-python
bison
flex
dos2unix
mingw-w64-ucrt-x86_64-gperf
- name: Build with cmake
run: |
ls -la
cmake.exe -B build/ -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
cmake.exe --build build/ -j`nproc` --config ${{env.BUILD_TYPE}}
59 changes: 39 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
#

# ~~~

cmake_minimum_required(VERSION 3.10)
project(qucs-core CXX)
cmake_minimum_required(VERSION 3.0)

# ignore the project() managed VERSION (new in CMake 3.0)
if(POLICY CMP0048)
Expand Down Expand Up @@ -155,18 +154,27 @@ endif()
if(WIN32)
find_package(BISON 2.4 REQUIRED)
else() # Linux, OSX
# use -DBISON_DIR=/path/ to provide the path to bison
find_program(
BISON_EXECUTABLE bison
PATHS /usr/local/bin/ /opt/local/bin/ /usr/bin ${BISON_DIR}
DOC "bison path"
NO_DEFAULT_PATH)
if(BISON_EXECUTABLE)
message(STATUS "Found bison: " ${BISON_EXECUTABLE})
else()
message(
FATAL_ERROR "Unable to find bison. Try to provide -DBISON_DIR=[path]")
if(APPLE)
find_package(
BISON 3.0.0 REQUIRED
# homebrew_bison
PATH "/opt/homebrew/opt/bison/bin/"
)
else(APPLE)
# use -DBISON_DIR=/path/ to provide the path to bison
find_program(
BISON_EXECUTABLE bison
PATHS /usr/local/bin/ /opt/local/bin/ /usr/bin ${BISON_DIR}
DOC "bison path"
NO_DEFAULT_PATH)
if(BISON_EXECUTABLE)
message(STATUS "Found bison: " ${BISON_EXECUTABLE})
else()
message(
FATAL_ERROR "Unable to find bison. Try to provide -DBISON_DIR=[path]")
endif()
endif(APPLE)

endif()

#
Expand Down Expand Up @@ -247,18 +255,29 @@ endif()
# warnings * problem with non-starndart _stricmp using -stdr=c++0x set g++ into
# strict ANSY, relax that with -U__STRICT_ANSI__. Could use -std=gnu++0x
# ~~~
if(WIN32)
set(CMAKE_CXX_FLAGS "-Wall -std=c++0x -fpermissive -U__STRICT_ANSI__")
else()
set(CMAKE_CXX_FLAGS "-Wall -std=c++11")
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

if (WIN32)
if(MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
else(MSVC)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++11 -fpermissive -U__STRICT_ANSI__")
endif(MSVC)
else(WIN32)
# additional warnings
add_compile_options(-Wall -Wextra)
endif(WIN32)



# indiscriminate copy/paste from:
# http://stackoverflow.com/questions/10984442/how-to-detect-c11-support-of-a-
# compiler-with-cmake/20165220#20165220
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")

# Compiler-specific C++11 activation.
Expand Down Expand Up @@ -310,4 +329,4 @@ set(CPACK_GENERATOR "TGZ")
# (InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_VERSION_MAJOR 0)
set(CPACK_PACKAGE_VERSION_MINOR 18)
include(CPack)
include(CPack)
10 changes: 6 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(qucsator_rf CXX C)
cmake_policy(VERSION 2.6)

#
# Checks for libraries.
Expand Down Expand Up @@ -410,7 +410,6 @@ set(PUBLIC_HEADERS
operatingpoint.h)

include_directories(
${qucs-core_SOURCE_DIR} # generated config.h
${qucs-core_SOURCE_DIR}/src/math # precision.h
${qucs-core_SOURCE_DIR}/src/ # compat.h
${qucs-core_SOURCE_DIR}/src/components # microstrip/substrate.h
Expand Down Expand Up @@ -439,8 +438,11 @@ add_custom_command(
#
set(gperf_SRC gperfappgen.cpp gperfappgen.h)

add_executable(gperfappgen ${gperf_SRC})

IF(WIN32)
add_executable(gperfappgen.exe ${gperf_SRC})
ELSE() # Unix
add_executable(gperfappgen ${gperf_SRC})
ENDIF()
#
# Run gperfappgen, pipe to gperf input to gperfapphash.gph
#
Expand Down
2 changes: 1 addition & 1 deletion src/components/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include_directories(${qucs-core_SOURCE_DIR} ${qucs-core_CURRENT_SOURCE_DIR}
include_directories(${qucs-core_CURRENT_SOURCE_DIR}
${qucs-core_SOURCE_DIR}/src/math)

set(COMPONENTS_SRC
Expand Down
2 changes: 1 addition & 1 deletion src/components/devices/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include_directories(
${qucs-core_SOURCE_DIR} ${qucs-core_CURRENT_SOURCE_DIR}
${qucs-core_CURRENT_SOURCE_DIR}
${qucs-core_SOURCE_DIR}/src/math ${qucs-core_SOURCE_DIR}/src/components
)# component.h

Expand Down
2 changes: 1 addition & 1 deletion src/components/digital/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include_directories(
${qucs-core_SOURCE_DIR} ${qucs-core_CURRENT_SOURCE_DIR}
${qucs-core_CURRENT_SOURCE_DIR}
${qucs-core_SOURCE_DIR}/src/math ${qucs-core_SOURCE_DIR}/src/components
)# component.h

Expand Down
3 changes: 1 addition & 2 deletions src/components/microstrip/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include_directories(
${qucs-core_SOURCE_DIR}
${qucs-core_CURRENT_SOURCE_DIR}
${qucs-core_SOURCE_DIR}/src/math
${qucs-core_SOURCE_DIR}/src/components # component.h
Expand Down Expand Up @@ -28,4 +27,4 @@ set(MICROSTRIP_SRC
spiralinductor.cpp
substrate.cpp)

add_library(coreMicrostrip OBJECT ${MICROSTRIP_SRC})
add_library(coreMicrostrip OBJECT ${MICROSTRIP_SRC})
1 change: 0 additions & 1 deletion src/components/verilog/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include_directories(
${qucs-core_SOURCE_DIR}
${qucs-core_CURRENT_SOURCE_DIR}
${qucs-core_SOURCE_DIR}/src/math
${qucs-core_SOURCE_DIR}/src/components # component.h
Expand Down
4 changes: 2 additions & 2 deletions src/converter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include_directories(
${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/math
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/math
${CMAKE_CURRENT_BINARY_DIR}) # qucdefs.h

set(QUCSCONV_SRC
Expand Down Expand Up @@ -60,4 +60,4 @@ target_link_libraries(qucsconv_rf libqucsator ${CMAKE_DL_LIBS})
#
# Handle installation
#
install(TARGETS qucsconv_rf DESTINATION bin)
install(TARGETS qucsconv_rf DESTINATION bin)
1 change: 0 additions & 1 deletion src/interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include_directories(
${qucs-core_SOURCE_DIR}
${qucs-core_CURRENT_SOURCE_DIR}
${qucs-core_SOURCE_DIR}/src/math
${qucs-core_SOURCE_DIR}/src/components # component.h
Expand Down
2 changes: 1 addition & 1 deletion src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
include_directories( ${CMAKE_CURRENT_SOURCE_DIR})

set(MATH_SRC # cbesselj.cpp
complex.cpp fspecial.cpp matrix.cpp real.cpp)
Expand Down

0 comments on commit 7494604

Please sign in to comment.