diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..32b0e2d4 --- /dev/null +++ b/.github/workflows/macos.yml @@ -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}} + \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000..5eb6a0ad --- /dev/null +++ b/.github/workflows/windows.yml @@ -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}} + + + + diff --git a/CMakeLists.txt b/CMakeLists.txt index 99cdb8a4..9b71f43f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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() # @@ -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. @@ -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) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4d70604b..b2ad4ee6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,5 @@ +cmake_minimum_required(VERSION 3.10) project(qucsator_rf CXX C) -cmake_policy(VERSION 2.6) # # Checks for libraries. @@ -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 @@ -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 # diff --git a/src/components/CMakeLists.txt b/src/components/CMakeLists.txt index 3137a634..ef51ab18 100644 --- a/src/components/CMakeLists.txt +++ b/src/components/CMakeLists.txt @@ -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 diff --git a/src/components/devices/CMakeLists.txt b/src/components/devices/CMakeLists.txt index 67f07cd0..d21a3e25 100644 --- a/src/components/devices/CMakeLists.txt +++ b/src/components/devices/CMakeLists.txt @@ -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 diff --git a/src/components/digital/CMakeLists.txt b/src/components/digital/CMakeLists.txt index 69f545ca..998567fd 100644 --- a/src/components/digital/CMakeLists.txt +++ b/src/components/digital/CMakeLists.txt @@ -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 diff --git a/src/components/microstrip/CMakeLists.txt b/src/components/microstrip/CMakeLists.txt index dc4b0dfd..37e60694 100644 --- a/src/components/microstrip/CMakeLists.txt +++ b/src/components/microstrip/CMakeLists.txt @@ -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 @@ -28,4 +27,4 @@ set(MICROSTRIP_SRC spiralinductor.cpp substrate.cpp) -add_library(coreMicrostrip OBJECT ${MICROSTRIP_SRC}) +add_library(coreMicrostrip OBJECT ${MICROSTRIP_SRC}) \ No newline at end of file diff --git a/src/components/verilog/CMakeLists.txt b/src/components/verilog/CMakeLists.txt index 4013d3eb..0f5a8358 100644 --- a/src/components/verilog/CMakeLists.txt +++ b/src/components/verilog/CMakeLists.txt @@ -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 diff --git a/src/converter/CMakeLists.txt b/src/converter/CMakeLists.txt index edb2e52b..61e15fc0 100644 --- a/src/converter/CMakeLists.txt +++ b/src/converter/CMakeLists.txt @@ -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 @@ -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) \ No newline at end of file diff --git a/src/interface/CMakeLists.txt b/src/interface/CMakeLists.txt index 5fa9c196..1872b453 100644 --- a/src/interface/CMakeLists.txt +++ b/src/interface/CMakeLists.txt @@ -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 diff --git a/src/math/CMakeLists.txt b/src/math/CMakeLists.txt index 94543ff2..1520b359 100644 --- a/src/math/CMakeLists.txt +++ b/src/math/CMakeLists.txt @@ -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)