Skip to content

Commit

Permalink
[cmake] overhaul of build system, parallel build is fixed, install ta…
Browse files Browse the repository at this point in the history
…rget only for linux, and cleanup of includes. Needs testing on MAC and Windows
  • Loading branch information
Alin Marin Elena committed Aug 6, 2015
1 parent 71b3e64 commit bdc1b61
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 105 deletions.
50 changes: 32 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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})
Expand All @@ -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)
Expand All @@ -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)
5 changes: 3 additions & 2 deletions desktop.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Desktop Entry]
Version=@VERSION_MAJOR@.@VERSION_MINOR@
Version=1.0
Encoding=UTF-8
Comment=@DESCRIPTION@
Exec=aten %f
Expand All @@ -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;
17 changes: 10 additions & 7 deletions src/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)
17 changes: 9 additions & 8 deletions src/command/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 3 additions & 7 deletions src/ff/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)

22 changes: 11 additions & 11 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -288,11 +278,21 @@ 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
${treegui_UIS_H}
${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)
17 changes: 9 additions & 8 deletions src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
12 changes: 4 additions & 8 deletions src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)
12 changes: 5 additions & 7 deletions src/methods/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)

11 changes: 4 additions & 7 deletions src/model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)

17 changes: 9 additions & 8 deletions src/parser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
12 changes: 6 additions & 6 deletions src/render/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)
13 changes: 5 additions & 8 deletions src/sg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)

0 comments on commit bdc1b61

Please sign in to comment.