Re: [CMake] CMake/CPack/NSIS

2008-04-18 Thread Alin M Elena
Here is the attach

 

Alin

 



...if the universities will not study useless subjects, who will?

   G. F. Fitzgerald, Nature, 45/46, 392 (1892)

__

Mr. Alin M. ELENA

Atomistic Simulation Centre

School of Mathematics and Physics

Queen's University Belfast

Office: +44 (0)28 9097 1428

Fax: +44 (0)28 9097 5359

http://titus.phy.qub.ac.uk/group/Alin/

[EMAIL PROTECTED]

[EMAIL PROTECTED]

__

 

project(aten)


set(DESCRIPTION Aten - Atomic configuration builder and editor)
set(AUTHOR Tristan Youngs)
set(VERSION_MAJOR 0)
set(VERSION_MINOR 96)
set(VERSION_PATCH 1)

set(CMAKE_BUILD_TYPE Release)

cmake_minimum_required(VERSION 2.4.8)
if(COMMAND cmake_policy)
  cmake_policy(VERSION 2.6)
endif(COMMAND cmake_policy)

set (target_name aten)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
find_package(Qt4 REQUIRED) # find and setup Qt4 for this project
find_package(READLINE REQUIRED)
IF(WIN32 OR APPLE)
find_package(OPENGL REQUIRED)
endif(WIN32 OR APPLE)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(SRCS src/)
#ADD_DEFINITIONS(-DQT_SHARED)

# tell cmake to process CMakeLists.txt in that subdirectory
add_subdirectory(${SRCS})

If(APPLE)
  set( MACOSX_BUNDLE_ICON_FILE  {CMAKE_SOURCE_DIR}/src/gui/icons/aten.png)
  set(MACOSX_BUNDLE_GUI_IDENTIFIER  Aten)
  set(MACOSX_BUNDLE_LONG_VERSION_STRING 0.x.0  )
  set(MACOSX_BUNDLE_BUNDLE_NAME  aten )
  set(MACOSX_BUNDLE_SHORT_VERSION_STRING 0.+)
  set(MACOSX_BUNDLE_BUNDLE_VERSION  almost 1)
  set(MACOSX_BUNDLE_COPYRIGHT Tristan Youngs)
endif(APPLE)

include_directories(
${CMAKE_SOURCE_DIR} 
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src
${SRCS}/templates/
${SRCS}/
${QT_INCLUDE_DIR}
${READLINE_INCLUDE_DIR}
)
add_executable(${target_name} MACOSX_BUNDLE
${SRCS}/main.cpp
)


link_directories (${LIBRARY_OUTPUT_PATH})
IF(WIN32 OR APPLE)
target_link_libraries(${target_name} 
gui base command render methods model
sg parse classes energy fourier math
${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES} ${QT_QTGUI_LIBRARY} 
${QT_QTCORE_LIBRARY}
${READLINE_LIBRARY}
)
ELSE(WIN32 OR APPLE)
target_link_libraries(${target_name} 
gui base command render methods model 
sg parse classes energy fourier math
${QT_QTOPENGL_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
${READLINE_LIBRARY}
)
ENDIF(WIN32 OR APPLE)


install target


if(NOT ${PREFIX})
MESSAGE(Install folder ${PREFIX})
set(CMAKE_INSTALL_PREFIX ${PREFIX})
endif(NOT ${PREFIX})

install(TARGETS ${target_name}
  RUNTIME DESTINATION bin
)

install(DIRECTORY  ${CMAKE_HOME_DIRECTORY}/data/ 
 DESTINATION share/aten
 REGEX .svn EXCLUDE
)

if(WIN32)
FIND_FILE(Rline readline5.dll ENV PATH)
FIND_FILE(HRline history5.dll ENV PATH)
Find_File(qtgui QtGui4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtgl QtOpenGL4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtcore QtCore4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtsvg QtSvg4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtxml QtXml4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qsvg qsvg4.dll PATHS ${QT_PLUGINS_DIR}/iconengines NO_DEFAULT_PATH)
install(FILES ${qtgui} ${qtgl} ${qtcore} ${Rline} ${HRline} ${qtsvg} ${qtxml}
DESTINATION bin
)
install(FILES ${qsvg} 
DESTINATION bin/iconengines
)


ENDIF(WIN32)


###
## uninstall target
###

CONFIGURE_FILE(
  ${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in
  ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
  IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
  ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
###

INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${DESCRIPTION})
SET(CPACK_PACKAGE_VENDOR ${AUTHOR})
SET(CPACK_PACKAGE_CONTACT ${CPACK_PACKAGE_VENDOR})
SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
SET(CPACK_PACKAGE_INSTALL_DIRECTORY aten${VERSION_MAJOR}.${VERSION_MINOR})
IF(WIN32)
  # There is a bug in NSI that does not handle full unix paths properly. Make
  # sure there is at least one set of four (4) backlasshes.
  set(CPACK_NSIS_MUI_ICON 
${CMAKE_CURRENT_SOURCE_DIR}/src/gui/iconsaten.ico)
  set(CPACK_NSIS_MUI_UNIICON 
${CMAKE_CURRENT_SOURCE_DIR}/src/gui/iconsuninstall.ico)
  SET(CPACK_PACKAGE_ICON 
${CMAKE_CURRENT_SOURCE_DIR}/src/gui/iconsaten.bmp)
  SET(CPACK_NSIS_INSTALLED_ICON_NAME binaten.exe)  
  SET(CPACK_NSIS_DISPLAY_NAME ${CPACK_PACKAGE_INSTALL_DIRECTORY} Aten)
  

Re: [CMake] CMake-CPack-NSIS

2008-04-08 Thread Eric Noulard
2008/4/8, Alin M Elena [EMAIL PROTECTED]:




 Hi,



  I want to setup a variable(TestVar) on windows when I use NSIS
 using cmake/cpack.

 A small example is presented here


 http://nsis.sourceforge.net/Setting_Environment_Variables



The idea is that the project.nsi which is created by cmake already sets a
 variable PATH.

Can I reuse some of the functions already defined there?



   I suspect that everything should be added using
 CPACK_NSIS_EXTRA_(UN)INSTALL_COMMANDS

   I see the plural form of the commands. Can you pass more commands? How do
 you separate them?

I do set CPACK_NSIS_EXTRA_INSTALL_COMMANDS with embedded
newlines which works:

SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS 
ExecWait
\\\$INSTDIRexternaloncrpcbininst_pm.exe remove\\\
CopyFiles
\\\$INSTDIRexternaloncrpcbinoncrpc.dll\\\
\\\$SYSDIR\\\
CopyFiles
\\\$INSTDIRexternaloncrpcbinportmap.exe\\\
\\\$SYSDIR\\\
CreateDirectory \\\$SYSDIRdriversetc\\\
CopyFiles 
\\\$INSTDIRexternaloncrpcetcrpc\\\
\\\$SYSDIRdriversetc\\\
ExecWait
\\\$INSTDIRexternaloncrpcbininst_pm.exe
$SYSDIRportmap.exe\\\

look at:
http://cvs.savannah.nongnu.org/viewvc/tsp/CMakeLists.txt?root=tspview=markup

for properly indented CMakeLists.txt example.

I do encounter a limit in size problem with
CPACK_NSIS_EXTRA_INSTALL_COMMANDS
if I try to set it with a string which is longer than X character
the var content is truncated to X.

I'm not sure but I think X is about 255.

-- 
Erk
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] CMake-CPack-NSIS

2008-04-08 Thread Eric Noulard
2008/4/8, Alin M Elena [EMAIL PROTECTED]:
 Thanks Eric,


  I reformulate the problem.

   I want to setup a variable(TestVar) on windows when I use
  NSIS
   using cmake/cpack.

   A small example is presented here
   http://nsis.sourceforge.net/Setting_Environment_Variables

 I suspected that the solution will be a combination of the info given above
  and

 CPACK_NSIS_EXTRA_(UN)INSTALL_COMMANDS


 This model does not work because the extra commands get added in their
  sections
  And adding defining a function can be done only outside the section
  environment.

OK I see.


  Any ideas?

NSIS CPack generator use the following templates:

CMAKE/share/cmake-2.x/Modules/NSIS.InstallOptions.ini.in
CMAKE/share/cmake-2.x/Modules/NSIS.template.in

You may replace those template using you own template
which may contains more user-defined CMake variables
(in the appropriate section) which may be replaced by CMake.

If you add your template in your custom module Path
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

it should work (not tested though :-)
-- 
Erk
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] CMake-CPack-NSIS

2008-04-08 Thread Alin M Elena
Hi Eric,

Thanks. That's the idea it worked.

Alin



-Original Message-
From: Eric Noulard [mailto:[EMAIL PROTECTED] 
Sent: 08 April 2008 19:57
To: [EMAIL PROTECTED]
Cc: CMake ML
Subject: Re: [CMake] CMake-CPack-NSIS

2008/4/8, Alin M Elena [EMAIL PROTECTED]:
 Thanks Eric,


  I reformulate the problem.

   I want to setup a variable(TestVar) on windows when I use
  NSIS
   using cmake/cpack.

   A small example is presented here
   http://nsis.sourceforge.net/Setting_Environment_Variables

 I suspected that the solution will be a combination of the info given
above
  and

 CPACK_NSIS_EXTRA_(UN)INSTALL_COMMANDS


 This model does not work because the extra commands get added in their
  sections
  And adding defining a function can be done only outside the section
  environment.

OK I see.


  Any ideas?

NSIS CPack generator use the following templates:

CMAKE/share/cmake-2.x/Modules/NSIS.InstallOptions.ini.in
CMAKE/share/cmake-2.x/Modules/NSIS.template.in

You may replace those template using you own template
which may contains more user-defined CMake variables
(in the appropriate section) which may be replaced by CMake.

If you add your template in your custom module Path
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

it should work (not tested though :-)
-- 
Erk

___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake