Skip to content

Commit

Permalink
Merge pull request Qucs#985 from guitorri/cmake-fixes
Browse files Browse the repository at this point in the history
Cmake fixes
  • Loading branch information
guitorri authored Mar 7, 2020
2 parents d3218d9 + 2f75aed commit 830c996
Show file tree
Hide file tree
Showing 48 changed files with 3,474 additions and 151 deletions.
24 changes: 12 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ addons:
- gperf
- latex2html
- octave
- doxygen # add packages for Doxygen and qucs-doc PDF build
- texlive
- texlive-math-extra
- texlive-science
- transfig
- gnuplot
- texlive-publishers
- graphviz
- texlive-font-utils
- ps2eps
- pgf
- python-tk

matrix:
include:
Expand Down Expand Up @@ -63,18 +75,6 @@ matrix:
apt:
packages:
- *native_deps
- doxygen # add packages for Doxygen and qucs-doc PDF build
- texlive
- texlive-math-extra
- texlive-science
- transfig
- gnuplot
- texlive-publishers
- graphviz
- texlive-font-utils
- ps2eps
- pgf
- python-tk

- os: osx
# Qt 4.8.7 official installer works up to OSX 10.10 or xcode6.4
Expand Down
50 changes: 49 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,56 @@ cmake_policy(VERSION 2.8)
file(STRINGS "${qucs-project_SOURCE_DIR}/VERSION" QUCS_VERSION)
message(STATUS "Configuring Qucs Project: VERSION ${QUCS_VERSION}")

# enable testing for current directory and below
option(BUILD_DOC "Build documentation (default ON)" ON)

#
# Enable testing for current directory and below
#
enable_testing()

#
# Descend into sub-directories
#
add_subdirectory(qucs)
add_subdirectory(qucs-core)
if(BUILD_DOC)
add_subdirectory(qucs-doc)
endif()

#
# Run tests
#
add_test(NAME qucs_netlist_check
COMMAND python3 run.py --qucs
--prefix ${CMAKE_CURRENT_BINARY_DIR}/qucs/qucs/ --exclude skip.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/qucs-test/)
set_property(
TEST qucs_netlist_check
PROPERTY
ENVIRONMENT "QUCS_LIBDIR=${CMAKE_CURRENT_SOURCE_DIR}/qucs/qucs-lib/library")
set_property(
TEST qucs_netlist_check
APPEND
PROPERTY
ENVIRONMENT "QUCSCONV=${CMAKE_CURRENT_BINARY_DIR}/qucs-core/src/converter/qucsconv")


add_test(NAME qucsator_check
COMMAND python3 run.py --qucsator --exclude skip.txt
--prefix ${CMAKE_CURRENT_BINARY_DIR}/qucs-core/src/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/qucs-test/)


add_test(NAME qucsator_equation_check
COMMAND python3 run_equations.py
--prefix ${CMAKE_CURRENT_BINARY_DIR}/qucs-core/src/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/qucs-test/)

# uninstall target
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake" IMMEDIATE @ONLY)

add_custom_target(
uninstall COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake)

25 changes: 25 additions & 0 deletions cmake/uninstall.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")

file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)

string(REGEX REPLACE "\n" ";" files "${files}")

foreach (file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)

34 changes: 10 additions & 24 deletions qucs-core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# ~~~

# !!!! EXPERIMENTAL/DEVELOPMENT BUILD SYSTEM !!!! If you need support please
# contact the maintainers

#
# You can change the install location by running cmake like this: mkdir build;
# cd build cmake .. -DCMAKE_INSTALL_PREFIX=/new/install/prefix

# Notes * By default, the prefix is "/usr/local" * Use -DADMSXML_DIR=[path] to
# give the path containing admsXml * Use -DUSE_MAINTAINER_MODE=ON to rebuild
# submodules (ADMS) * Bison can be pointed to with -DBISON_DIR=[path]
# Notes:
#
# * By default, the prefix is "/usr/local"
# * Use -DADMSXML_DIR=[path] to give the path containing admsXml submodules (ADMS)
# * Bison can be pointed to with -DBISON_DIR=[path]

# Running with QtCreator Open this CMakeLists.txt with 'Open File or Project..."
# Provide CMake arguments: * Set admsXml path, (after building with Autotools) *
Expand All @@ -22,11 +21,10 @@
# variable on the Build Environment. Prepend '/usr/local/bin' before '/usr/bin/'
# otherwise it will find the older executables provided by Apple.

# Dependencies * CMake 2.8.8 * adms 2.3.0+ (its dependencies if
# USE_MAINTAINER_MODE) * sed * gperf * flex * bison * make * C++ compiler

#
# qucs-core * qucsator, libqucs * qucsconv
# Build
# * qucsator
# * libqucs
# * qucsconv
#

# ~~~
Expand All @@ -39,10 +37,6 @@ if(POLICY CMP0048)
cmake_policy(SET CMP0048 OLD)
endif(POLICY CMP0048)

# default is off, assume one is building the released tarball (pre-configured)
option(USE_MAINTAINER_MODE "development mode, rebuild ADMS submodule" OFF)

# SET(CMAKE_VERBOSE_MAKEFILE ON)

# otherwise qucsator cannot generate qucsdefs.h
add_definitions(-DDEBUG)
Expand Down Expand Up @@ -83,9 +77,6 @@ message(STATUS "Configuring ${PROJECT_NAME}: VERSION ${QUCS_VERSION}")
set(PROJECT_VERSION "${QUCS_VERSION}")

set(PROJECT_VENDOR "Qucs team. This program is licensed under the GNU GPL")
set(PROJECT_COPYRIGHT_YEAR "2013")
set(PROJECT_DOMAIN_FIRST "qucs")
set(PROJECT_DOMAIN_SECOND "org")

set(QUCS_URL "https://sf.net/p/qucs")
set(QUCS_BUGREPORT "qucs-bugs@lists.sourceforge.net")
Expand Down Expand Up @@ -151,7 +142,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
#
find_package(FLEX 2.5.9 REQUIRED)
if(FLEX_FOUND)
# MESSAGE(STATUS "Found flex: ${FLEX_EXECUTABLE} / Version: ${FLEX_VERSION}" )
endif()

# ~~~
Expand All @@ -164,10 +154,6 @@ endif()
# ~~~
if(WIN32)
find_package(BISON 2.4 REQUIRED)
if(BISON_FOUND)
# MESSAGE(STATUS "Found bison: ${BISON_EXECUTABLE} / Version:
# ${BISON_VERSION}" )
endif()
else() # Linux, OSX
# use -DBISON_DIR=/path/ to provide the path to bison
find_program(
Expand Down Expand Up @@ -308,7 +294,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake" IMMEDIATE @ONLY)

add_custom_target(
coreuninstall COMMAND ${CMAKE_COMMAND} -P
uninstall-core COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake)

# TODO install distributables EXTRA_DIST = BUGS bootstrap depcomp RELEASE
Expand Down
36 changes: 16 additions & 20 deletions qucs-core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,36 +292,32 @@ set(ParserTypes
zvr)

set(generated_SRC)

foreach(type ${ParserTypes})

# Create custom Bison
set(BO_${type} ${CMAKE_CURRENT_BINARY_DIR}/parse_${type}.cpp
${CMAKE_CURRENT_BINARY_DIR}/tokens_${type}.h)
set(bisonIn "${CMAKE_CURRENT_SOURCE_DIR}/parse_${type}.ypp")
set(bisonOut "parse_${type}.hpp"
"parse_${type}.cpp")
add_custom_command(
OUTPUT ${BO_${type}}
OUTPUT ${bisonOut}
COMMAND
${BISON_EXECUTABLE}
--defines=${CMAKE_CURRENT_BINARY_DIR}/parse_${type}.hpp
--output=${CMAKE_CURRENT_BINARY_DIR/}parse_${type}.cpp
${CMAKE_CURRENT_SOURCE_DIR}/parse_${type}.ypp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/parse_${type}.ypp)

--defines=parse_${type}.hpp
--output=parse_${type}.cpp
${bisonIn}
DEPENDS ${bisonIn})
# Create custom Flex
set(FI_${type} ${CMAKE_CURRENT_SOURCE_DIR}/scan_${type}.lpp)
set(FO_${type} ${CMAKE_CURRENT_BINARY_DIR}/scan_${type}.cpp)
set(flexIn "${CMAKE_CURRENT_SOURCE_DIR}/scan_${type}.lpp")
set(flexOut "scan_${type}.cpp")
add_custom_command(
OUTPUT ${FO_${type}}
COMMAND ${FLEX_EXECUTABLE} --outfile=${FO_${type}} ${FI_${type}}
DEPENDS ${BO_${type}} ${FI_${type}})
set(generated_SRC ${generated_SRC} ${FO_${type}})
set(generated_SRC ${generated_SRC} ${BO_${type}})
endforeach()
OUTPUT ${flexOut}
COMMAND ${FLEX_EXECUTABLE} --outfile=${flexOut} ${flexIn}
DEPENDS ${flexIn})

foreach(gfile ${generated_SRC})
set_source_files_properties(${gfile} PROPERTIES GENERATED TRUE)
list(APPEND generated_SRC ${bisonOut})
list(APPEND generated_SRC ${flexOut})
endforeach()


#
# Source code libqucs
#
Expand Down
Loading

0 comments on commit 830c996

Please sign in to comment.