-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add cmake support
- Loading branch information
Showing
86 changed files
with
1,642 additions
and
899 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,3 +126,5 @@ scan_vcd.cpp | |
tokens_vcd.h | ||
|
||
*~ | ||
*build* | ||
CMakeLists.txt.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,83 +29,80 @@ | |
|
||
# ~~~ | ||
|
||
project(qucs-core CXX) | ||
cmake_minimum_required(VERSION 2.6) | ||
project(qucsator CXX) | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
# ignore the project() managed VERSION (new in CMake 3.0) | ||
if(POLICY CMP0048) | ||
cmake_policy(SET CMP0048 OLD) | ||
endif(POLICY CMP0048) | ||
|
||
|
||
# otherwise qucsator cannot generate qucsdefs.h | ||
add_definitions(-DDEBUG) | ||
## otherwise qucsator cannot generate qucsdefs.h | ||
#add_definitions(-DDEBUG) | ||
|
||
# defines nr_double_t | ||
## defines nr_double_t | ||
add_definitions(-DHAVE_CONFIG_H) | ||
|
||
# ~~~ | ||
# TODO | ||
# OPTION(ENABLE_QUCSLIB "enable qucslib build, default: OFF") | ||
# OPTION(ENABLE_DOUBLE " type of double representation, default=double") | ||
|
||
# TODO configure debug/release flags | ||
|
||
# TODO check flags used on Autotools are needed: | ||
# | ||
# -pipe : Use pipes rather than temporary files for communication between the | ||
# various stages of compilation. | ||
# | ||
# https://blog.mozilla.org/nnethercote/2011/01/18/the-dangers-of-fno-exceptions/ | ||
# -fno-exceptions option is used, which means that exception-handling is | ||
# disabled. | ||
# | ||
# -fno-rtti : Disable generation of information about every class with virtual | ||
# functions. | ||
# | ||
# -fno-check-new : specific to GCC | ||
# | ||
# -Wmissing-prototypes : Warn if a global function is defined without a previous | ||
# prototype declaration. | ||
# | ||
# ~~~ | ||
## TODO configure debug/release flags | ||
|
||
## TODO check flags used on Autotools are needed: | ||
## | ||
## -pipe : Use pipes rather than temporary files for communication between the | ||
## various stages of compilation. | ||
## | ||
## https://blog.mozilla.org/nnethercote/2011/01/18/the-dangers-of-fno-exceptions/ | ||
## -fno-exceptions option is used, which means that exception-handling is | ||
## disabled. | ||
## | ||
## -fno-rtti : Disable generation of information about every class with virtual | ||
## functions. | ||
## | ||
## -fno-check-new : specific to GCC | ||
## | ||
## -Wmissing-prototypes : Warn if a global function is defined without a previous | ||
## prototype declaration. | ||
## | ||
## ~~~ | ||
|
||
# use top VERSION file | ||
file(STRINGS ${qucs-core_SOURCE_DIR}/VERSION QUCS_VERSION) | ||
file(STRINGS ${qucsator_SOURCE_DIR}/VERSION QUCS_VERSION) | ||
message(STATUS "Configuring ${PROJECT_NAME}: VERSION ${QUCS_VERSION}") | ||
|
||
# directed to config.h, so these definitions are available in the code | ||
set(PROJECT_VERSION "${QUCS_VERSION}") | ||
|
||
set(PROJECT_VENDOR "Qucs team. This program is licensed under the GNU GPL") | ||
|
||
set(QUCS_URL "https://sf.net/p/qucs") | ||
set(QUCS_BUGREPORT "[email protected]") | ||
|
||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/qucsconv.1.cmake.in | ||
${CMAKE_CURRENT_SOURCE_DIR}/doc/qucsconv.1) | ||
${CMAKE_CURRENT_SOURCE_DIR}/doc/qucsconv.1) | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/qucsator.1.cmake.in | ||
${CMAKE_CURRENT_SOURCE_DIR}/doc/qucsator.1) | ||
${CMAKE_CURRENT_SOURCE_DIR}/doc/qucsator.1) | ||
|
||
# use last git commit hash along the version | ||
set(GIT unknown) | ||
if(EXISTS ${CMAKE_SOURCE_DIR}/../.git) | ||
find_package(Git) | ||
# Get the latest abbreviated commit hash of the working branch | ||
execute_process( | ||
COMMAND ${GIT_EXECUTABLE} log --pretty=format:%h -n 1u | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE GIT_COMMIT_HASH) | ||
set(GIT ${GIT_COMMIT_HASH}) | ||
message(STATUS "Found Git repository, last commit hash: ${GIT}") | ||
COMMAND ${GIT_EXECUTABLE} log --pretty=format:%h -n 1u | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE GIT_COMMIT_HASH) | ||
set(GIT ${GIT_COMMIT_HASH}) | ||
message(STATUS "Found Git repository, last commit hash: ${GIT}") | ||
endif() | ||
|
||
# TODO rename the above variables? Project/Package? | ||
|
||
# Define to the address where bug reports for this package should be sent. | ||
set(PACKAGE_BUGREPORT "[email protected]") | ||
|
||
# Define to the full name of this package. | ||
set(PACKAGE_NAME "qucs-core") | ||
set(PACKAGE_NAME "qucsator") | ||
|
||
# Define to the full name and version of this package. | ||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PROJECT_VERSION}") | ||
|
@@ -118,92 +115,25 @@ set(PACKAGE_URL "http://sourceforge.net/projects/qucs/") | |
|
||
# Define to the version of this package. | ||
set(PACKAGE_VERSION ${PROJECT_VERSION}) | ||
|
||
# | ||
# Avoid source tree pollution | ||
# | ||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) | ||
message( | ||
FATAL_ERROR | ||
"\nIn-source builds are not permitted. | ||
Make a separate folder for building: | ||
$ mkdir build; cd build; cmake .. | ||
Before that, remove the files already created: | ||
$ rm -rf CMakeCache.txt CMakeFiles") | ||
endif() | ||
# add compiler definitions/symbols | ||
add_compile_definitions(PACKAGE_VERSION="${PACKAGE_VERSION}") | ||
|
||
# | ||
# Set locations of CMake modules, used on tests, find,... | ||
# | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") | ||
|
||
# | ||
# Need Flex | ||
# | ||
find_package(FLEX 2.5.9 REQUIRED) | ||
if(FLEX_FOUND) | ||
endif() | ||
|
||
# ~~~ | ||
# Need Bison | ||
# | ||
# This is a HACK to get arround a PATH issue with Qt Creator on OSX. | ||
# It seams impossible to pass a custom PATH to Qt Creator on OSX, ie, cannot prepend `/usr/local/bin/` for intance. | ||
# The FIND_PACKAGE fails. For now we provide a fallback with a custom FIND_PROGRAM. | ||
# The variable BISON_DIR is also available. | ||
# ~~~ | ||
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]") | ||
endif() | ||
endif() | ||
|
||
# | ||
# Check for sed | ||
# | ||
find_program(SED_TOOL NAMES sed) | ||
if(NOT SED_TOOL) | ||
message(FATAL_ERROR "Unable to find sed") | ||
else() | ||
message(STATUS "Found sed: " ${SED_TOOL}) | ||
endif() | ||
|
||
# | ||
# Check for gperf | ||
# | ||
find_program(GPERF_TOOL NAMES gperf) | ||
if(NOT GPERF_TOOL) | ||
message(FATAL_ERROR "gperf required in PATH") | ||
else() | ||
message(STATUS "Found gperf: " ${GPERF_TOOL}) | ||
endif() | ||
|
||
# | ||
# Check if admsXml is available | ||
# | ||
# * Use -DADMSXML_DIR=[path] to give the path containing admsXml | ||
# * Try a few othe locations | ||
# Avoid source tree pollution | ||
# | ||
find_program( | ||
ADMSXML admsXml | ||
HINTS ${ADMSXML_DIR} | ||
PATHS /usr/local/bin/ /opt/local/bin/ /usr/bin | ||
DOC "admsXml application") | ||
if(NOT ADMSXML) | ||
message(FATAL_ERROR "admsXml required in PATH") | ||
else() | ||
message(STATUS "Found admsXml: " ${ADMSXML}) | ||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) | ||
message( | ||
FATAL_ERROR | ||
"\nIn-source builds are not permitted. | ||
Make a separate folder for building: | ||
$ mkdir build; cd build; cmake .. | ||
Before that, remove the files already created: | ||
$ rm -rf CMakeCache.txt CMakeFiles") | ||
endif() | ||
|
||
# | ||
|
@@ -262,10 +192,10 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") | |
# Compiler-specific C++11 activation. | ||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") | ||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion | ||
OUTPUT_VARIABLE GCC_VERSION) | ||
OUTPUT_VARIABLE GCC_VERSION) | ||
if(NOT (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)) | ||
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.7 or greater.") | ||
endif() | ||
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.7 or greater.") | ||
endif() | ||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") | ||
else() | ||
|
@@ -277,7 +207,7 @@ endif() | |
# | ||
if(UNIX AND NOT APPLE) | ||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
endif() | ||
endif() | ||
|
||
|
@@ -291,11 +221,11 @@ add_subdirectory(doc) | |
# Custom uninstall target | ||
# | ||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake" IMMEDIATE @ONLY) | ||
"${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake" IMMEDIATE @ONLY) | ||
|
||
add_custom_target( | ||
uninstall-core COMMAND ${CMAKE_COMMAND} -P | ||
${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake) | ||
uninstall-qucsator COMMAND ${CMAKE_COMMAND} -P | ||
${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake) | ||
|
||
# TODO install distributables EXTRA_DIST = BUGS bootstrap depcomp RELEASE | ||
|
||
|
@@ -309,3 +239,33 @@ set(CPACK_GENERATOR "TGZ") | |
set(CPACK_PACKAGE_VERSION_MAJOR 0) | ||
set(CPACK_PACKAGE_VERSION_MINOR 18) | ||
include(CPack) | ||
|
||
# everything related to install the qucs application | ||
# any dependencies are installed here | ||
if(UNIX AND NOT APPLE) | ||
set(DESKTOP ${CMAKE_CURRENT_SOURCE_DIR}/contrib/qucsator.desktop) | ||
install(FILES ${DESKTOP} | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) | ||
|
||
set(BITMAPS_HICOLOR_PATH ${CMAKE_CURRENT_SOURCE_DIR}/contrib/hicolor) | ||
set(BITMAPS_HICOLOR_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor) | ||
|
||
install(FILES ${BITMAPS_HICOLOR_PATH}/16x16/apps/qucsator.png | ||
DESTINATION ${BITMAPS_HICOLOR_DESTINATION}/16x16/apps) | ||
install(FILES ${BITMAPS_HICOLOR_PATH}/22x22/apps/qucsator.png | ||
DESTINATION ${BITMAPS_HICOLOR_DESTINATION}/22x22/apps) | ||
install(FILES ${BITMAPS_HICOLOR_PATH}/32x32/apps/qucsator.png | ||
DESTINATION ${BITMAPS_HICOLOR_DESTINATION}/32x32/apps) | ||
install(FILES ${BITMAPS_HICOLOR_PATH}/48x48/apps/qucsator.png | ||
DESTINATION ${BITMAPS_HICOLOR_DESTINATION}/48x48/apps) | ||
install(FILES ${BITMAPS_HICOLOR_PATH}/64x64/apps/qucsator.png | ||
DESTINATION ${BITMAPS_HICOLOR_DESTINATION}/64x64/apps) | ||
install(FILES ${BITMAPS_HICOLOR_PATH}/128x128/apps/qucsator.png | ||
DESTINATION ${BITMAPS_HICOLOR_DESTINATION}/128x128/apps) | ||
install(FILES ${BITMAPS_HICOLOR_PATH}/256x256/apps/qucsator.png | ||
DESTINATION ${BITMAPS_HICOLOR_DESTINATION}/256x256/apps) | ||
install(FILES ${BITMAPS_HICOLOR_PATH}/512x512/apps/qucsator.png | ||
DESTINATION ${BITMAPS_HICOLOR_DESTINATION}/512x512/apps) | ||
install(FILES ${BITMAPS_HICOLOR_PATH}/scalable/apps/qucsator.svg | ||
DESTINATION ${BITMAPS_HICOLOR_DESTINATION}/scalable/apps) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
## WINDOWS: Could NOT find BISON (missing: BISON_EXECUTABLE) | ||
install BISON from: http://gnuwin32.sourceforge.net/packages/bison.htm | ||
|
||
## WINDOWS: Could NOT find FLEX (missing: FLEX_EXECUTABLE) | ||
install FLEX from: http://gnuwin32.sourceforge.net/packages/flex.htm | ||
|
||
## In file included from C:\Users\mmarmsoler\Documents\Personal\GIT\qucs\qucsator\src\ucs.cpp:39: C:\Users\mmarmsoler\Documents\Personal\GIT\qucs\qucsator\src\components/component.h:35:10: fatal error: compat.h: No such file or directory #include "compat.h" | ||
problem commit: adcda63f7cfd11f398b5cfed5110764a04e7f6f8 | ||
|
||
seems to be a problem in qucsator, because when commenting out qucsator target in src/CMakeLists.txt the compiler error does not occur anymore | ||
#add_executable(qucsator ucs.cpp ${PUBLIC_HEADERS} ${TEMPLATES}) | ||
#target_include_directories(qucsator PRIVATE ${qucsator_SOURCE_DIR}) | ||
|
||
## C:/Users/mmarmsoler/Documents/Personal/GIT/qucs/qucsator/src/logging.h:32:1: error: '__BEGIN_DECLS' does not name a type __BEGIN_DECLS | ||
occured during build of coreMath: Scanning dependencies of target coreMath | ||
defined in the config file config.h in the qucsator folder | ||
include config.h, how it should no about it? | ||
#include "config.h" | ||
|
||
## C:/Users/mmarmsoler/Documents/Personal/GIT/qucs/qucsator/src/compat.h:33:18: error: 'index' was not declared in this scope # define strchr index | ||
index is a deprecated posix function: https://stackoverflow.com/questions/4091864/c-differences-between-strchr-and-index | ||
strchr is a standard c function. | ||
solution commit: 87719aa0b7a2c185bdb531cae508836edfc66769 | ||
|
||
## windows: flex.exe: unknown flag '-'. | ||
solution: 15c6aba89bc03e5c94f37bdc00cec813f68565b2 | ||
|
||
## windows: m4: cannot open `Files': No such file or directory | ||
m4: cannot open `(x86)\GnuWin32/share/bison': No such file or directory | ||
m4: cannot open `C:\Program': No such file or directory | ||
m4: cannot open `Files': No such file or directory | ||
m4: cannot open `(x86)\GnuWin32/share/bison/m4sugar/m4sugar.m4': No such file or directory | ||
Problem during execution of bison.exe | ||
https://stackoverflow.com/questions/16442556/m4-no-such-file-or-directory-bison | ||
|
||
## C:\Users\mmarmsoler\Documents\Personal\GIT\qucs\qucsator\src\eqnsys.cpp:55: Fehler: redefinition of 'qucs::eqnsys<nr_type_t>::eqnsys()' eqnsys<nr_type_t>::eqnsys () { | ||
solution: 9046e62088c1060d354916fafdd988c3c99e29a2 | ||
|
||
## windows: By not providing "FindSED.cmake" in CMAKE_MODULE_PATH this project has | ||
asked CMake to find a package configuration file provided by "SED", but | ||
CMake did not find one. | ||
|
||
1) http://gnuwin32.sourceforge.net/packages/sed.htm | ||
2) find_program(SED_TOOL NAMES sed) | ||
|
||
## windows: sed.exe: -e expression #1, char 1: unknown command: `'' | ||
replace '' by "" | ||
|
||
## windows: add_custom_command( | ||
OUTPUT gperfapphash.gph | ||
COMMAND gperfappgen > ${CMAKE_CURRENT_BINARY_DIR}/gperfapphash.gph | ||
DEPENDS gperfappgen | ||
COMMENT "Gperfappgen gets executed" | ||
VERBATIM | ||
Solution: It gets not executed, because gperfapphash is not needed anywhere. | ||
add_custom_command( | ||
OUTPUT gperfapphash.cpp | ||
COMMAND ${GPERF_TOOL} -I -m 8 ${CMAKE_CURRENT_BINARY_DIR}/gperfapphash.gph > | ||
temp.gperf | ||
COMMAND ${SED_TOOL} -e "s/{''},/{'',0},/g" < temp.gperf > | ||
${CMAKE_CURRENT_BINARY_DIR}/gperfapphash.cpp | ||
DEPENDS gperfapphash.gph) | ||
Seeing here, gperfapphash.gph is only needed if gperfapphash.cpp is needed. | ||
So gperfapphash.cpp must be added as source to the libqucsator library. Then it is needed and so also the Command gets executed. | ||
Solution commit: d4e6b0d0d8bf5eda6ebdf689407b5af09910c87f | ||
|
||
## /usr/bin/ld: CMakeFiles/libqucsator.dir/gperfappgen.cpp.o:(.data.rel.local+0x0): multiple definition of `qucs::eqn::applications'; CMakeFiles/libqucsator.dir/evaluate.cpp.o:(.data.rel+0x0): first defined here | ||
/usr/bin/ld: CMakeFiles/libqucsator.dir/gperfappgen.cpp.o: in function `qucs::eqn::checker::tag2key(int)': | ||
solution: some source files from the headers removed | ||
|
||
## [ 52%] Linking CXX shared library libqucsator.dll | ||
CMakeFiles\libqucsator.dir/objects.a(acsolver.cpp.obj): In function `qucs::acsolver::acsolver()': | ||
C:/Users/mmarmsoler/Documents/Personal/GIT/qucs/qucsator/src/acsolver.cpp:50: undefined reference to `qucs::nasolver<std::complex<double> >::nasolver()' | ||
|
||
## Header missing from a target included with add_subdirectory | ||
Do not do: add_library(libqucsator SHARED $<TARGET_OBJECTS:includedObject>), because it adds only the source files. So the headers must also be included into libqucsator. | ||
Better: add_library(libqucsator SHARED <Sourcefiles for this lib>) | ||
target_link_libraries(libqucsator includedObject) | ||
|
||
## /usr/bin/ld: /usr/bin/ld: DWARF error: could not find variable specification at offset a43a components/CMakeFiles/coreComponents.dir/biastee.cpp.o: in function `biastee::calcTR(double)': | ||
at commit: c75f49c12e9c6656134f28dad0b3207a4719e574 | ||
removed coreMath, coreComponents and so on from the link libraries command for the qucsator and added the include paths to the headers | ||
DO NOT add object targets to a target when they are already included into the shared library. Makes no sense | ||
|
||
## :-1: error: libqucsator.so: undefined reference to `qucs::nasolver<double>::nasolver(qucs::nasolver<double>&)' | ||
During link of the libqucsator to the qucsator application | ||
problem commit: 1c2e56d5ac05cdea1adbd2fdc5612af489f1e187 | ||
The problem was that the source files of the template definitions are compiled by it self. But this is not correct. Do not compile template definitions. So they where included again (as it was before) into the header and not compiled. | ||
solution commit: a0b92f912525602e495fdbd9176dbfc918ff58b7 | ||
|
||
## [fatal..] Template not found: vtype [fatal..] see: [/home/martin/GITProjekte/qucs/qucsator/src/components/verilog/qucsMODULEcore.xml:871] | ||
order in components/verilog/Makelist.txt, VERILOG_XML, is important, because vtype needed by qucsMODULEcore.xml is defined in qucsVersion.xml | ||
|
||
|
||
|
||
|
||
|
||
|
Empty file.
Oops, something went wrong.