Skip to content

Commit

Permalink
[cmake] add mopac options to cmake, also deal more elegantly with the…
Browse files Browse the repository at this point in the history
… c++11 need
  • Loading branch information
alinelena committed Dec 4, 2016
1 parent 3a341fc commit 7a1f543
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 27 deletions.
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set(AUTHOR "Tristan Youngs")
set(VERSION_MAJOR "2")
set(VERSION_MINOR "1")
set(VERSION_PATCH "5")

set(CMAKE_BUILD_TYPE "Release")

cmake_minimum_required(VERSION 2.8.12)
Expand All @@ -24,6 +23,8 @@ include(FindBISON)
include(FindFTGL)
include(FindGLEXT)

use_cxx11()

# Find required packages for this project
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)
Expand All @@ -48,10 +49,9 @@ CMAKE_POLICY(SET CMP0020 NEW)

# Options
# -- MOPAC7 Plugin (requires Fortran)
option(MOPACPLUGIN "Enable compilation of MOPAC7 method plugin" OFF)
if(MOPACPLUGIN)
if(BUILD_MOPACPLUGIN)
enable_language(Fortran)
endif(MOPACPLUGIN)
endif()

# Perform system-specific setup
# -- Windows
Expand All @@ -64,9 +64,6 @@ if(WIN32)
${GLEXT_INCLUDE_DIRS}
)

# Set some specific C++11 related options here (set_property below does not seem to persist)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

# Set plugin link libraries
SET(PLUGIN_LINK_LIBS
aten
Expand All @@ -85,6 +82,7 @@ endif(WIN32)
# -- Unix
if(UNIX)
set (target_name aten)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif(UNIX)

# -- OSX
Expand All @@ -95,7 +93,7 @@ if(APPLE)
ADD_DEFINITIONS(-D_MAC)

# Set some specific C++11 related options here (set_property below does not seem to persist)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")

# Find OpenGL and GLUT
find_package(GLUT REQUIRED)
Expand Down
38 changes: 23 additions & 15 deletions cmake/Modules/DefineFunctions.cmake
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
function(INSTALL_TARGET _TAR _TAR_PUBLIC_HEADERS)
install(TARGETS
${_TAR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(TARGETS
${_TAR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

foreach(header ${${_TAR_PUBLIC_HEADERS}})
file(RELATIVE_PATH relative_path ${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/${header})
get_filename_component(directories ${relative_path} DIRECTORY)
install(FILES
${header}
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/aten/${directories}
)
endforeach()
foreach(header ${${_TAR_PUBLIC_HEADERS}})
file(RELATIVE_PATH relative_path ${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/${header})
get_filename_component(directories ${relative_path} DIRECTORY)
install(FILES
${header}
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/aten/${directories}
)
endforeach()
endfunction(INSTALL_TARGET)

macro(use_cxx11)
if (CMAKE_VERSION VERSION_LESS "3.1")
message(WARNING "Be sure you add c++11 support to your compiler")
else ()
set (CMAKE_CXX_STANDARD 11)
endif ()
endmacro(use_cxx11)
1 change: 1 addition & 0 deletions cmake/Modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(BUILD_MOPACPLUGIN "Enable compilation of MOPAC7 method plugin" OFF)
8 changes: 4 additions & 4 deletions src/plugins/method_mopac71/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if(MOPACPLUGIN)
if(BUILD_MOPACPLUGIN)

#
# Main MOPAC 7.1 Method Plugin
Expand Down Expand Up @@ -77,7 +77,7 @@ set(mopac71opt_MOC_HDRS
QT5_WRAP_CPP(mopac71opt_MOC_SRCS ${mopac71opt_MOC_HDRS} OPTIONS -I${PROJECT_SOURCE_DIR}/src)

SET(mopac71opt_UIS
opttoptions.ui
optoptions.ui
)
QT5_WRAP_UI(mopac71opt_UIS_H ${mopac71opt_UIS})

Expand All @@ -94,7 +94,7 @@ set_target_properties(mopac71opt PROPERTIES
COMPILE_DEFINITIONS "QT_PLUGIN"
PREFIX ""
)

target_link_libraries(mopac71opt mopac71f90)
target_include_directories(mopac71opt PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src
Expand All @@ -118,4 +118,4 @@ endif(UNIX AND NOT APPLE)
#
add_subdirectory(mopac7.1)

endif(MOPACPLUGIN)
endif()
8 changes: 8 additions & 0 deletions src/plugins/method_mopac71/mopac7.1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set(mopac71_SRC
vastkind.f90 permanent_arrays.f90 analyt_C.f90 chanel_C.f90 conref_C.f90 cosmo_C.f90 ef_C.f90 elemts_C.f90 esp_C.f90 euler_C.f90 funcon_C.f90 iter_C.f90 maps_C.f90 meci_C.f90 mndod_C.f90 molkst_C.f90 molmec_C.f90 overlaps_C.f90 parameters_C.f90 parameters_for_AM1_C.f90 parameters_for_mndo_C.f90 parameters_for_mndod_C.f90 parameters_for_pm3_C.f90 pmep_C.f90 polar_C.f90 refkey_C.f90 refs_C.f90 rotate_C.f90 symmetry_C.f90
aababc_I.f90 aabacd_I.f90 aabbcd_I.f90 addfck_I.f90 addhcr_I.f90 addnuc_I.f90 aijm_I.f90 aintgs_I.f90 alphaf_I.f90 analyt_I.f90 anavib_I.f90 asum_I.f90 aval_I.f90 axis_I.f90 babbbc_I.f90 babbcd_I.f90 bangle_I.f90 bdenin_I.f90 bdenup_I.f90 beopor_I.f90 betaf_I.f90 betal1_I.f90 betall_I.f90 betcom_I.f90 bfn_I.f90 bintgs_I.f90 bldsym_I.f90 bmakuf_I.f90 bonds_I.f90 break_I.f90 brlzon_I.f90 btoc_I.f90 calpar_I.f90 capcor_I.f90 cartab_I.f90 ccprod_I.f90 ccrep_I.f90 cdiag_I.f90 charg_I.f90 charmo_I.f90 charst_I.f90 charvi_I.f90 chi_I.f90 chrge_I.f90 ciint_I.f90 ciosci_I.f90 cnvg_I.f90 coe_I.f90 collid_I.f90 collis_I.f90 compfg_I.f90 compfn_I.f90 consts_I.f90 copym_I.f90 cqden_I.f90 csum_I.f90 dang_I.f90 darea1_I.f90 daread_I.f90 dasum_I.f90 datin_I.f90 dawrit_I.f90 dawrt1_I.f90 daxpy_I.f90 dcart_I.f90 dcopy_I.f90 ddot_I.f90 ddpo_I.f90 delmol_I.f90 delri_I.f90 delta_I.f90 denrot_I.f90 densf_I.f90 densit_I.f90 deri0_I.f90 deri1_I.f90 deri21_I.f90 deri22_I.f90 deri23_I.f90 deri2_I.f90 deritr_I.f90 deriv_I.f90 dernvo_I.f90 ders_I.f90 dex2_I.f90 dfield_I.f90 dfock2_I.f90 dfockd_I.f90 dfpsav_I.f90 dgedi_I.f90 dgefa_I.f90 dgemm_I.f90 dgemv_I.f90 dger_I.f90 dgetf2_I.f90 dgetrf_I.f90 dgetri_I.f90 dhc_I.f90 dhcore_I.f90 diag_I.f90 diagi_I.f90 diat2_I.f90 diat_I.f90 diegrd_I.f90 dielen_I.f90 digit_I.f90 dihed_I.f90 dijkl1_I.f90 dijkl2_I.f90 dijkld_I.f90 dimens_I.f90 dipole_I.f90 dist2_I.f90 dlaswp_I.f90 dmecip_I.f90 dnrm2_I.f90 dofs_I.f90 dopen_I.f90 dot_I.f90 drc_I.f90 drcout_I.f90 drepp2_I.f90 drotat_I.f90 dscal_I.f90 dsum_I.f90 dswap_I.f90 dtran2_I.f90 dtrans_I.f90 dtrmm_I.f90 dtrmv_I.f90 dtrsm_I.f90 dtrti2_I.f90 dtrtri_I.f90 dvfill_I.f90 ef_I.f90 efsav_I.f90 efstr_I.f90 einvit_I.f90 eiscor_I.f90 elau_I.f90 elenuc_I.f90 elesn_I.f90 en_I.f90 enpart_I.f90 epsab_I.f90 epseta_I.f90 epslon_I.f90 eqlrat_I.f90 esn_I.f90 esp1_I.f90 espfit_I.f90 estpi1_I.f90 etrbk3_I.f90 etred3_I.f90 evvrsp_I.f90 exchng_I.f90 fbx_I.f90 fcnpp_I.f90 ffreq1_I.f90 ffreq2_I.f90 fhpatn_I.f90 flepo_I.f90 fmat_I.f90 fock1_I.f90 fock2_I.f90 fockd1_I.f90 fockd2_I.f90 force_I.f90 fordd_I.f90 formd_I.f90 formxd_I.f90 formxy_I.f90 frame_I.f90 freda_I.f90 freqcy_I.f90 fsub_I.f90 genun_I.f90 genvec_I.f90 geoutg_I.f90 geout_I.f90 getgeg_I.f90 getgeo_I.f90 gethes_I.f90 getsym_I.f90 gettxt_I.f90 getval_I.f90 gmetry_I.f90 gover_I.f90 grid_I.f90 grids_I.f90 gstore_I.f90 h1elec_I.f90 haddon_I.f90 hcored_I.f90 hcore_I.f90 helect_I.f90 hmuf_I.f90 hplusf_I.f90 idamax_I.f90 ilaenv_I.f90 inid_I.f90 inighd_I.f90 initsn_I.f90 initsv_I.f90 insymc_I.f90 interp_I.f90 intfc_I.f90 ird_I.f90 iten_I.f90 iter_I.f90 jab_I.f90 jcarin_I.f90 kab_I.f90 linmin_I.f90 local_I.f90 locmin_I.f90 lsame_I.f90 makeuf_I.f90 makopr_I.f90 maksym_I.f90 mamult_I.f90 mat33_I.f90 matou1_I.f90 matout_I.f90 me08a_I.f90 mecid_I.f90 mecih_I.f90 meci_I.f90 mecip_I.f90 mepchg_I.f90 mepmap_I.f90 meprot_I.f90 minv_I.f90 mlig_I.f90 molsym_I.f90 molval_I.f90 mopend_I.f90 mpcbds_I.f90 mpcpop_I.f90 mpcsyb_I.f90 mtxmc_I.f90 mtxm_I.f90 mullik_I.f90 mult33_I.f90 mult_I.f90 mxm_I.f90 mxmt_I.f90 myword_I.f90 naican_I.f90 naicas_I.f90 ngamtg_I.f90 ngefis_I.f90 ngidri_I.f90 ngoke_I.f90 nllsn_I.f90 nllsq_I.f90 nonbet_I.f90 nonope_I.f90 nonor_I.f90 nuchar_I.f90 openda_I.f90 orient_I.f90 osinv_I.f90 overlp_I.f90 ovlp_I.f90 packp_I.f90 parsav_I.f90 partxy_I.f90 pathk_I.f90 paths_I.f90 pdgrid_I.f90 perm_I.f90 plato_I.f90 pmep1_I.f90 pmepco_I.f90 pmep_I.f90 poij_I.f90 polar_I.f90 potcal_I.f90 powsav_I.f90 powsq_I.f90 printp_I.f90 prjfc_I.f90 prtdrc_I.f90 prthco_I.f90 prthes_I.f90 prtpar_I.f90 prttim_I.f90 pulay_I.f90 quadr_I.f90 react1_I.f90 reada_I.f90 readmo_I.f90 redatm_I.f90 refer_I.f90 reppd2_I.f90 reppd_I.f90 repp_I.f90 resolv_I.f90 rijkl_I.f90 rotatd_I.f90 rotate_I.f90 rotat_I.f90 rotmat_I.f90 rotmol_I.f90 rsc_I.f90 rsp_I.f90 schmib_I.f90 schmit_I.f90 scprm_I.f90 search_I.f90 second_I.f90 set_I.f90 setup3_I.f90 setupg_I.f90 solrot_I.f90 sort_I.f90 spcore_I.f90 spline_I.f90 ss_I.f90 suma2_I.f90 supdot_I.f90 superd_I.f90 surfac_I.f90 surfa_I.f90 swap_I.f90 symdec_I.f90 symh_I.f90 symoir_I.f90 symopr_I.f90 symp_I.f90 sympop_I.f90 symr_I.f90 symt_I.f90 symtry_I.f90 symtrz_I.f90 tf_I.f90 thermo_I.f90 time_I.f90 timer_I.f90 timout_I.f90 transf_I.f90 trsub_I.f90 trudgu_I.f90 trugdu_I.f90 trugud_I.f90 tx_I.f90 upcase_I.f90 update_I.f90 updhes_I.f90 vecprt_I.f90 volume_I.f90 w2mat_I.f90 worder_I.f90 wrdkey_I.f90 writmo_I.f90 wrtkey_I.f90 wrttxt_I.f90 wstore_I.f90 wwstep_I.f90 xerbla_I.f90 xxx_I.f90 xyzcry_I.f90 xyzgeo_I.f90 xyzint_I.f90 zerom_I.f90
aababc.f90 aabacd.f90 aabbcd.f90 aintgs.f90 analyt.f90 anavib.f90 axis.f90 babbbc.f90 babbcd.f90 bangle.f90 bfn.f90 bintgs.f90 blas.f90 bldsym.f90 bonds.f90 brlzon.f90 calpar.f90 capcor.f90 cartab.f90 charmo.f90 charst.f90 charvi.f90 chi.f90 chrge.f90 ciosci.f90 cnvg.f90 coe.f90 compfg.f90 cosmo.f90 dang.f90 datin.f90 dcart.f90 denrot.f90 densit.f90 deri0.f90 deri1.f90 deri21.f90 deri22.f90 deri23.f90 deri2.f90 deritr.f90 deriv.f90 dernvo.f90 dfield.f90 dfock2.f90 dfpsav.f90 dhc.f90 dhcore.f90 diag.f90 diagi.f90 diat.f90 digit.f90 dihed.f90 dijkl1.f90 dijkl2.f90 dimens.f90 dipole.f90 dist2.f90 dofs.f90 dot.f90 drc.f90 drcout.f90 dtran2.f90 dtrans.f90 ef.f90 enpart.f90 esp.f90 exchng.f90 finish.f90 flepo.f90 fmat.f90 fock1.f90 fock2.f90 force.f90 formxy.f90 forsav.f90 frame.f90 freqcy.f90 genun.f90 geout.f90 geoutg.f90 getdat.f90 getgeg.f90 getgeo.f90 getsym.f90 gettxt.f90 getval.f90 gmetry.f90 gover.f90 grid.f90 h1elec.f90 haddon.f90 hcore.f90 helect.f90 ijkl.f90 init_filenames.f90 interp.f90 intfc.f90 iter.f90 jab.f90 jcarin.f90 kab.f90 linmin.f90 local.f90 locmin.f90 makopr.f90 maksym.f90 mamult.f90 mat33.f90 matou1.f90 matout.f90 mecid.f90 meci.f90 mecih.f90 mecip.f90 minv.f90 mndod.f90 moldat.f90 molsym.f90 molval.f90 mopacinterface.f90 mopend.f90 mpcpop.f90 mtxmc.f90 mtxm.f90 mullik.f90 mult33.f90 mult.f90 mxm.f90 mxmt.f90 myword.f90 nllsq.f90 nuchar.f90 orient.f90 osinv.f90 parsav.f90 partxy.f90 pathk.f90 paths.f90 perm.f90 plato.f90 pmep.f90 polar.f90 powsav.f90 powsq.f90 prtdrc.f90 prttim.f90 pulay.f90 quadr.f90 react1.f90 reada.f90 readmo.f90 refer.f90 repp.f90 resolv.f90 rotate.f90 rotmol.f90 rsp.f90 schmib.f90 schmit.f90 second.f90 set.f90 setupg.f90 setup_mopac_arrays.f90 solrot.f90 sort.f90 supdot.f90 superd.f90 swap.f90 switch.f90 symdec.f90 symh.f90 symoir.f90 symopr.f90 sympop.f90 symr.f90 symt.f90 symtry.f90 symtrz.f90 thermo.f90 timer.f90 timout.f90 upcase.f90 update.f90 vecprt.f90 writmo.f90 wrtkey.f90 wrttxt.f90 xxx.f90 xyzcry.f90 xyzgeo.f90 xyzint.f90
)


add_library(mopac71f90 STATIC ${mopac71_SRC})

0 comments on commit 7a1f543

Please sign in to comment.