diff --git a/CMakeLists.txt b/CMakeLists.txt index 009dfee29..ae14e8a37 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set(VERSION_PATCH "0") set(CMAKE_BUILD_TYPE "Release") -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 2.8.12) if(COMMAND cmake_policy) cmake_policy(VERSION 2.6) @@ -77,8 +77,8 @@ if(APPLE) find_package(GLUT REQUIRED) endif(APPLE) -set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) -set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) set(SRCS src/) # Set bundle info @@ -92,19 +92,17 @@ If(APPLE) set(MACOSX_BUNDLE_COPYRIGHT "${AUTHOR}") endif(APPLE) -# Set include directories -include_directories( - ${CMAKE_BINARY_DIR}/src - ${CMAKE_SOURCE_DIR}/src - ${CMAKE_SOURCE_DIR}/src/gui - ${Qt5Widgets_INCLUDE_DIRS} - ${Qt5OpenGL_INCLUDE_DIRS} - ${Qt5Core_INCLUDE_DIRS} - ${Qt5Gui_INCLUDE_DIRS} - ${FTGL_INCLUDE_DIRS} - ${FREETYPE_INCLUDE_DIRS} - ${GLEXT_INCLUDES} -) +### htese shall go once is confirmed all is kosher +#include_directories( +# ${CMAKE_BINARY_DIR}/src +# ${Qt5Widgets_INCLUDE_DIRS} +# ${Qt5OpenGL_INCLUDE_DIRS} +# ${Qt5Core_INCLUDE_DIRS} +# ${Qt5Gui_INCLUDE_DIRS} +# ${FTGL_INCLUDE_DIRS} +# ${FREETYPE_INCLUDE_DIRS} +# ${GLEXT_INCLUDES} +#) # Process CMakeLists in subdirs add_subdirectory(${SRCS}) @@ -113,9 +111,13 @@ add_executable(${target_name} MACOSX_BUNDLE ${SRCS}/main.cpp ) - +target_include_directories(${target_name} PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src + ${PROJECT_SOURCE_DIR}/src/gui +) # Perform final link -link_directories (${LIBRARY_OUTPUT_PATH}) +#link_directories (${LIBRARY_OUTPUT_PATH}) IF(WIN32) set(ATEN_LINK_LIBS Qt5::Widgets Qt5::Core ${FTGL_LIBRARIES} ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} C:/GnuWin32/lib/libreadline.dll.a) ELSEIF(APPLE) @@ -129,3 +131,15 @@ target_link_libraries( ${target_name} ${ATEN_LINK_LIBS} ) +if(UNIX AND NOT APPLE) + INSTALL_TARGET(${target_name} "") + configure_file(${PROJECT_SOURCE_DIR}/desktop.cmake Aten.desktop) + install(FILES ${PROJECT_SOURCE_DIR}/src/gui/icons/aten.png + DESTINATION share/aten) + install(FILES ${PROJECT_BINARY_DIR}/Aten.desktop + DESTINATION share/applications) + foreach(i ff filters fftesting fragments partitions scripts test includes) + install(DIRECTORY ${PROJECT_SOURCE_DIR}/data/${i} + DESTINATION share/aten) + endforeach(i) +endif(UNIX AND NOT APPLE) diff --git a/desktop.cmake b/desktop.cmake index 541d22fd0..74eee170e 100644 --- a/desktop.cmake +++ b/desktop.cmake @@ -1,5 +1,5 @@ [Desktop Entry] -Version=@VERSION_MAJOR@.@VERSION_MINOR@ +Version=1.0 Encoding=UTF-8 Comment=@DESCRIPTION@ Exec=aten %f @@ -9,4 +9,5 @@ Name=Aten StartupNotify=false Terminal=0 Type=Application -Categories=Applications +Categories=Qt;Science;Chemistry;Physics;Math;Education; +MimeType=chemical/x-cml;chemical/x-xyz; diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index e1e0848ac..ca5cfffbf 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -75,17 +75,20 @@ add_library(base zmatrix.h zmatrixelement.h ) +target_include_directories(base PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} +) add_library(fourierdata fourierdata.cpp fourierdata.h ) -include_directories( - ../ - ${QT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}/src - ${CMAKE_SOURCE_DIR}/src/gui +target_include_directories(fourierdata PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} ) diff --git a/src/command/CMakeLists.txt b/src/command/CMakeLists.txt index cb0670bab..2cc3d43b6 100644 --- a/src/command/CMakeLists.txt +++ b/src/command/CMakeLists.txt @@ -39,12 +39,13 @@ trajectory.cpp transform.cpp view.cpp ) - -include_directories( -../ -${QT_INCLUDE_DIR} -${CMAKE_SOURCE_DIR} -${CMAKE_BINARY_DIR} -${CMAKE_BINARY_DIR}/src -${CMAKE_SOURCE_DIR}/src/gui +target_include_directories(command PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/src/gui ) + +target_link_libraries(command gui) diff --git a/src/ff/CMakeLists.txt b/src/ff/CMakeLists.txt index 06d93ef17..14cd2b818 100644 --- a/src/ff/CMakeLists.txt +++ b/src/ff/CMakeLists.txt @@ -18,12 +18,8 @@ add_library(ff torsion.cpp vdw.cpp ) - -include_directories( -../ -${QT_INCLUDE_DIR} -${CMAKE_BINARY_DIR} -${CMAKE_SOURCE_DIR} -${CMAKE_BINARY_DIR}/src +target_include_directories(ff PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${Qt5Gui_INCLUDE_DIRS} ) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index db4a4a1f3..20f55f578 100755 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -1,15 +1,5 @@ # Don't forget to include output directory, otherwise # the UI file won't be wrapped! -INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/../ - ${Qt5Widgets_INCLUDE_DIRS} - ./ - ../ - ${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} -) - # Meta-Objects SET(gui_MOC_HDRS command.h @@ -288,6 +278,11 @@ add_library(gui ${gui_SRCS} ${gui_MOC_SRCS} ) +target_include_directories(gui PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src + ${Qt5Widgets_INCLUDE_DIRS} +) # Target 'treegui' add_library(treegui @@ -295,4 +290,9 @@ add_library(treegui ${treegui_MOC_SRCS} treegui_funcs.cpp ) - +target_include_directories(treegui PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src + ${Qt5Widgets_INCLUDE_DIRS} +) +target_link_libraries(treegui gui) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 6aea2e362..7d4b16a0d 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -17,11 +17,12 @@ add_library(main probe.cpp scripts.cpp ) - -include_directories( -./ -../ -${QT_INCLUDE_DIR} -${CMAKE_SOURCE_DIR}/src/gui -${CMAKE_BINARY_DIR} -${CMAKE_BINARY_DIR}/src/) +target_include_directories(main PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/src/gui +) +target_link_libraries(main gui) diff --git a/src/math/CMakeLists.txt b/src/math/CMakeLists.txt index 9d925995b..4334ed32a 100644 --- a/src/math/CMakeLists.txt +++ b/src/math/CMakeLists.txt @@ -9,12 +9,8 @@ add_library(math mathfunc.h matrix.h ) - -include_directories( -../ -${QT_INCLUDE_DIR} -${CMAKE_SOURCE_DIR} -${CMAKE_BINARY_DIR} -${CMAKE_BINARY_DIR}/src -${CMAKE_SOURCE_DIR}/src/gui +target_include_directories(math PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} ) diff --git a/src/methods/CMakeLists.txt b/src/methods/CMakeLists.txt index 91d966bf3..da951d507 100644 --- a/src/methods/CMakeLists.txt +++ b/src/methods/CMakeLists.txt @@ -27,11 +27,9 @@ add_library(methods rdf.cpp sd.cpp ) - -include_directories( -../ -${QT_INCLUDE_DIR} -${CMAKE_BINARY_DIR} -${CMAKE_SOURCE_DIR}/src/gui -${CMAKE_BINARY_DIR}/src +target_include_directories(methods PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} ) + diff --git a/src/model/CMakeLists.txt b/src/model/CMakeLists.txt index df2581cbf..e7dbf8ea4 100644 --- a/src/model/CMakeLists.txt +++ b/src/model/CMakeLists.txt @@ -40,11 +40,8 @@ add_library(model view.cpp zmatrix.cpp ) - -include_directories( -../ -${QT_INCLUDE_DIR} -${CMAKE_SOURCE_DIR} -${CMAKE_BINARY_DIR} -${CMAKE_BINARY_DIR}/src +target_include_directories(model PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${Qt5Gui_INCLUDE_DIRS} ) + diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index 55b78ad7d..305ddea3d 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -110,12 +110,13 @@ widget.cpp zmatrix.cpp zmatrixelement.cpp ) - -include_directories( -../ -${QT_INCLUDE_DIR} -${CMAKE_SOURCE_DIR} -${CMAKE_BINARY_DIR} -${CMAKE_BINARY_DIR}/src -${CMAKE_SOURCE_DIR}/src/gui +target_include_directories(parser PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/src/gui ) + +target_link_libraries(parser gui) diff --git a/src/render/CMakeLists.txt b/src/render/CMakeLists.txt index f3ff0dc6a..87bb83e90 100644 --- a/src/render/CMakeLists.txt +++ b/src/render/CMakeLists.txt @@ -27,10 +27,10 @@ add_library(render textprimitivelist.cpp ) -include_directories( -../ -${QT_INCLUDE_DIR} -${CMAKE_SOURCE_DIR} -${CMAKE_BINARY_DIR} -${CMAKE_BINARY_DIR}/src +target_include_directories(render PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} + ${FREETYPE_INCLUDE_DIRS} ) diff --git a/src/sg/CMakeLists.txt b/src/sg/CMakeLists.txt index 6f6608ff1..9a38776a0 100644 --- a/src/sg/CMakeLists.txt +++ b/src/sg/CMakeLists.txt @@ -10,12 +10,9 @@ add_library(sg sgsi.c spacegroup.cpp ) - -include_directories( - ../ - ${QT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}/src - ${CMAKE_SOURCE_DIR}/src/gui +target_include_directories(sg PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} ) +