Implement more flexible installation
This commit is contained in:
parent
e9f7d4f264
commit
2592e50f83
@ -35,8 +35,30 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|||||||
add_definitions(-D_SQ64)
|
add_definitions(-D_SQ64)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED INSTALL_BIN_DIR)
|
||||||
|
set(INSTALL_BIN_DIR bin)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED INSTALL_LIB_DIR)
|
||||||
|
set(INSTALL_LIB_DIR lib)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(squirrel)
|
add_subdirectory(squirrel)
|
||||||
add_subdirectory(sqstdlib)
|
add_subdirectory(sqstdlib)
|
||||||
add_subdirectory(sq)
|
add_subdirectory(sq)
|
||||||
|
|
||||||
install(FILES doc/squirrel3.pdf doc/sqstdlib3.pdf DESTINATION share/doc/squirrel3)
|
if(DEFINED INSTALL_DOC_DIR)
|
||||||
|
install(FILES doc/squirrel3.pdf doc/sqstdlib3.pdf DESTINATION ${INSTALL_DOC_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED INSTALL_INC_DIR)
|
||||||
|
set(SQ_PUB_HEADERS include/sqconfig.h
|
||||||
|
include/sqstdaux.h
|
||||||
|
include/sqstdblob.h
|
||||||
|
include/sqstdio.h
|
||||||
|
include/sqstdmath.h
|
||||||
|
include/sqstdstring.h
|
||||||
|
include/sqstdsystem.h
|
||||||
|
include/squirrel.h)
|
||||||
|
install(FILES ${SQ_PUB_HEADERS} DESTINATION ${INSTALL_INC_DIR})
|
||||||
|
endif()
|
||||||
|
18
COMPILE
18
COMPILE
@ -44,7 +44,23 @@ can change this behavior by calling CMake like this:
|
|||||||
|
|
||||||
$ cmake .. -DCMAKE_INSTALL_PREFIX=/some/path/on/your/system
|
$ cmake .. -DCMAKE_INSTALL_PREFIX=/some/path/on/your/system
|
||||||
|
|
||||||
Under Windows, it is probably easiest to use the CMake GUI interface.
|
With the INSTALL_BIN_DIR and INSTALL_LIB_DIR options, the directories
|
||||||
|
the binaries & libraries will go in (relative to CMAKE_INSTALL_PREFIX)
|
||||||
|
can be specified. For instance,
|
||||||
|
|
||||||
|
$ cmake .. -DINSTALL_LIB_DIR=lib64
|
||||||
|
|
||||||
|
will install the libraries into a 'lib64' subdirectory in the top
|
||||||
|
source directory. If INSTALL_DOC_DIR is set, the PDF documentation
|
||||||
|
will be installed into the directory the value of INSTALL_DOC_DIR
|
||||||
|
points to. There is no default directory - if you want only the
|
||||||
|
binaries and no documentation, just don't specify INSTALL_DOC_DIR, and
|
||||||
|
no documentation will be installed. The same applies for
|
||||||
|
INSTALL_INC_DIR, which can install the public header files.
|
||||||
|
|
||||||
|
Under Windows, it is probably easiest to use the CMake GUI interface,
|
||||||
|
although invoking CMake from the command line as explained above
|
||||||
|
should work as well.
|
||||||
|
|
||||||
GCC USERS
|
GCC USERS
|
||||||
.........................................................
|
.........................................................
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
add_executable(sq sq.c)
|
add_executable(sq sq.c)
|
||||||
set_target_properties(sq PROPERTIES LINKER_LANGUAGE C)
|
set_target_properties(sq PROPERTIES LINKER_LANGUAGE C)
|
||||||
target_link_libraries(sq squirrel sqstdlib)
|
target_link_libraries(sq squirrel sqstdlib)
|
||||||
install(TARGETS sq RUNTIME DESTINATION bin)
|
install(TARGETS sq RUNTIME DESTINATION ${INSTALL_BIN_DIR})
|
||||||
|
|
||||||
add_executable(sq_static sq.c)
|
add_executable(sq_static sq.c)
|
||||||
set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C)
|
set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C)
|
||||||
@ -11,4 +11,4 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
set_target_properties(sq_static PROPERTIES COMPILE_FLAGS "-static -Wl,-static")
|
set_target_properties(sq_static PROPERTIES COMPILE_FLAGS "-static -Wl,-static")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS sq_static RUNTIME DESTINATION bin)
|
install(TARGETS sq_static RUNTIME DESTINATION ${INSTALL_BIN_DIR})
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
set(SQSTDLIB_SRC sqstdblob.cpp
|
set(SQSTDLIB_SRC sqstdaux.cpp
|
||||||
|
sqstdblob.cpp
|
||||||
sqstdio.cpp
|
sqstdio.cpp
|
||||||
sqstdstream.cpp
|
|
||||||
sqstdmath.cpp
|
sqstdmath.cpp
|
||||||
sqstdsystem.cpp
|
sqstdrex.cpp
|
||||||
|
sqstdstream.cpp
|
||||||
sqstdstring.cpp
|
sqstdstring.cpp
|
||||||
sqstdaux.cpp
|
sqstdsystem.cpp)
|
||||||
sqstdrex.cpp)
|
|
||||||
|
|
||||||
add_library(sqstdlib SHARED ${SQSTDLIB_SRC})
|
add_library(sqstdlib SHARED ${SQSTDLIB_SRC})
|
||||||
target_link_libraries(sqstdlib squirrel)
|
target_link_libraries(sqstdlib squirrel)
|
||||||
install(TARGETS sqstdlib RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
install(TARGETS sqstdlib RUNTIME DESTINATION ${INSTALL_BIN_DIR}
|
||||||
|
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
|
||||||
|
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||||
|
|
||||||
add_library(sqstdlib_static STATIC ${SQSTDLIB_SRC})
|
add_library(sqstdlib_static STATIC ${SQSTDLIB_SRC})
|
||||||
install(TARGETS sqstdlib_static ARCHIVE DESTINATION lib)
|
install(TARGETS sqstdlib_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
set(SQUIRREL_SRC sqapi.cpp
|
set(SQUIRREL_SRC sqapi.cpp
|
||||||
sqbaselib.cpp
|
sqbaselib.cpp
|
||||||
sqfuncstate.cpp
|
sqclass.cpp
|
||||||
sqdebug.cpp
|
|
||||||
sqlexer.cpp
|
|
||||||
sqobject.cpp
|
|
||||||
sqcompiler.cpp
|
sqcompiler.cpp
|
||||||
|
sqdebug.cpp
|
||||||
|
sqfuncstate.cpp
|
||||||
|
sqlexer.cpp
|
||||||
|
sqmem.cpp
|
||||||
|
sqobject.cpp
|
||||||
sqstate.cpp
|
sqstate.cpp
|
||||||
sqtable.cpp
|
sqtable.cpp
|
||||||
sqmem.cpp
|
sqvm.cpp)
|
||||||
sqvm.cpp
|
|
||||||
sqclass.cpp)
|
|
||||||
|
|
||||||
add_library(squirrel SHARED ${SQUIRREL_SRC})
|
add_library(squirrel SHARED ${SQUIRREL_SRC})
|
||||||
install(TARGETS squirrel RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
install(TARGETS squirrel RUNTIME DESTINATION ${INSTALL_BIN_DIR}
|
||||||
|
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
|
||||||
|
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||||
|
|
||||||
add_library(squirrel_static STATIC ${SQUIRREL_SRC})
|
add_library(squirrel_static STATIC ${SQUIRREL_SRC})
|
||||||
install(TARGETS squirrel_static ARCHIVE DESTINATION lib)
|
install(TARGETS squirrel_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user