|
1 |
| -# Copyright (C) 2007-2009 LuaDist. |
2 |
| -# Created by Peter Kapec, David Manura |
| 1 | +# Copyright (C) 2007-2012 LuaDist. |
| 2 | +# Created by Peter Kapec, David Manura, Peter Drahoš |
3 | 3 | # Redistribution and use of this file is allowed according to the terms of the MIT license.
|
4 | 4 | # For details see the COPYRIGHT file distributed with LuaDist.
|
5 | 5 | # Please note that the package source code is licensed under its own license.
|
6 | 6 |
|
7 |
| -project(luacom C CXX) |
8 |
| -cmake_minimum_required(VERSION 2.6) |
9 |
| -include(dist.cmake) |
10 |
| -include(CheckCSourceCompiles) |
11 |
| -include(CheckSymbolExists) # note: requires 'C' in PROJECT. |
| 7 | +project ( luacom C CXX ) |
| 8 | +cmake_minimum_required ( VERSION 2.8 ) |
| 9 | +include ( cmake/dist.cmake ) |
| 10 | +include ( lua ) |
| 11 | +include ( CheckCSourceCompiles ) |
| 12 | +include ( CheckSymbolExists ) |
| 13 | +# note: requires 'C' in PROJECT. |
12 | 14 |
|
13 | 15 | # Build
|
14 |
| -include_directories(include src/dll src/library ${CMAKE_CURRENT_BINARY_DIR}) |
| 16 | +include_directories ( include src/dll src/library ${CMAKE_CURRENT_BINARY_DIR} ) |
15 | 17 |
|
16 | 18 | # Detect htmlhelp (not normally available in Cygwin 1.7, MinGW, and Wine).
|
17 | 19 | # Use CHECK_C_SOURCE_COMPILES because these two aren't reliable:
|
18 | 20 | # CHECK_INCLUDE_FILES("windows.h;htmlhelp.h" HAVE_HTMLHELP)
|
19 | 21 | # # On MinGW and Wine, htmlhelp.h may exist but not htmlhelp.lib.
|
20 | 22 | # CHECK_LIBRARY_EXISTS(htmlhelp HtmlHelpA "" HAVE_HTMLHELP) # detection fails in MSVC
|
21 |
| -set(CMAKE_REQUIRED_LIBRARIES htmlhelp) |
22 |
| -check_c_source_compiles(" |
23 |
| -#include <windows.h> |
24 |
| - #include <htmlhelp.h> |
25 |
| - int main() { HtmlHelp(NULL, NULL, HH_HELP_CONTEXT, 0); return 0; } |
26 |
| -" HAVE_HTMLHELP) |
27 |
| -set(CMAKE_REQUIRED_LIBRARIES) |
28 |
| -if(NOT HAVE_HTMLHELP) |
29 |
| - add_definitions(-DNO_HTMLHELP) |
30 |
| -endif() |
| 23 | +set ( CMAKE_REQUIRED_LIBRARIES htmlhelp ) |
| 24 | +check_c_source_compiles ( " #include <windows.h> #include <htmlhelp.h> int main() { HtmlHelp(NULL, NULL, HH_HELP_CONTEXT, 0); return 0; } " |
| 25 | + HAVE_HTMLHELP ) |
| 26 | +set ( CMAKE_REQUIRED_LIBRARIES ) |
| 27 | +if ( NOT HAVE_HTMLHELP ) |
| 28 | + add_definitions ( -DNO_HTMLHELP ) |
| 29 | +endif ( ) |
31 | 30 |
|
32 | 31 | # _stricmp (is there a simpler way of doing this?)
|
33 |
| -check_symbol_exists(_stricmp string.h HAVE__STRICMP) |
34 |
| -if(HAVE__STRICMP) |
35 |
| - set(STRICMP _stricmp) |
36 |
| -endif() |
37 |
| -if(NOT STRICMP) |
38 |
| - check_symbol_exists(stricmp string.h HAVE_STRICMP) |
39 |
| - if(HAVE_STRICMP) |
40 |
| - set(STRICMP stricmp) |
41 |
| - endif() |
42 |
| -endif() |
43 |
| -if(NOT STRICMP) |
44 |
| - check_symbol_exists(strcasecmp string.h HAVE_STRCASECMP) |
45 |
| - if(HAVE_STRCASECMP) |
46 |
| - set(STRICMP strcasecmp) |
47 |
| - endif() |
48 |
| -endif() |
49 |
| -if(NOT STRICMP) |
50 |
| - message(FATAL_ERROR "_stricmp, stricmp, or strcasecmp not found") |
51 |
| -endif() |
52 |
| -add_definitions(-D_stricmp=${STRICMP}) |
| 32 | +check_symbol_exists ( _stricmp string.h HAVE__STRICMP ) |
| 33 | +if ( HAVE__STRICMP ) |
| 34 | + set ( STRICMP _stricmp ) |
| 35 | +endif ( ) |
| 36 | +if ( NOT STRICMP ) |
| 37 | + check_symbol_exists ( stricmp string.h HAVE_STRICMP ) |
| 38 | + if ( HAVE_STRICMP ) |
| 39 | + set ( STRICMP stricmp ) |
| 40 | + endif ( ) |
| 41 | +endif ( ) |
| 42 | +if ( NOT STRICMP ) |
| 43 | + check_symbol_exists ( strcasecmp string.h HAVE_STRCASECMP ) |
| 44 | + if ( HAVE_STRCASECMP ) |
| 45 | + set ( STRICMP strcasecmp ) |
| 46 | + endif ( ) |
| 47 | +endif ( ) |
| 48 | +if ( NOT STRICMP ) |
| 49 | + message ( FATAL_ERROR "_stricmp, stricmp, or strcasecmp not found" ) |
| 50 | +endif ( ) |
| 51 | +add_definitions ( -D_stricmp=${STRICMP} ) |
53 | 52 |
|
54 |
| -set(SRC_LIB |
55 |
| - src/library/LuaAux.cpp |
56 |
| - src/library/luabeans.cpp |
57 |
| - src/library/luacom.cpp |
58 |
| - src/library/tLuaCOM.cpp |
59 |
| - src/library/tLuaCOMException.cpp |
60 |
| - src/library/tLuaCOMTypeHandler.cpp |
61 |
| - src/library/tLuaDispatch.cpp |
62 |
| - src/library/tLuaObjList.cpp |
63 |
| - src/library/tLuaVector.cpp |
64 |
| - src/library/tStringBuffer.cpp |
65 |
| - src/library/tUtil.cpp |
66 |
| - src/library/tCOMUtil.cpp |
67 |
| - src/library/tLuaCOMClassFactory.cpp |
68 |
| - src/library/tLuaCOMConnPoints.cpp |
69 |
| - src/library/LuaCompat.cpp |
70 |
| - src/library/tLuaCOMEnumerator.cpp |
71 |
| - src/library/tLuaObject.cpp |
72 |
| - src/library/tLuaControl.cpp |
73 |
| - src/library/tLuaTLB.cpp |
74 |
| -) |
| 53 | +set ( SRC_LIB src/library/LuaAux.cpp src/library/luabeans.cpp src/library/luacom.cpp |
| 54 | + src/library/tLuaCOM.cpp src/library/tLuaCOMException.cpp src/library/tLuaCOMTypeHandler.cpp |
| 55 | + src/library/tLuaDispatch.cpp src/library/tLuaObjList.cpp src/library/tLuaVector.cpp |
| 56 | + src/library/tStringBuffer.cpp src/library/tUtil.cpp src/library/tCOMUtil.cpp src/library/tLuaCOMClassFactory.cpp |
| 57 | + src/library/tLuaCOMConnPoints.cpp src/library/LuaCompat.cpp src/library/tLuaCOMEnumerator.cpp |
| 58 | + src/library/tLuaObject.cpp src/library/tLuaControl.cpp src/library/tLuaTLB.cpp ) |
75 | 59 |
|
76 |
| -set(LIBS gdi32 shell32 advapi32 ole32 winspool uuid oleaut32 shlwapi) # kernel32 user32 |
77 |
| -if(HAVE_HTMLHELP) |
78 |
| - set(LIBS ${LIBS} htmlhelp) |
79 |
| -endif() |
| 60 | +set ( LIBS gdi32 shell32 advapi32 ole32 winspool uuid oleaut32 shlwapi ) |
| 61 | +# kernel32 user32 |
| 62 | +if ( HAVE_HTMLHELP ) |
| 63 | + set ( LIBS ${LIBS} htmlhelp ) |
| 64 | +endif ( ) |
80 | 65 |
|
81 |
| -add_lua_bin2c( |
82 |
| - ${CMAKE_CURRENT_BINARY_DIR}/luacom5.loh src/library/luacom5.lua |
83 |
| - ${CMAKE_CURRENT_SOURCE_DIR}/mak/bin2c.lua |
84 |
| - ${CMAKE_CURRENT_SOURCE_DIR}/mak/luac.lua) |
85 |
| -set_source_files_properties(src/library/luacom.cpp PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/luacom5.loh) |
| 66 | +add_lua_bin2c ( ${CMAKE_CURRENT_BINARY_DIR}/luacom5.loh src/library/luacom5.lua ${CMAKE_CURRENT_SOURCE_DIR}/mak/bin2c.lua |
| 67 | + ${CMAKE_CURRENT_SOURCE_DIR}/mak/luac.lua ) |
| 68 | +set_source_files_properties ( src/library/luacom.cpp PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/luacom5.loh ) |
86 | 69 |
|
87 |
| -set(SRC_DLL src/dll/luacom_dll.cpp) |
88 |
| -add_definitions(-DLUACOM_DLL="luacom.dll") |
| 70 | +set ( SRC_DLL src/dll/luacom_dll.cpp ) |
| 71 | +add_definitions ( -DLUACOM_DLL="luacom.dll" ) |
89 | 72 |
|
90 |
| -install_lua_module(luacom ${SRC_DLL} ${SRC_LIB} src/dll/luacom_dll.def) |
91 |
| -target_link_libraries(luacom ${LIBS}) |
| 73 | +install_lua_module ( luacom ${SRC_DLL} ${SRC_LIB} src/dll/luacom_dll.def LINK ${LIBS} ) |
| 74 | +install_data ( README COPYRIGHT announce.txt todo.txt ) |
| 75 | +install_doc ( doc/luacom.gif doc/luacom.pdf www/index.html ) |
| 76 | +install_example ( demo/ ) |
92 | 77 |
|
93 |
| -install_data(README COPYRIGHT announce.txt todo.txt) |
94 |
| -install_doc(doc/luacom.gif doc/luacom.pdf www/index.html) |
95 |
| -install_example(demo/) |
96 |
| - |
97 |
| -add_lua_test(${CMAKE_CURRENT_SOURCE_DIR}/src/test/luacom_tests5.lua) |
| 78 | +add_lua_test ( ${CMAKE_CURRENT_SOURCE_DIR}/src/test/luacom_tests5.lua ) |
0 commit comments