]> git.lyx.org Git - features.git/commitdiff
cmake: set default install path, add py-compile for lyx2lyx, from Kornel
authorPeter Kümmel <syntheticpp@gmx.net>
Mon, 5 Jan 2009 19:13:20 +0000 (19:13 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Mon, 5 Jan 2009 19:13:20 +0000 (19:13 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28001 a592a061-630c-0410-9148-cb99ea01b6c8

development/cmake/CMakeLists.txt
development/cmake/Install.cmake
development/cmake/lyx2lyx/CMakeLists.txt [new file with mode: 0644]
development/cmake/src/client/CMakeLists.txt

index 1c6e123a256518689b2567a275ed3b42e02bd09b..0f9141873ef368b96f8cdd2be7ef2743eae67865 100644 (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)
 
index 6875f7efcd9e065a9400e7af9f189c882cd2ea3e..11dd6fd3e652670b8394884b0785bd8ca42dd52a 100755 (executable)
@@ -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          *      .)
diff --git a/development/cmake/lyx2lyx/CMakeLists.txt b/development/cmake/lyx2lyx/CMakeLists.txt
new file mode 100644 (file)
index 0000000..cb00da6
--- /dev/null
@@ -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})
index 79c21edba4c73ff44b56bad5886a01b5ff2cb4fd..5eb296b060d0ac934773134ba7e29f6b3da976a6 100644 (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