cmake: set default install path, add py-compile for lyx2lyx, from Kornel

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28001 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2009-01-05 19:13:20 +00:00
parent 78a05e4359
commit 18305961ed
4 changed files with 61 additions and 4 deletions

View File

@ -32,6 +32,20 @@ set(LYX_DIR_VER "LYX_DIR_20x")
set(LYX_USERDIR_VER "LYX_USERDIR_20x")
set(PROGRAM_SUFFIX "\"\"")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# see http://www.cmake.org/pipermail/cmake/2006-October/011559.html
if (UNIX)
# don't use the default "/usr/local"
# but respect the user-choice on the command-line
SET(CMAKE_INSTALL_PREFIX
"/usr/local/share/lyx2.0" CACHE PATH "LyX install prefix" FORCE)
endif()
if(WIN32)
SET(CMAKE_INSTALL_PREFIX
${CMAKE_INSTALL_PREFIX}/2.0 CACHE PATH "LyX install prefix" FORCE)
endif()
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(LYX_ABS_INSTALLED_DATADIR "${CMAKE_INSTALL_PREFIX}")
set(LYX_LOCALEDIR "locale")
set(LYX_ABS_INSTALLED_LOCALEDIR "${LYX_ABS_INSTALLED_DATADIR}/${LYX_LOCALEDIR}")
@ -336,9 +350,11 @@ if(NOT use_external_libintl)
endif()
add_subdirectory(src)
include_directories(man doc)
add_subdirectory(man)
add_subdirectory(doc)
if (UNIX)
add_subdirectory(lyx2lyx)
endif()
include(../Install)

View File

@ -67,7 +67,7 @@ lyx_install(${TOP_SRC_DIR}/lib fonts * .)
lyx_install(${TOP_SRC_DIR}/lib images * . math commands attic)
lyx_install(${TOP_SRC_DIR}/lib kbd * .)
lyx_install(${TOP_SRC_DIR}/lib layouts * .)
lyx_install(${TOP_SRC_DIR}/lib lyx2lyx * .)
lyx_install(${TOP_SRC_DIR}/lib lyx2lyx *.py .)
lyx_install(${TOP_SRC_DIR}/lib scripts * .)
lyx_install(${TOP_SRC_DIR}/lib templates * .)
lyx_install(${TOP_SRC_DIR}/lib tex * .)

View File

@ -0,0 +1,42 @@
# This file is part of LyX, the document processor.
# Licence details can be found in the file COPYING.
#
# Copyright (c) 2009, Peter Kümmel, <syntheticpp@gmx.net>
# , Kornel Benko, <Kornel.Benko@berlin.de>
#
project(lyx2lyx)
include(FindPythonInterp)
file(GLOB _lyx2lyx_py_files ${TOP_SRC_DIR}/lib/lyx2lyx/*.py)
set(py_compile ${TOP_SRC_DIR}/config/py-compile)
set(_generated)
set(ENV{PYTHON} ${PYTHON_EXECUTABLE})
foreach(_orig_py ${_lyx2lyx_py_files})
get_filename_component(_base_we_py ${_orig_py} NAME_WE)
set(_compiled_py_ "${CMAKE_CURRENT_BINARY_DIR}/${_base_we_py}.pyc" "${CMAKE_CURRENT_BINARY_DIR}/${_base_we_py}.pyo")
set(_copied_py "${CMAKE_CURRENT_BINARY_DIR}/${_base_we_py}.py")
# we need that file really local first, due to the "py_compile"-script
# because the creation will be in the directory of .py-file
add_custom_command(
OUTPUT ${_copied_py}
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${_orig_py}" ${_copied_py}
DEPENDS ${_orig_py}
)
add_custom_command(
OUTPUT ${_compiled_py_}
PRE_BUILD
COMMAND ${py_compile} ${_copied_py}
DEPENDS ${_copied_py}
)
SET_SOURCE_FILES_PROPERTIES(${_copied_py} ${_created_py_} GENERATED)
install(FILES ${_compiled_py_} DESTINATION lyx2lyx)
LIST(APPEND _generated ${_compiled_py_})
endforeach(_orig_py)
ADD_CUSTOM_TARGET(lyx2lyx ALL DEPENDS ${_generated})

View File

@ -14,8 +14,7 @@ list(REMOVE_ITEM _lyxclient_headers "${TOP_SRC_DIR}/src/client/pch.h")
include_directories(BEFORE "${TOP_SRC_DIR}/src/client"
"${TOP_SRC_DIR}/boost" ${ZLIB_INCLUDE_DIR})
add_executable(lyxclient ${_lyxclient_sources}}
${_lyxclient_headers})
add_executable(lyxclient ${_lyxclient_sources} ${_lyxclient_headers})
target_link_libraries(lyxclient