]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
More efficient bitmask representation.
[apitrace] / CMakeLists.txt
index a7ac9f5769ab91e2e7312b14ffcb6973d7889331..04c7a44d38c7c6c7d4e5ddb50d35e8aac4d49f96 100644 (file)
@@ -1,9 +1,17 @@
-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required (VERSION 2.8)
 
 project (apitrace)
 
 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
 
+# Set default built type
+if (NOT CMAKE_BUILD_TYPE)
+       set (CMAKE_BUILD_TYPE Debug
+               CACHE
+               STRING "Choose the build type, options are: None, Debug, Release, RelWithDebInfo, or MinSizeRel."
+               FORCE)
+endif (NOT CMAKE_BUILD_TYPE)
+
 find_package (PythonInterp REQUIRED)
 find_package (OpenGL REQUIRED)
 find_package (ZLIB)
@@ -36,6 +44,8 @@ if (MSVC)
        add_definitions (-wd4244) # conversion from 'type1' to 'type2', possible loss of data
        add_definitions (-wd4505) # unreferenced local function has been removed
        add_definitions (-wd4800) # forcing value to bool 'true' or 'false' (performance warning)
+       # XXX: it's safer to use ssize_t everywhere instead of disabling warning
+       add_definitions (-wd4018) # signed/unsigned mismatch
        
        # Use static runtime
        # http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
@@ -48,7 +58,10 @@ if (MSVC)
                endif (${flag_var} MATCHES "/MD")
        endforeach (flag_var)
 else ()
+       # Adjust warnings
        add_definitions (-Wall)
+       # XXX: it's safer to use ssize_t everywhere instead of disabling warning
+       add_definitions (-Wno-sign-compare) # comparison between signed and unsigned integer expressions
 endif ()
 
 # Use bundled ZLIB if system one can't be found
@@ -87,9 +100,9 @@ if (WIN32)
        #       add_custom_command (
        #               OUTPUT d3d8.cpp
        #               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d8.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d8.cpp
-       #               DEPENDS d3d8.py d3d8types.py d3d8caps.py windows.py base.py
+       #               DEPENDS d3d8.py d3d8types.py d3d8caps.py winapi.py stdapi.py
        #       )
-       #       add_library (d3d8 SHARED d3d8.def d3d8.cpp log.cpp os_win32.cpp)
+       #       add_library (d3d8 SHARED d3d8.def d3d8.cpp trace_write.cpp os_win32.cpp)
        #       set_target_properties (d3d8 PROPERTIES PREFIX "")
        #endif (DirectX_D3D8_FOUND)
 
@@ -99,9 +112,9 @@ if (WIN32)
        #       add_custom_command (
        #               OUTPUT d3d9.cpp
        #               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d9.cpp
-       #               DEPENDS d3d9.py d3d9types.py d3d9caps.py d3dshader.py windows.py base.py
+       #               DEPENDS d3d9.py d3d9types.py d3d9caps.py d3dshader.py winapi.py stdapi.py
        #       )
-       #       add_library (d3d9 SHARED d3d9.def d3d9.cpp log.cpp os_win32.cpp)
+       #       add_library (d3d9 SHARED d3d9.def d3d9.cpp trace_write.cpp os_win32.cpp)
        #       set_target_properties (d3d9 PROPERTIES PREFIX "")
        #endif (DirectX_D3DX9_FOUND)
 
@@ -111,19 +124,19 @@ if (WIN32)
        #       add_custom_command (
        #               OUTPUT d3d10.cpp
        #               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10misc.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10.cpp
-       #               DEPENDS d3d10misc.py windows.py base.py
+       #               DEPENDS d3d10misc.py winapi.py stdapi.py
        #       )
-       #       add_library (d3d10 SHARED d3d10.def d3d10.cpp log.cpp os_win32.cpp)
+       #       add_library (d3d10 SHARED d3d10.def d3d10.cpp trace_write.cpp os_win32.cpp)
        #       set_target_properties (d3d10 PROPERTIES PREFIX "")
        #endif (DirectX_D3D10_FOUND)
 
        # opengl32.dll
        add_custom_command (
                OUTPUT opengl32.cpp
-               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/opengl32.py > ${CMAKE_CURRENT_BINARY_DIR}/opengl32.cpp
-               DEPENDS opengl32.py trace.py wglapi.py glapi.py windows.py base.py
+               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/wgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/opengl32.cpp
+               DEPENDS wgltrace.py trace.py wglapi.py glapi.py glenum.py winapi.py stdapi.py
        )
-       add_library (opengl SHARED opengl32.def opengl32.cpp log.cpp os_win32.cpp)
+       add_library (opengl SHARED opengl32.def opengl32.cpp trace_write.cpp os_win32.cpp)
        set_target_properties (opengl PROPERTIES
                PREFIX ""
                OUTPUT_NAME opengl32)
@@ -137,10 +150,10 @@ else ()
        add_custom_command (
                OUTPUT glxtrace.cpp
                COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glxtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glxtrace.cpp
-               DEPENDS glxtrace.py trace.py glapi.py base.py
+               DEPENDS glxtrace.py trace.py glxapi.py glapi.py glenum.py stdapi.py
        )
 
-       add_library (glxtrace SHARED glxtrace.cpp log.cpp os_posix.cpp)
+       add_library (glxtrace SHARED glxtrace.cpp trace_write.cpp os_posix.cpp)
        set_target_properties (glxtrace PROPERTIES PREFIX "")
        target_link_libraries (glxtrace dl)
 endif ()
@@ -152,7 +165,7 @@ if (GLEW_INCLUDE_DIR)
        add_custom_command (
                OUTPUT glretrace.cpp
                COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glretrace.cpp
-               DEPENDS glretrace.py glapi.py base.py
+               DEPENDS glretrace.py retrace.py glapi.py glenum.py stdapi.py
        )
 
        include_directories (