Skip to content
Browse files

Added installation statements and notes about building to README.org .

  • Loading branch information...
1 parent 3b3fb3d commit 6a9af85ba4d08524c334dee595884fb224eb1505 @MaikBeckmann committed Apr 29, 2011
Showing with 111 additions and 27 deletions.
  1. +15 −7 CMakeLists.txt
  2. +59 −16 README.org
  3. +21 −0 details.cmake
  4. +7 −0 f2k3_lua_simple-config.cmake
  5. +7 −2 src/CMakeLists.txt
  6. +1 −1 src/clua.c
  7. +1 −1 test/CMakeLists.txt
View
22 CMakeLists.txt
@@ -2,16 +2,24 @@
# Licensed under the MIT license, see LICENSE file.
cmake_minimum_required(VERSION 2.6)
-project(f2k3-lua C Fortran)
+project(f2k3_lua_simple C Fortran)
find_package(Lua51 REQUIRED)
+include(details.cmake)
+set(CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include")
+
add_subdirectory(src)
add_subdirectory(test)
-# install(EXPORT ${PROJECT_NAME}-targets
-# DESTINATION share/cmake/${PROJECT_NAME}
-# )
-# install(FILES ${PROJECT_NAME}-config.cmake
-# DESTINATION share/cmake/${PROJECT_NAME}
-# )
+install(EXPORT ${PROJECT_NAME}-targets
+ DESTINATION lib/${PROJECT_NAME}/cmake/
+)
+install(FILES ${PROJECT_NAME}-config.cmake
+ DESTINATION lib/${PROJECT_NAME}/cmake/
+)
+install(DIRECTORY ${PROJECT_BINARY_DIR}/include/
+ DESTINATION include/${PROJECT_NAME}
+ FILES_MATCHING PATTERN "*.mod"
+)
+
View
75 README.org
@@ -12,23 +12,66 @@ variables that hold the following data types
- numbers
- Tables that are composed using numbers and strings
-** TODO What has to be done
-*** Proper installation
-Right now it just builds but it doesn't produce something usable
-outside the build tree.
-*** Build instructions
+** Build instructions
+*** Configure, build and install f2k3-lua-simple
+#+begin_src sh
+ mkdir build && cd build
+ cmake ../ -DCMAKE_INSTALL_PREFIX=/tmp/f2k3_test
+ make install
+#+end_src
+What do we need to build this package:
CMake, a C compiler and a fortran compiler that supports enough f2k3.
-# ** COMMENT Common build errors
-# #+begin_src shell
-# CMake Error at
-# /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91
-# (MESSAGE): Could NOT find Lua51 (missing: LUA_LIBRARIES
-# LUA_INCLUDE_DIR) Call Stack (most recent call first):
-# /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252
-# (_FPHSA_FAILURE_MESSAGE)
-# /usr/share/cmake-2.8/Modules/FindLua51.cmake:72
-# (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:4 (find_package
-# #+end_src
+*** Configure and build your own software
+If you use cmake, your CMakeLists.txt looks roughly like this
+#+begin_src cmake
+ cmake_minimum_required(VERSION 2.6)
+ project(foo C Fortran)
+
+ find_package(f2k3_lua_simple REQUIRED)
+
+ include_directories(${f2k3_lua_simple_INCLUDE_DIRS})
+
+ add_executable(foo test.f90)
+ target_link_libraries(foo ${f2k3_lua_simple_LIBRARIES})
+#+end_src
+You can build it now via
+#+begin_src sh
+ mkdir build && cd build
+ cmake ../ -DCMAKE_PREFIX_PATH=/tmp/f2k3_test
+ make
+#+end_src
+CMAKE_PREFIX_PATH tells cmake where to look for f2k3_lua_simple.
+
+*** Common build errors
+When you configure f2k3 itself and it can't find lua, then this it
+tells you
+#+begin_src sh
+
+ CMake Error at
+ /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91
+ (MESSAGE): Could NOT find Lua51 (missing: LUA_LIBRARIES
+ LUA_INCLUDE_DIR) Call Stack (most recent call first):
+ /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252
+ (_FPHSA_FAILURE_MESSAGE)
+ /usr/share/cmake-2.8/Modules/FindLua51.cmake:72
+ (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:4 (find_package
+#+end_src
+
+If your own cmake build script can't find f2k3_lua_simple, then this
+is what cmake tells you
+#+begin_src sh
+CMake Error at CMakeLists.txt:4 (find_package):
+ Could not find module Findf2k3_lua_simple.cmake or a configuration file for
+ package f2k3_lua_simple.
+
+ Adjust CMAKE_MODULE_PATH to find Findf2k3_lua_simple.cmake or set
+ f2k3_lua_simple_DIR to the directory containing a CMake configuration file
+ for f2k3_lua_simple. The file will have one of the following names:
+
+ f2k3_lua_simpleConfig.cmake
+ f2k3_lua_simple-config.cmake
+#+end_src
+
** What is it licensed under?
MIT, see the LICENSE file
View
21 details.cmake
@@ -0,0 +1,21 @@
+if(WIN32)
+ set(_library_dir bin) # .dll are in PATH, like executables
+else(WIN32)
+ set(_library_dir lib) # .so and .dyn
+endif(WIN32)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" CACHE INTERNAL
+ "Where to put the executables"
+)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_library_dir}"
+ CACHE INTERNAL "Where to put the libraries"
+)
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE INTERNAL
+ "Where to put the archives"
+)
+
+set(DEFAULT_INSTALL_DESTINATIONS
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION ${_library_dir}
+ ARCHIVE DESTINATION lib
+)
View
7 f2k3_lua_simple-config.cmake
@@ -0,0 +1,7 @@
+get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+include(${SELF_DIR}/f2k3_lua_simple-targets.cmake)
+get_filename_component(f2k3_lua_simple_INCLUDE_DIR
+ "${SELF_DIR}/../../../include/f2k3_lua_simple" ABSOLUTE)
+set(f2k3_lua_simple_INCLUDE_DIRS ${f2k3_lua_simple_INCLUDE_DIR})
+
+set(f2k3_lua_simple_LIBRARIES f2k3_lua_simple)
View
9 src/CMakeLists.txt
@@ -5,12 +5,17 @@ include_directories(
${LUA_INCLUDE_DIR}
)
-add_library(f2k3lua
+add_library(${PROJECT_NAME}
clua.c
flua.f90
lua_c_interfaces.f90
)
-target_link_libraries(f2k3lua
+target_link_libraries(f2k3_lua_simple
${LUA_LIBRARIES}
)
+
+install(TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}-targets
+ ${DEFAULT_INSTALL_DESTINATIONS}
+)
View
2 src/clua.c
@@ -1,6 +1,6 @@
/**
* Copyright (C) 2011 by the f2k3-lua authors, see AUTHORS file.
- * Licensed under the MIT license, see LICENSE file.
+ * Licensed under the MIT license, see LICENSE file.
*/
#include <lua.h>
View
2 test/CMakeLists.txt
@@ -6,5 +6,5 @@ include_directories(
)
add_executable(test test.f90)
target_link_libraries(test
- f2k3lua
+ ${PROJECT_NAME}
)

0 comments on commit 6a9af85

Please sign in to comment.
Something went wrong with that request. Please try again.