aboutsummaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
blob: c919d8fa3a170d82a42a5f040ddffd4026416f63 (plain)
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
set (gamp_LIB_INCLUDE_DIRS
  ${PROJECT_SOURCE_DIR}/jaulib/include
  ${PROJECT_SOURCE_DIR}/include
)

include_directories(
  ${gamp_LIB_INCLUDE_DIRS}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${SYS_INCLUDE_DIRS}
)

set (gamp_LIB_SRCS
  ${PROJECT_SOURCE_DIR}/jaulib/src/basic_types.cpp
  ${PROJECT_SOURCE_DIR}/jaulib/src/base_codec.cpp
  ${PROJECT_SOURCE_DIR}/jaulib/src/cpuid.cpp
  ${PROJECT_SOURCE_DIR}/jaulib/src/debug.cpp
  ${PROJECT_SOURCE_DIR}/jaulib/src/environment.cpp
  ${PROJECT_SOURCE_DIR}/jaulib/src/file_util.cpp
  ${PROJECT_SOURCE_DIR}/jaulib/src/os_support.cpp
  ${PROJECT_SOURCE_DIR}/jaulib/src/unix/user_info.cpp
  ${PROJECT_SOURCE_DIR}/src/gamp.cpp
  ${PROJECT_SOURCE_DIR}/src/sdl_subsys.cpp
# autogenerated files
  ${CMAKE_CURRENT_BINARY_DIR}/version.cpp
)

if (EMSCRIPTEN)
add_library (gamp STATIC ${gamp_LIB_SRCS})
target_link_libraries (
  gamp
  ${LIBUNWIND_LIBNAME}
  ${CMAKE_THREAD_LIBS_INIT}
)
else()
add_library (gamp SHARED ${gamp_LIB_SRCS})
target_link_libraries (
  gamp
  ${LIBUNWIND_LIBNAME}
  ${CMAKE_THREAD_LIBS_INIT}
)
endif()

if( (USE_STRIP) AND (NOT EMSCRIPTEN) )
add_custom_command(TARGET gamp POST_BUILD
                   COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gamp${CMAKE_SHARED_LIBRARY_SUFFIX}.${gamp_VERSION_SHORT}
                   COMMENT "stripping gamp"
                   VERBATIM
                   )
endif()

set_target_properties(
   gamp
   PROPERTIES
   SOVERSION ${gamp_VERSION_MAJOR}
   VERSION ${gamp_VERSION_SHORT}
)
install (DIRECTORY ${PROJECT_SOURCE_DIR}/include/gamp DESTINATION include/)

macro (gamp_CREATE_INSTALL_PKGCONFIG generated_file install_location)
  configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
  install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
endmacro (gamp_CREATE_INSTALL_PKGCONFIG)
gamp_create_install_pkgconfig (gamp.pc lib${LIB_SUFFIX}/pkgconfig)

install(TARGETS gamp LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})