Annotation of imach/CMakeLists.txt, revision 1.4

1.1       brouard     1: # if(CMAKE_CONFIGURATION_TYPES)
                      2: # #   set(CMAKE_CONFIGURATION_TYPES Debug Release DebugMX31 ReleaseMX31)
                      3: #    set(CMAKE_CONFIGURATION_TYPES Debug Release)
                      4: #    set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
                      5: #      "Reset the configurations to what we need"
                      6: #      FORCE)
                      7: #  endif()
                      8: # SET (CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebinfo" CACHE STRING "" FORCE)
                      9: SET(IMACH_VERSION_MAJOR 0)
                     10: SET(IMACH_VERSION_MINOR 98q5)
                     11: SET(IMACH_VERSION_PATCH 0)
                     12: SET(IMACH_VERSION_NOTE "")
                     13: SET(IMACH_VERSION ${IMACH_VERSION_MAJOR}.${IMACH_VERSION_MINOR})
                     14: #SET(IMACH_VERSION ${IMACH_VERSION_MAJOR}.${IMACH_VERSION_MINOR}.${IMACH_VERSION_PATCH})
                     15: #MATH(EXPR IMACH_VERSION_NUMBER "100000*${IMACH_VERSION_MAJOR} + 100*${IMACH_VERSION_MINOR} + ${IMACH_VERSION_PATCH}")
                     16: 
                     17: # #PROJECT(IMaCh${IMACH_VERSION_MAJOR})
                     18: PROJECT (IMaCh)
                     19: 
                     20: CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
                     21: 
                     22: CONFIGURE_FILE(
                     23:   "${PROJECT_SOURCE_DIR}/version.h.in"
1.2       brouard    24:   "${PROJECT_SOURCE_DIR}/src/version.h"
1.1       brouard    25:   )
                     26: CONFIGURE_FILE(
                     27:   "${PROJECT_SOURCE_DIR}/config.h.in"
                     28:   "${PROJECT_BINARY_DIR}/config.h"
                     29: )
1.4     ! brouard    30: CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/tests/mypar.imach.in" "html/doc/mypar.imach")
        !            31: CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/tests/biaspar.imach.in" "html/doc/biaspar.imach")
        !            32: CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/tests/data1.txt" "html/doc/data1.txt" COPYONLY)
        !            33: CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/tests/data/mydata.txt" "html/doc/data/mydata.txt" COPYONLY)
1.1       brouard    34: 
                     35: set (imach_SRCS ./src/imach.c)
                     36: SET( CMAKE_VERBOSE_MAKEFILE on )
                     37: ADD_EXECUTABLE ( IMaCh-${IMACH_VERSION_MAJOR}.${IMACH_VERSION_MINOR} ${imach_SRCS})
                     38: INSTALL(TARGETS IMaCh-${IMACH_VERSION_MAJOR}.${IMACH_VERSION_MINOR} DESTINATION bin COMPONENT binaries )
                     39: ADD_SUBDIRECTORY(html)
1.4     ! brouard    40: ADD_SUBDIRECTORY(tests)
1.1       brouard    41: ADD_SUBDIRECTORY(src)
                     42: ADD_SUBDIRECTORY(distributions)
                     43: #if (${WIN32})
1.3       brouard    44: #if(APPLE)
                     45: #  set(DOCDIR "${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/doc")
                     46: #endif()
1.1       brouard    47: if(UNIX)
                     48:   #   set(CMAKE_CXX_COMPILER "gcc")
                     49:   target_link_libraries(IMaCh-${IMACH_VERSION_MAJOR}.${IMACH_VERSION_MINOR} m)
                     50:   set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
                     51:   set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/doc")
                     52:   set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
                     53:   #set(EXAMPLE_CONF_DIR ${DOCDIR})
                     54:   set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
                     55:   set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/appdata")
                     56:   set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons")
                     57: endif()
                     58: if(MSVC)
1.2       brouard    59:   set(DOCDIR "${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/doc")
1.1       brouard    60:   set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
                     61:   set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
                     62:   set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
                     63:   set(CMAKE_CONFIGURATION_TYPES:STRING=Release)
                     64:   ADD_DEFINITIONS( -DCONSOLE)
                     65:   ADD_DEFINITIONS( -D_CONSOLE)
                     66: endif()
                     67: ADD_DEFINITIONS( -DCROSS=0)
                     68: 
                     69: install(FILES "html/doc/mypar.imach" DESTINATION "${DOCDIR}")
                     70: install(FILES "html/doc/data/mydata.txt" DESTINATION "${DOCDIR}/data")
                     71: install(FILES "html/doc/biaspar.imach" DESTINATION "${DOCDIR}")
                     72: install(FILES "html/doc/data1.txt" DESTINATION "${DOCDIR}")
                     73: #install(FILES "html" DESTINATION "${DOCDIR}")
                     74: 
                     75: set(CPACK_PACKAGE_VERSION ${IMACH_VERSION})
                     76: set(CPACK_PACKAGE_NAME "IMaCh")
                     77: set(CPACK_PACKAGE_RELEASE 2)
                     78: set(CPACK_PACKAGE_CONTACT "Nicolas Brouard")
                     79: set(CPACK_PACKAGE_VENDOR "INED")
                     80: SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IMaCh Interpolated Markov Chain program")
                     81: SET(CPACK_PACKAGE_VENDOR "IMaCh, INED")
                     82: SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
                     83: SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
                     84: SET(CPACK_PACKAGE_VERSION_MAJOR "${IMACH_VERSION_MAJOR}")
                     85: SET(CPACK_PACKAGE_VERSION_MINOR "${IMACH_VERSION_MINOR}")
                     86: SET(CPACK_PACKAGE_VERSION_PATCH "${IMACH_VERSION_PATCH}")
                     87: SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
                     88: #SET(CPACK_PACKAGE_EXECUTABLES "IMaCh" "IMaCh")
                     89: SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IMaCh program estimates Health Expectancies from Cross-longitudinal surveys.")
                     90: SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/imach-desc.txt")
                     91: #set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
                     92: set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}")
                     93: 
                     94: IF(WIN32 AND NOT UNIX)
                     95:   # There is a bug in NSI that does not handle full unix paths properly. Make
                     96:   # sure there is at least one set of four (4) backlasshes.
                     97:   SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
                     98:   SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\imach.exe")
                     99:   SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} IMaCh")
                    100:   SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\euroreves.ined.fr/imach/wiki")
                    101:   SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\euroreves.ined.fr/imach")
                    102:   SET(CPACK_NSIS_CONTACT "brouard@ined.fr")
                    103:   SET(CPACK_NSIS_MODIFY_PATH ON)
                    104: ELSE(WIN32 AND NOT UNIX)
                    105:   SET(CPACK_STRIP_FILES "bin/imach")
                    106:   SET(CPACK_SOURCE_STRIP_FILES "")
                    107: ENDIF(WIN32 AND NOT UNIX)
                    108: #SET(CPACK_PACKAGE_EXECUTABLES "IMaCh" "IMaCh")
                    109: INCLUDE(CPack)
                    110: 
                    111:   # set (CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "BasePlatform toolset" FORCE)
                    112:   # ADD_DEFINITIONS(-D_USING_V110_SDK71_)
                    113:   # ADD_DEFINITIONS( -D_ATL_XP_TARGETING)
                    114:   # SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE,5.01")
                    115:   # set(CMAKE_C_FLAGS "/D_CONSOLE /D_ATL_XP_TARGETING /D_UNICODE")
                    116:   #set(CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "Platform toolset" FORCE)
                    117:   #set("CMAKE_GENERATOR_TOOLSET", "vc120_xp")
                    118:   # set (CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler XE 15.0" CACHE STRING "Platform Toolset" FORCE)
                    119:   #set (CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "Platform toolset" FORCE)
                    120:   #set (CMAKE_VS_PLATFORM_TOOLSET "v120_xp" CACHE STRING "Platform toolset" FORCE)
                    121:   ##set (CMAKE_VS_PLATFORM_TOOLSET "v120_xp" CACHE STRING "BasePlatform toolset" FORCE)
                    122: 
                    123:    #https://software.intel.com/en-us/node/522398
                    124:     #    Using the msbuild.exe command line tool, use the /p:PlatformToolset and /p:BasePlatformToolset options. Example: When the Platform Toolset property is already set to use the Intel C++ compiler, to build a project using the Visual Studio 2010 environment use the following command:
                    125: 
                    126:     # Msbuild.exe myproject.vcxproj /p:BasePlatformToolset=v100
                    127: 
                    128:     # Example: To explicitly set the Platform Toolset property to use the Intel C++ compiler and build a project using the Visual Studio 2010 environment use the following command:
                    129: 
                    130:     # Msbuild.exe myproject.vcxproj /p:PlatformToolset=“Intel C++ Compiler XE 15.0” /p:BasePlatformToolset=v100
                    131:     # Msbuild.exe myproject.vcxproj /p:PlatformToolset=“Intel C++ Compiler XE 15.0” /p:BasePlatformToolset=v120_xp
                    132: # <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'" Label="Configuration">
                    133: #     <ConfigurationType>Application</ConfigurationType>
                    134: #     <UseOfMfc>false</UseOfMfc>
                    135: #     <CharacterSet>MultiByte</CharacterSet>
                    136: #     <PlatformToolset>Intel C++ Compiler XE 15.0</PlatformToolset>
                    137: #     <BasePlatformToolset>v120_xp</BasePlatformToolset>
                    138: #   </PropertyGroup>
                    139: 
                    140:    #set (BASEPLATFORMTOOLSET "v120_xp")
                    141: # set(VERSION_MAJOR "0")
                    142: # set(VERSION_MINOR "7")
                    143: 
                    144: # IF(NOT DEFINED BUILD_VERSION_PATCH)
                    145: #   set(VERSION_PATCH "0")
                    146: # else()
                    147: #   set(VERSION_PATCH "${BUILD_VERSION_PATCH}")
                    148: # ENDIF()
1.3       brouard   149: file( GLOB_RECURSE parameter_files RELATIVE
                    150: "${CMAKE_CURRENT_SOURCE_DIR}/html/doc" "html/*.imach" )
                    151: foreach( parameter_file ${parameter_files} )
                    152:   add_custom_command(
                    153:     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${parameter_file}"
                    154:     COMMAND cmake -E copy
                    155: "${CMAKE_CURRENT_SOURCE_DIR}/${parameter_file}"
                    156: "${CMAKE_CURRENT_BINARY_DIR}/${parameter_file}"
                    157:     DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${parameter_file}"
                    158:   )
                    159:   list( APPEND parameter_files_dest "${parameter_file}" )
                    160: endforeach( parameter_file )
                    161: 
                    162: #add_custom_target( CopyParameter ALL DEPENDS ${parameter_files_dest} )
1.1       brouard   163: ENABLE_TESTING()
1.3       brouard   164: ADD_SUBDIRECTORY(html/doc)
                    165: ADD_SUBDIRECTORY(html/doc/data)
                    166: install(FILES "${PROJECT_SOURCE_DIR}/html/doc/mypar.imach" DESTINATION "html/doc/mypar.imach")
1.1       brouard   167: ADD_TEST(mypar  IMaCh-${IMACH_VERSION} html/doc/mypar.imach )
                    168: ADD_TEST(biaspar  IMaCh-${IMACH_VERSION} html/doc/biaspar.imach )
                    169: #SET(FAB "po" CACHE STRING "Some user-specified option")
                    170: #set_target_properties(TARGET_NAME imach-${VERSION_MAJOR}.${VERSION_MINOR})
                    171: #%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat""
                    172: #"C:\Program Files (x86)\Intel\Composer XE 2015\bin\ipsxe-comp-vars.bat" ia32 vs2013
                    173: #"C:\Program Files (x86)\Intel\Composer XE 2015\bin\ipsxe-comp-vars.bat" intel64 vs2013
                    174: #cmake ../../src -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_RELEASE:STRING="/MD /O2 /Ob2 /D NDEBUG"
                    175: #G:\imach\imach-gui\build\icl32> msbuild IMaCh-0.98q3.vcxproj /t:Build /p:Configuration=Release
                    176: #G:\imach\imach-gui\build\vs32>"C:\Program Files (x86)\Common Files\Intel\shared files\ia32\Bin\ICProjConvert150" IMaCh.vcxproj /IC:"Intel C++ Compiler XE 15.0"
                    177: #"C:\Program Files (x86)\Common Files\Intel\shared files\ia32\Bin
                    178: ##https://tedwvc.wordpress.com/2014/01/01/how-to-target-xp-with-vc2012-or-vc2013-and-continue-to-use-the-windows-8-x-sdk/
                    179: #elseif(MSVC)
                    180: #message(FATAL_ERROR "Fatal error")
                    181: # # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
                    182: # # set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
                    183: # # set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
                    184: # # set(CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "Platform toolset" FORCE)
                    185: # # add_subdirectory(src)
                    186: # # add_subdirectory(test)
                    187: #CMAKE_CONFIGURATION_TYPES:STRING=Debug;Release;MinSizeRel;RelWithDebInfo
                    188: # # OPTION(MYPROJECT_DEBUG
                    189: # #   "Build the project using debugging code"
                    190: # #   ON)
                    191: # # IF(MYPROJECT_DEBUG)
                    192: # #   SET_SOURCE_FILE_PROPERTIES(
                    193: # #     imach.c
                    194: # #     COMPILE_FLAGS -DDEBUG)
                    195: # # ENDIF(MYPROJECT_DEBUG)
                    196: # if (${WIN32})
                    197: #   link_directories(
                    198: #   )
                    199:   
                    200: #   add_definitions(
                    201: #     -DDEFINE1
                    202: #   )
                    203: 
                    204: #   target_link_libraries(
                    205: #     ${PROJECT_NAME} 
                    206: #     wsock32.lib 
                    207: #   )
                    208: # endif()
                    209: # if(MSVC OR MSVC_IDE)
                    210: #   if( MSVC_VERSION LESS 1700 )       # VC10-/VS2010-
                    211: #     message(FATAL_ERROR "The project requires C++11 features. "
                    212: #       "You need at least Visual Studio 11 (Microsoft Visual Studio 2012), "
                    213: #       "with Microsoft Visual C++ Compiler Nov 2012 CTP (v120_CTP_Nov2012).")
                    214: #   elseif( MSVC_VERSION EQUAL 1700 )  # VC11/VS2012
                    215: #     message( "VC11: use Microsoft Visual Studio 2012 "
                    216: #       "with Microsoft Visual C++ Compiler Nov 2012 CTP (v120_CTP_Nov2012)" )
                    217: #     set(CMAKE_GENERATOR_TOOLSET "v120_CTP_Nov2012" CACHE STRING "Platform Toolset" FORCE)
                    218: #   else() # VC12+, assuming C++11 supported.
                    219: #   endif()
                    220: # endif()
                    221: # Add a target to generate API documentation with Doxygen
                    222: find_package(Doxygen)
                    223: if(DOXYGEN_FOUND)
                    224: configure_file(${CMAKE_CURRENT_SOURCE_DIR}/latex/Doxyfile.in
                    225: ${CMAKE_CURRENT_BINARY_DIR}/latex/Doxyfile @ONLY)
                    226: add_custom_target(doc
                    227: ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/latex/Doxyfile
                    228: WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/latex
                    229: COMMENT "Generating IMaCh documentation with Doxygen" VERBATIM
                    230: )
                    231: endif()

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>