Re: [deal.II] Re: cmake with library and executables
Many thanks, Matthias! Works! Best, Konrad On Wednesday, December 25, 2019 at 2:07:41 PM UTC+1, Matthias Maier wrote: > > > On Fri, Dec 20, 2019, at 13:07 CST, Konrad Simon > wrote: > > > > ### > > > > > ### > > > > ADD_CUSTOM_TARGET(debug > > COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} > > COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all > > COMMENT "Switch CMAKE_BUILD_TYPE to Debug" > > ) > > > > ADD_CUSTOM_TARGET(release > > COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release > ${CMAKE_SOURCE_DIR} > > COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all > > COMMENT "Switch CMAKE_BUILD_TYPE to Release" > > ) > > > ### > > > > > ### > > > > Do you get the jobserver warning while running "make release" or "make > debug" with "-j8"? > > If so - that's because you cannot recursively call into make with the > jobserver feature that way. > > We have fixed the example steps a while ago but probably never updated > the documentation regarding these two custom targets. It is best to > simply have: > > ADD_CUSTOM_TARGET(debug > COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} > COMMENT "Switch CMAKE_BUILD_TYPE to Debug" > ) > > ADD_CUSTOM_TARGET(release > COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} > ) > > and then > > $ make release > $ make -j8 > > or > > $ make debug > $ make -j8 > > Best, > Matthias > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/b39bba70-1033-4a18-b618-572309514c45%40googlegroups.com.
Re: [deal.II] Re: cmake with library and executables
On Fri, Dec 20, 2019, at 13:07 CST, Konrad Simon wrote: > ### > ### > ADD_CUSTOM_TARGET(debug > COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} > COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all > COMMENT "Switch CMAKE_BUILD_TYPE to Debug" > ) > > ADD_CUSTOM_TARGET(release > COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} > COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all > COMMENT "Switch CMAKE_BUILD_TYPE to Release" > ) > ### > ### Do you get the jobserver warning while running "make release" or "make debug" with "-j8"? If so - that's because you cannot recursively call into make with the jobserver feature that way. We have fixed the example steps a while ago but probably never updated the documentation regarding these two custom targets. It is best to simply have: ADD_CUSTOM_TARGET(debug COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} COMMENT "Switch CMAKE_BUILD_TYPE to Debug" ) ADD_CUSTOM_TARGET(release COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} ) and then $ make release $ make -j8 or $ make debug $ make -j8 Best, Matthias -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/87h81ok0yt.fsf%4043-1.org.
Re: [deal.II] Re: cmake with library and executables
Hi Wolfgang, On Tuesday, December 24, 2019 at 5:59:31 PM UTC+1, Wolfgang Bangerth wrote: > > > Konrad, > your email has no question :-) Is your problem that you can't call 'make > -j8' > and your question how to make that possible? If so, what happens if you > try? > What is the error message? > The message essentially says I can not use the jobserver so I can only use once core to compile. My library does compile but falls back to make -j1 every time I invoke make -j8. My question is why? And how can I use all cores? Thank you and merry Christmas! Konrad -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/1d1a9cfa-5975-432c-9093-b542ee213cab%40googlegroups.com.
Re: [deal.II] Re: cmake with library and executables
Konrad, your email has no question :-) Is your problem that you can't call 'make -j8' and your question how to make that possible? If so, what happens if you try? What is the error message? Best W. On 12/20/19 12:07 PM, Konrad Simon wrote: > Hello deal.ii community, > > I am posting again (sorry) with a bit more info since I did not find the > mistake in my cmake setup. I have essentially the following project structure: > > project/source > project/include > project/doc > project/test. > > In project/ I have this CMakeLists.txt: > > # > # > # Macro to print all arguments > macro (print_all_args) > message (STATUS "") > set(list_var "${ARGN}") > foreach(_currentItem IN LISTS list_var) > message (STATUS "Adding library source file: ${_currentItem}") > endforeach (_currentItem) > message (STATUS "") > endmacro (print_all_args) > # > # > > > > ### > ### > message(STATUS "This is CMake ${CMAKE_VERSION}") > message(STATUS "") > > cmake_minimum_required(VERSION 2.8.12) > > find_package(deal.II 9.1.1 QUIET > HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR} > ) > if (NOT ${deal.II_FOUND}) > message(FATAL_ERROR "\n" > "*** Could not locate a (sufficiently recent) version of deal.II. > ***\n\n" > "You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to > cmake\n" > "or set an environment variable \"DEAL_II_DIR\" that contains this path." > ) > endif () > > DEAL_II_INITIALIZE_CACHED_VARIABLES() > > set(PROJECT_NAME MsFEComplex) > > # The version number > set(MsFEComplex_VER_MAJOR 0) > set(MsFEComplex_VER_MINOR 1) > > project(${PROJECT_NAME}) > ### > ### > > > > ### > ### > # Check for the existence of various optional folders: > if (EXISTS ${CMAKE_SOURCE_DIR}/doc/CMakeLists.txt) > set(MsFEComplex_HAVE_DOC_DIRECTORY TRUE) > endif () > > if (EXISTS ${CMAKE_SOURCE_DIR}/test/CMakeLists.txt) > set (MsFEComplex_HAVE_TEST_DIRECTORY TRUE) > endif () > ### > ### > > > > ### > ### > # Change default CMAKE_INSTAL_PREFIX to ${CMAKE_BINARY_DIR}/lib > if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) > set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/lib" CACHE PATH "default > install path" FORCE ) > endif () > > set (MsFEComplex_LIBRARY msfecomplex) > ### > ### > > > > ### > ### > set(MsFEComplex_INCLUDE_DIR > ${CMAKE_SOURCE_DIR}/include) > > set(MsFEComplex_SRC_DIR > ${CMAKE_SOURCE_DIR}/source) > add_subdirectory (${MsFEComplex_SRC_DIR}) > > > # Only add subdirectories for doc if exists > if (MsFEComplex_HAVE_DOC_DIRECTORY) > add_subdirectory (${CMAKE_SOURCE_DIR}/doc) > endif () > > # Only add subdirectories for doc if exists > if (MsFEComplex_HAVE_TEST_DIRECTORY) > add_subdirectory (${CMAKE_SOURCE_DIR}/test) > ENABLE_TESTING() > endif () > ### > ### > > > > ### > ### > ADD_CUSTOM_TARGET(debug > COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} > COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all > COMMENT "Switch CMAKE_BUILD_TYPE to Debug" > ) > > ADD_CUSTOM_TARGET(release > COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} > COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all > COMMENT "Switch CMAKE_BUILD_TYPE to Release" > ) >