From 17311e82140d445e2af9ae281597891616eb5356 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 8 May 2011 11:12:08 +0100 Subject: [PATCH] Use CPack for packaging. --- .gitignore | 5 ++- CMakeLists.txt | 87 ++++++++++++++++++++++++++++++++++++++-------- gui/CMakeLists.txt | 4 +-- 3 files changed, 79 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index bd9198a..da02775 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,12 @@ *.a *.bmp *.bz2 +*.cmake *.dll *.dylib *.exe *.exp +*.gz *.ilk *.json *.lib @@ -19,11 +21,11 @@ *.so *.trace *.zip +_CPack_Packages CMakeCache.txt CMakeFiles Makefile build -cmake_install.cmake d3d10.cpp d3d10_1.cpp d3d8.cpp @@ -35,6 +37,7 @@ glretrace glretrace_gl.cpp glretrace_state.cpp glxtrace.cpp +install_manifest.txt qapitrace tracedump traces diff --git a/CMakeLists.txt b/CMakeLists.txt index 4648879..e9b2ca5 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,11 @@ cmake_minimum_required (VERSION 2.8) -include (CheckCXXCompilerFlag) - project (apitrace) + +############################################################################## +# Find dependencies + set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # Set default built type @@ -37,6 +39,12 @@ else (NOT WIN32) find_package (DirectX) endif (NOT WIN32) + +############################################################################## +# Set global build options + +include (CheckCXXCompilerFlag) + if (WIN32) # MSVC & MinGW only define & use APIENTRY add_definitions (-DGLAPIENTRY=__stdcall) @@ -87,10 +95,17 @@ else () add_definitions (-Wno-sign-compare) # comparison between signed and unsigned integer expressions endif () + # Put all executables into the same top level build directory, regardless of # which subdirectory they are declared set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +include_directories (${CMAKE_CURRENT_SOURCE_DIR}) + + +############################################################################## +# Bundled dependencies + # Use bundled ZLIB if system one can't be found if (ZLIB_FOUND) include_directories (${ZLIB_INCLUDE_DIRS}) @@ -141,7 +156,9 @@ else (PNG_FOUND) link_libraries (png) endif (PNG_FOUND) -include_directories (${CMAKE_CURRENT_SOURCE_DIR}) + +############################################################################## +# Common libraries / utilities add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp @@ -149,6 +166,24 @@ add_custom_command ( DEPENDS glproc.py dispatch.py wglapi.py glxapi.py glapi.py gltypes.py stdapi.py ) +if (WIN32) + set (os os_win32.cpp) + set (glws glws_wgl.cpp) +else (WIN32) + set (os os_posix.cpp) + set (glws glws_glx.cpp) +endif (WIN32) + +add_library (trace trace_model.cpp trace_parser.cpp trace_write.cpp ${os}) + +add_executable (tracedump tracedump.cpp) +target_link_libraries (tracedump trace) +install (TARGETS tracedump RUNTIME DESTINATION bin) + + +############################################################################## +# API tracers + if (WIN32) # d3d8.dll if (DirectX_D3D8_INCLUDE_DIR) @@ -164,6 +199,7 @@ if (WIN32) RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers ) + install (TARGETS d3d8 RUNTIME DESTINATION wrappers) endif (DirectX_D3D8_INCLUDE_DIR) # d3d9.dll @@ -180,6 +216,7 @@ if (WIN32) RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers ) + install (TARGETS d3d9 RUNTIME DESTINATION wrappers) endif (DirectX_D3DX9_INCLUDE_DIR) # d3d10.dll @@ -192,6 +229,7 @@ if (WIN32) # ) # add_library (d3d10 SHARED d3d10.def d3d10.cpp trace_write.cpp os_win32.cpp) # set_target_properties (d3d10 PROPERTIES PREFIX "") + # install (TARGETS d3d10 RUNTIME DESTINATION wrappers) #endif (DirectX_D3D10_INCLUDE_DIR) # opengl32.dll @@ -210,6 +248,7 @@ if (WIN32) if (MINGW) set_target_properties(wgltrace PROPERTIES LINK_FLAGS "-Wl,--enable-stdcall-fixup ${CMAKE_CURRENT_SOURCE_DIR}/opengl32.def") endif (MINGW) + install (TARGETS wgltrace RUNTIME DESTINATION wrappers) else () include_directories (${X11_INCLUDE_DIR}) @@ -237,20 +276,13 @@ else () endif (NOT APPLE) target_link_libraries (glxtrace dl) + + install (TARGETS glxtrace LIBRARY DESTINATION lib) endif () -if (WIN32) - set (os os_win32.cpp) - set (glws glws_wgl.cpp) -else (WIN32) - set (os os_posix.cpp) - set (glws glws_glx.cpp) -endif (WIN32) - -add_library (trace trace_model.cpp trace_parser.cpp trace_write.cpp ${os}) -add_executable (tracedump tracedump.cpp) -target_link_libraries (tracedump trace) +############################################################################## +# API retracers add_custom_command ( OUTPUT glretrace_gl.cpp @@ -296,6 +328,33 @@ if (NOT WIN32) target_link_libraries (glretrace ${X11_LIBRARIES}) endif (NOT WIN32) +install (TARGETS glretrace RUNTIME DESTINATION bin) + + +############################################################################## +# GUI + if (QT4_FOUND AND QJSON_FOUND) add_subdirectory(gui) endif (QT4_FOUND AND QJSON_FOUND) + + +############################################################################## +# Packaging + +set (CPACK_PACKAGE_VERSION_MAJOR "1") +set (CPACK_PACKAGE_VERSION_MINOR "0") + +# Use current date in YYYYMMDD format as patch number +execute_process ( + COMMAND ${PYTHON_EXECUTABLE} -c "import time, sys; sys.stdout.write(time.strftime('%Y%m%d'))" + OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_PATCH +) + +if (WIN32) + set (CPACK_GENERATOR "ZIP") +else (WIN32) + set (CPACK_GENERATOR "TGZ") +endif (WIN32) + +include(CPack) diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index 611ab9b..c06ce6b 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -55,5 +55,5 @@ target_link_libraries(qapitrace trace ${QJSON_LIBRARIES} ${QT_LIBRARIES} ) ########### install files ############### -#install(TARGETS qapitrace ${INSTALL_TARGETS_DEFAULT_ARGS} ) -#install( FILES qapitrace.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install (TARGETS qapitrace RUNTIME DESTINATION bin) +#install (FILES qapitrace.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) -- 2.45.2