1+ cmake_minimum_required (VERSION 2.8.12 )
2+ project (obs-ghostscript)
3+
4+ if (OBSSourcePath OR DEFINED ENV{OBSSourcePath})
5+ # Set already
6+ else ()
7+ set (OBSSourcePath "" CACHE PATH "Path to OBS source code (e.g., C:/Dev/obs-studio/libobs/)" )
8+ message ("OBSSourcePath is missing. Please set this variable to the location of the OBS source (e.g., C:/Dev/obs-studio/libobs/)." )
9+ endif ()
10+
11+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
12+ set (_lib_suffix 64)
13+ else ()
14+ set (_lib_suffix 32)
15+ endif ()
16+
17+ find_path (OBS_LIB_DIR
18+ NAMES obs.dll obs.lib
19+ HINTS
20+ ${OBSSourcePath} /../build/libobs/Release/
21+ ${OBSSourcePath} /../build${_lib_suffix}/libobs/Release/
22+ ${OBSSourcePath} /../build/libobs/Debug/
23+ ${OBSSourcePath} /../build${_lib_suffix}/libobs/Debug/
24+ PATHS
25+ /usr/lib /usr/local/lib /opt/local/lib /sw/lib )
26+
27+ find_path (GHOSTSCRIPT_INCLUDE_DIR
28+ NAMES psi/iapi.h devices/gdevdsp.h
29+ HINTS ${GSSourcePath}
30+ PATHS
31+ /usr/include /usr/local/include /opt/local/include /sw/include )
32+
33+ find_path (GHOSTSCRIPT_LIB_DIR
34+ NAMES gsdll${_lib_suffix}.dll gsdll${_lib_suffix}.lib
35+ HINTS
36+ ${GSLibraryPath}
37+ PATHS
38+ /usr/lib /usr/local/lib /opt/local/lib /sw/lib )
39+
40+ if (NOT GHOSTSCRIPT_INCLUDE_DIR OR NOT GHOSTSCRIPT_LIB_DIR)
41+ message ("Ghostscript headers or libraries could not be found! Please ensure that Ghostscript is installed somewhere, and set the GSSourcePath and GSLibraryPath variables if necessary." )
42+ endif ()
43+
44+ # Source
45+ file (GLOB SOURCES ${CMAKE_SOURCE_DIR } /src/*.c )
46+ file (GLOB HEADER_FILES ${CMAKE_SOURCE_DIR } /include/*.h )
47+
48+ include_directories (include )
49+ add_library (${PROJECT_NAME } SHARED
50+ ${SOURCES}
51+ ${HEADER_FILES}
52+ )
53+
54+ # libobs
55+ include_directories (${OBSSourcePath} )
56+ add_library (libobs SHARED IMPORTED )
57+ set_property (TARGET libobs PROPERTY IMPORTED_LOCATION ${OBS_LIB_DIR} /obs.dll)
58+ set_property (TARGET libobs PROPERTY IMPORTED_IMPLIB ${OBS_LIB_DIR} /obs.lib)
59+ target_link_libraries (${PROJECT_NAME } libobs )
60+
61+ # Ghostscript
62+ include_directories (${GHOSTSCRIPT_INCLUDE_DIR} )
63+ add_library (gsdll SHARED IMPORTED )
64+ set_property (TARGET gsdll PROPERTY IMPORTED_LOCATION ${OBS_LIB_DIR} /gsdll${_lib_suffix} .dll)
65+ set_property (TARGET gsdll PROPERTY IMPORTED_IMPLIB ${GHOSTSCRIPT_LIB_DIR} /gsdll${_lib_suffix} .lib)
66+ target_link_libraries (${PROJECT_NAME } gsdll )
0 commit comments