Skip to content
Snippets Groups Projects
Commit 6ce0873d authored by Stephan Schulz's avatar Stephan Schulz
Browse files

propagate compile definitions outwards, for VTK and Voronoi

parent 6117386c
No related branches found
No related tags found
1 merge request!15CMake projectconfig
...@@ -75,8 +75,6 @@ if(CM_ALL_VTK_OUTPUT) ...@@ -75,8 +75,6 @@ if(CM_ALL_VTK_OUTPUT)
if(NOT VTK_FOUND) if(NOT VTK_FOUND)
message(FATAL_ERROR "VTK not found, help CMake to find it by setting VTK_LIBRARY and VTK_INCLUDE_DIR") message(FATAL_ERROR "VTK not found, help CMake to find it by setting VTK_LIBRARY and VTK_INCLUDE_DIR")
endif() endif()
# todo(s.schulz): this can be replaced from 3.12 onwards with add_compile_definitions
add_compile_definitions("ALL_VTK_OUTPUT")
endif(CM_ALL_VTK_OUTPUT) endif(CM_ALL_VTK_OUTPUT)
if (CM_ALL_DEBUG) if (CM_ALL_DEBUG)
...@@ -97,7 +95,6 @@ endif(CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE) ...@@ -97,7 +95,6 @@ endif(CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE)
if(CM_ALL_VORONOI) if(CM_ALL_VORONOI)
message(STATUS "compiling voro++ version in contrib/voro++") message(STATUS "compiling voro++ version in contrib/voro++")
add_subdirectory(contrib/voro++) add_subdirectory(contrib/voro++)
add_compile_definitions("ALL_VORONOI_ACTIVE")
endif() endif()
set(STB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/stb) set(STB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/stb)
......
...@@ -38,6 +38,7 @@ build_all () { ...@@ -38,6 +38,7 @@ build_all () {
cmake --install "$ALL_BUILD_DIR" cmake --install "$ALL_BUILD_DIR"
if [[ $ALL_INSTALL_DIR != $ALL_PACKAGE ]] if [[ $ALL_INSTALL_DIR != $ALL_PACKAGE ]]
then then
rm -rf "$ALL_PACKAGE"
mv "$ALL_INSTALL_DIR" "$ALL_PACKAGE" mv "$ALL_INSTALL_DIR" "$ALL_PACKAGE"
fi fi
} }
......
...@@ -50,7 +50,7 @@ do ...@@ -50,7 +50,7 @@ do
DEFINES="$DEFINES -D$d" DEFINES="$DEFINES -D$d"
done done
gcc -E -fdirectives-only $DEFINES -o ALL.ii ALL.hpp cpp -undef -fdirectives-only $DEFINES -o ALL.ii ALL.hpp
mkdir -p "${OUTFILE%/*}" mkdir -p "${OUTFILE%/*}"
cat ALL.ii | sed -e 's!// PPIGNORE <!#include <!' > "$OUTFILE" cat ALL.ii | sed -e 's!// PPIGNORE <!#include <!' > "$OUTFILE"
......
...@@ -17,9 +17,11 @@ add_library (ALL ALL.cpp ALL_fortran.cpp ${ALL_HEADER_FILES}) ...@@ -17,9 +17,11 @@ add_library (ALL ALL.cpp ALL_fortran.cpp ${ALL_HEADER_FILES})
if(CM_ALL_VTK_OUTPUT) if(CM_ALL_VTK_OUTPUT)
target_include_directories(ALL PUBLIC ${VTK_INCLUDE_DIRS}) target_include_directories(ALL PUBLIC ${VTK_INCLUDE_DIRS})
target_link_libraries(ALL PUBLIC ${VTK_LIBRARIES}) target_link_libraries(ALL PUBLIC ${VTK_LIBRARIES})
target_compile_definitions(ALL PUBLIC ALL_VTK_OUTPUT)
endif(CM_ALL_VTK_OUTPUT) endif(CM_ALL_VTK_OUTPUT)
if(CM_ALL_VORONOI) if(CM_ALL_VORONOI)
target_link_libraries(ALL PUBLIC voro) target_link_libraries(ALL PUBLIC voro)
target_compile_definitions(ALL PUBLIC ALL_VORONOI_ACTIVE)
endif(CM_ALL_VORONOI) endif(CM_ALL_VORONOI)
target_include_directories(ALL PUBLIC ${MPI_CXX_INCLUDE_PATH}) target_include_directories(ALL PUBLIC ${MPI_CXX_INCLUDE_PATH})
...@@ -40,16 +42,8 @@ install(TARGETS ALL ...@@ -40,16 +42,8 @@ install(TARGETS ALL
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
INCLUDES DESTINATION include) INCLUDES DESTINATION include)
get_property(_glob_comp_def DIRECTORY PROPERTY COMPILE_DEFINITIONS) install(FILES ${ALL_HEADER_FILES}
add_custom_command( DESTINATION include)
TARGET ALL
PRE_BUILD
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../misc/preprocess.sh ${ALL_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../include/ALL.hpp ${_glob_comp_def}
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../include/ALL.hpp DESTINATION include)
#install(FILES ${ALL_HEADER_FILES}
# DESTINATION include)
if (CM_ALL_FORTRAN) if (CM_ALL_FORTRAN)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../modules) set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../modules)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment