File: CMakeLists.txt

package info (click to toggle)
libosl 0.8.0-1.4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,208 kB
  • ctags: 13,120
  • sloc: cpp: 114,344; ruby: 1,290; ansic: 915; makefile: 430; perl: 309; sh: 35
file content (136 lines) | stat: -rw-r--r-- 4,524 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
project (osl CXX)

# To support for multiarch
# See
#   - https://cmake.org/cmake/help/v3.3/module/GNUInstallDirs.html
#   - https://wiki.debian.org/Multiarch/Implementation#CMake
include(GNUInstallDirs)

# Tweak build mode
if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "" FORCE)
endif()

if(NOT CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]")
  add_definitions(-DQT_NO_DEBUG_OUTPUT)
  set(CMAKE_BUILD_RELEASE TRUE)
else()
  set(CMAKE_BUILD_RELEASE FALSE)
endif()

# Installation directory
if(APPLE AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
  set(CMAKE_INSTALL_PREFIX "/Applications")
endif()

message(STATUS "Building ${PROJECT_NAME} in ${CMAKE_BUILD_TYPE} mode")
cmake_minimum_required(VERSION 2.8.8)
set (CMAKE_VERBOSE_MAKEFILE on)

ENABLE_TESTING()

# Common build options
if(CMAKE_COMPILER_IS_GNUCXX OR MINGW OR APPLE)
  #if(CMAKE_BUILD_RELEASE)
  #        add_definitions(-Werror)
  #endif()
  #add_compile_options(-std=c++11) #CMake 2.8.12 or newer
  #add_definitions(-std=c++11) #older than CMake 2.8.11
  set (CMAKE_CXX_FLAGS_DEBUG   "-g -O0 -DDEBUG")
  set (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
  add_definitions(-Wall -D_REENTRANT -DOSL_SMP -DOSL_DFPN_SMP_SEARCH -DMORE_CHECKMATE_IF_CAPTURE_MAJOR)
  add_definitions(-DBOOST_FILESYSTEM_VERSION=3) 
endif()

# Compiler specific build options
if(MINGW)
  add_compile_options(-march=pentium4 -mthreads -mwin32 -msse2 -static-libgcc -static-libstdc++ -mstackrealign -fno-strict-aliasing)
  add_definitions(-D_MT -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0500)

  set (BOOST_ROOT "$ENV{HOME}/local/src/boost_1_54_0")
  set (Boost_NO_SYSTEM_PATHS ON)
  find_library(Winsock2_LIBRARY ws2_32)
elseif (APPLE)
  add_compile_options(-march=core2)
  add_definitions(-Wall -D_REENTRANT)  # -fno-common for shared library
  set (CMAKE_OSX_ARCHITECTURES x86_64)
  set (CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")
  set (CMAKE_OSX_DEPLOYMENT_TARGET 10.6)

  set (BOOST_ROOT "/usr/local/Cellar/boost/1.54.0")
elseif (UNIX)
  #add_compile_options(-march=native)
endif()

if (APPLE)
  add_definitions(-DOSL_HOME="/Applications/gpsfish.app/Contents/Resources")
else()
  add_definitions(-DOSL_HOME="/usr/share/gpsshogi-data")
endif()

include_directories ("${PROJECT_SOURCE_DIR}/core")
include_directories ("${PROJECT_SOURCE_DIR}/std")
include_directories ("${PROJECT_SOURCE_DIR}/full")

## Pthreads
#find_package (Threads)
#if (Threads_FOUND)
#  message (STATUS "Threads: ${CMAKE_THREAD_LIBS_INIT}")
#else()
#  message (FATAL_ERROR "Threads not found")
#endif()

## Boost thing
#set (BOOST_ROOT "$ENV{HOME}/local/boost_1_36_0_binaries/")
#set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_MULTITHREADED ON)
if (MINGW)
  find_package (Boost 1.54.0)
else()
  find_package (Boost)
endif()
if (Boost_FOUND)
  include_directories (${Boost_INCLUDE_DIRS})
  message (STATUS ${Boost_INCLUDE_DIRS})
else()
  message (FATAL_ERROR "Boost installation not found")
endif()

## Program SampleCounter
file(GLOB_RECURSE OSL_HEADERS  core/osl/*.h core/osl/*.tcc std/osl/*.h std/osl/*.tcc full/osl/*.h full/osl/*.tcc)
file(GLOB_RECURSE OSL_SRCS     core/osl/*.cc std/osl/*.cc full/osl/*.cc)
file(GLOB_RECURSE EXCLUDE_SRCS full/osl/ntesuki/*.cc)
list(REMOVE_ITEM OSL_SRCS ${EXCLUDE_SRCS})

#message (STATUS "Headers: ${OSL_HEADERS}")
#message (STATUS "Sources: ${OSL_SRCS}")
#set (SampleAleriUDF_ALL_SRCS ${SampleAleriUDF_HEADERS} ${SampleAleriUDF_SRCS})

add_library (osl-static STATIC ${OSL_SRCS})
SET_TARGET_PROPERTIES(osl-static PROPERTIES OUTPUT_NAME "osl")
SET_TARGET_PROPERTIES(osl-static PROPERTIES PREFIX "lib")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  add_library (osl SHARED ${OSL_SRCS})
  target_link_libraries (osl ${CMAKE_THREAD_LIBS_INIT})
  set_target_properties(osl PROPERTIES
                            VERSION 1.0.0
                            SOVERSION 1)
endif()

install(TARGETS osl osl-static
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

# Install header files
install(DIRECTORY "core/osl"
        DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
        FILES_MATCHING PATTERN "*.h" PATTERN "*.tcc")
install(DIRECTORY "std/osl"
        DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
        FILES_MATCHING PATTERN "*.h" PATTERN "*.tcc")
install(DIRECTORY "full/osl"
        DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
        FILES_MATCHING PATTERN "*.h" PATTERN "*.tcc")