From f8223ec5a218c76732bb68eac4925400c5957fad Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Mon, 4 Jul 2011 11:40:26 +0800 Subject: [PATCH 1/4] cmake: add include file and endian checks. --- .gitignore | 1 + CMakeLists.txt | 19 ++++++++++++++++++- config.h.in | 8 ++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 config.h.in diff --git a/.gitignore b/.gitignore index cc307d880..9c9e85581 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ cmake_install.cmake CMakeFiles/ CMakeCache.txt +config.h # Make Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index a9f8d1e13..4b3cd1524 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,11 @@ cmake_minimum_required(VERSION 2.8) project(FreeRDP C) set(CMAKE_COLOR_MAKEFILE ON) +# Include cmake modules +include(CheckIncludeFiles) +include(CheckLibraryExists) +include(TestBigEndian) + # Include our extra modules set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) @@ -38,16 +43,28 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() +# Include files +check_include_files(sys/param.h HAVE_SYS_PARAM_H) +check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) +check_include_files(netdb.h HAVE_NETDB_H) +check_include_files(fcntl.h HAVE_FCNTL_H) + +# Endian +test_big_endian(BIG_ENDIAN) + # Path to put keymaps set(FREERDP_KEYMAP_PATH "${CMAKE_INSTALL_PREFIX}/freerdp/keymaps") +# Configure files +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) + # Build CUnit find_package(CUnit) if(CUNIT_FOUND) add_subdirectory(cunit) endif() -# Libraries +# Sub-directories add_subdirectory(include) add_subdirectory(libfreerdp-asn1) add_subdirectory(libfreerdp-utils) diff --git a/config.h.in b/config.h.in new file mode 100644 index 000000000..006abb8cd --- /dev/null +++ b/config.h.in @@ -0,0 +1,8 @@ +/* Include files */ +#cmakedefine HAVE_SYS_PARAM_H +#cmakedefine HAVE_SYS_SOCKET_H +#cmakedefine HAVE_NETDB_H +#cmakedefine HAVE_FCNTL_H + +/* Endian */ +#cmakedefine BIG_ENDIAN From d5ad1af3f53d2320de4a66bd632d80a64acae693 Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Mon, 4 Jul 2011 15:41:53 +0800 Subject: [PATCH 2/4] cmake: remove unused include dirs and move it to root CMakeLists.txt --- CMakeLists.txt | 4 ++++ cunit/CMakeLists.txt | 2 -- freerdp-ui/test/CMakeLists.txt | 2 -- libfreerdp-asn1/CMakeLists.txt | 2 -- libfreerdp-core/CMakeLists.txt | 3 --- libfreerdp-gdi/CMakeLists.txt | 3 --- libfreerdp-kbd/CMakeLists.txt | 3 --- libfreerdp-utils/CMakeLists.txt | 3 --- 8 files changed, 4 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b3cd1524..c2740cae1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,10 @@ test_big_endian(BIG_ENDIAN) # Path to put keymaps set(FREERDP_KEYMAP_PATH "${CMAKE_INSTALL_PREFIX}/freerdp/keymaps") +# Include directories +include_directories(${CMAKE_SOURCE_DIR}) +include_directories(${CMAKE_SOURCE_DIR}/include) + # Configure files configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) diff --git a/cunit/CMakeLists.txt b/cunit/CMakeLists.txt index 757416e02..3c1ef1a04 100644 --- a/cunit/CMakeLists.txt +++ b/cunit/CMakeLists.txt @@ -19,8 +19,6 @@ include_directories(${CUNIT_INCLUDE_DIRS}) -include_directories(.) -include_directories(../include) include_directories(../libfreerdp-core) include_directories(../libfreerdp-gdi) diff --git a/freerdp-ui/test/CMakeLists.txt b/freerdp-ui/test/CMakeLists.txt index ad2275498..915fa9cd3 100644 --- a/freerdp-ui/test/CMakeLists.txt +++ b/freerdp-ui/test/CMakeLists.txt @@ -17,8 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) -include_directories(../../include) include_directories(../../libfreerdp-core) add_executable(freerdp-test diff --git a/libfreerdp-asn1/CMakeLists.txt b/libfreerdp-asn1/CMakeLists.txt index 000574489..2e9a87402 100644 --- a/libfreerdp-asn1/CMakeLists.txt +++ b/libfreerdp-asn1/CMakeLists.txt @@ -17,8 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) - set(COMMON_SRCS asn_application.h asn_codecs.h diff --git a/libfreerdp-core/CMakeLists.txt b/libfreerdp-core/CMakeLists.txt index 00d35b2b7..61d7f34de 100644 --- a/libfreerdp-core/CMakeLists.txt +++ b/libfreerdp-core/CMakeLists.txt @@ -17,9 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) -include_directories(../include) - add_definitions(-DL_ENDIAN=1) add_definitions(-DEXT_PATH="/usr/lib/freerdp/extensions") diff --git a/libfreerdp-gdi/CMakeLists.txt b/libfreerdp-gdi/CMakeLists.txt index 9933bf406..af6d295a1 100644 --- a/libfreerdp-gdi/CMakeLists.txt +++ b/libfreerdp-gdi/CMakeLists.txt @@ -17,9 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) -include_directories(../include) - set(FREERDP_GDI_SRCS color.c color.h diff --git a/libfreerdp-kbd/CMakeLists.txt b/libfreerdp-kbd/CMakeLists.txt index bf76b2988..ca7b00541 100644 --- a/libfreerdp-kbd/CMakeLists.txt +++ b/libfreerdp-kbd/CMakeLists.txt @@ -17,9 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) -include_directories(../include) - set(FREERDP_KBD_SRCS keyboard.h locales.c diff --git a/libfreerdp-utils/CMakeLists.txt b/libfreerdp-utils/CMakeLists.txt index f48ddff29..3f9c43310 100644 --- a/libfreerdp-utils/CMakeLists.txt +++ b/libfreerdp-utils/CMakeLists.txt @@ -17,9 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) -include_directories(../include) - set(FREERDP_UTILS_SRCS datablob.c hexdump.c From 374357614f2ec7daa2162c15e7617d77b629b490 Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Mon, 4 Jul 2011 15:48:21 +0800 Subject: [PATCH 3/4] cmake: remove unused definition. --- libfreerdp-core/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/libfreerdp-core/CMakeLists.txt b/libfreerdp-core/CMakeLists.txt index 61d7f34de..e6bb1a28a 100644 --- a/libfreerdp-core/CMakeLists.txt +++ b/libfreerdp-core/CMakeLists.txt @@ -17,7 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_definitions(-DL_ENDIAN=1) add_definitions(-DEXT_PATH="/usr/lib/freerdp/extensions") set(LIBFREERDP_CORE_SRCS From 7ae17192bbad21e3c07cfd9935539c4b59d1c246 Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Mon, 4 Jul 2011 17:01:06 +0800 Subject: [PATCH 4/4] cmake: add ConfigOptions.cmake --- CMakeLists.txt | 1 + cmake/ConfigOptions.cmake | 1 + config.h.in | 3 +++ 3 files changed, 5 insertions(+) create mode 100644 cmake/ConfigOptions.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index c2740cae1..7dc7a9743 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ include(TestBigEndian) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) include(AutoVersioning) +include(ConfigOptions) # Soname versioning - 0.0.0 since it is not being managed yet set(FREERDP_VERSION_MAJOR "0") diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake new file mode 100644 index 000000000..0f3469b64 --- /dev/null +++ b/cmake/ConfigOptions.cmake @@ -0,0 +1 @@ +option(WITH_DEBUG_TRANSPORT "Print transport debug message." OFF) diff --git a/config.h.in b/config.h.in index 006abb8cd..204974a86 100644 --- a/config.h.in +++ b/config.h.in @@ -6,3 +6,6 @@ /* Endian */ #cmakedefine BIG_ENDIAN + +/* Options */ +#cmakedefine WITH_DEBUG_TRANSPORT