ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since f309303 was
62dc94b,
checked in by Mathieu Doucet <doucetm@…>, 13 years ago
|
Add quick test for the C++ library
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Rev | Line | |
---|
[26e0249] | 1 | """ |
---|
| 2 | Script to generate a CMakeLists.txt file for cmake |
---|
| 3 | |
---|
| 4 | python generate_cmake.py |
---|
| 5 | cd [your build location not in the source tree] |
---|
| 6 | cmake [path to directory containing CMakeLists.txt] |
---|
| 7 | make |
---|
| 8 | |
---|
| 9 | That will produce a library libModels.a |
---|
| 10 | """ |
---|
| 11 | import os |
---|
| 12 | f = open("CMakeLists.txt", "w") |
---|
| 13 | |
---|
| 14 | cmakelist = """# CMakeLists for SANS models |
---|
| 15 | cmake_minimum_required (VERSION 2.6) |
---|
| 16 | project (SansModels) |
---|
| 17 | |
---|
| 18 | # Version number |
---|
| 19 | set (SansModels_VERSION_MAJOR 1) |
---|
| 20 | set (SansModels_VERSION_MAJOR 0) |
---|
| 21 | |
---|
| 22 | set (SRC_FILES |
---|
| 23 | """ |
---|
| 24 | |
---|
| 25 | source_dirs = ["src/c_models", |
---|
| 26 | "src/libigor"] |
---|
| 27 | excluded_src = ["c_models.cpp", |
---|
| 28 | "disperser.c", |
---|
| 29 | "winFuncs.c"] |
---|
| 30 | |
---|
| 31 | for src_dir in source_dirs: |
---|
| 32 | for item in os.listdir(src_dir): |
---|
| 33 | if item in excluded_src: |
---|
| 34 | continue |
---|
| 35 | ext = os.path.splitext(item)[1] |
---|
| 36 | if ext in [".c",".cpp"]: |
---|
| 37 | cmakelist += " %s\n" % os.path.join(src_dir, item) |
---|
| 38 | |
---|
| 39 | cmakelist += " )\n\n" |
---|
| 40 | |
---|
| 41 | cmakelist += "set ( INC_FILES\n" |
---|
| 42 | |
---|
| 43 | include_dirs = ["src/c_models", |
---|
[503a972] | 44 | "include", |
---|
[26e0249] | 45 | "src/libigor"] |
---|
| 46 | |
---|
| 47 | for inc_dir in include_dirs: |
---|
| 48 | for item in os.listdir(inc_dir): |
---|
| 49 | ext = os.path.splitext(item)[1] |
---|
| 50 | if ext in [".h",".hh"]: |
---|
| 51 | cmakelist += " %s\n" % os.path.join(inc_dir, item) |
---|
| 52 | |
---|
| 53 | cmakelist += """ |
---|
| 54 | ) |
---|
| 55 | |
---|
[503a972] | 56 | include_directories (src/libigor include src/c_models) |
---|
[26e0249] | 57 | |
---|
| 58 | # Add the target for this directory |
---|
[62dc94b] | 59 | add_library ( models ${SRC_FILES} ${INC_FILES}) |
---|
| 60 | add_executable( libraryTest test/library_test.cpp ${INC_FILES}) |
---|
| 61 | ADD_DEFINITIONS(-D__MODELS_STANDALONE__) |
---|
| 62 | ADD_DEPENDENCIES(libraryTest models) |
---|
| 63 | TARGET_LINK_LIBRARIES(libraryTest models) |
---|
[26e0249] | 64 | """ |
---|
| 65 | |
---|
| 66 | f.write(cmakelist) |
---|
| 67 | f.close() |
---|
| 68 | |
---|
| 69 | |
---|
Note: See
TracBrowser
for help on using the repository browser.