Package: mojoshader / 0.0~hg1314+dfsg-1.1

CMakeLists.patch Patch series | 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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d8b4e6..d279707 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(MojoShader)
+CMAKE_POLICY(SET CMP0063 NEW)
 
 OPTION(BUILD_SHARED_LIBS "Build MojoShader as a shared library" OFF)
 OPTION(PROFILE_D3D "Build MojoShader with support for the D3D profile" ON)
@@ -25,8 +26,6 @@ INCLUDE_DIRECTORIES(.)
 FIND_PROGRAM(HG hg DOC "Path to hg command line app: http://www.selenic.com/mercurial/")
 IF(NOT HG)
     MESSAGE(STATUS "Mercurial (hg) not found. You can go on, but version info will be wrong.")
-    SET(MOJOSHADER_VERSION -1)
-    SET(MOJOSHADER_CHANGESET "???")
 ELSE(NOT HG)
     MARK_AS_ADVANCED(HG)
 
@@ -39,8 +38,6 @@ ELSE(NOT HG)
     )
     IF(NOT HGVERSION_RC EQUAL 0)
         MESSAGE(STATUS "Mercurial (hg) repository not found. You can go on, but version info will be wrong.")
-        SET(MOJOSHADER_VERSION -1)
-        SET(MOJOSHADER_CHANGESET "???")
     ELSE(NOT HGVERSION_RC EQUAL 0)
         # Query the rev and changeset.
         EXECUTE_PROCESS(
@@ -130,7 +127,7 @@ ENDIF(NOT PROFILE_ARB1_NV)
 IF(NOT PROFILE_METAL)
     ADD_DEFINITIONS(-DSUPPORT_PROFILE_METAL=0)
 ELSE(NOT PROFILE_METAL)
-    SET(LOBJC -lobjc)
+    SET(LOBJC )
 ENDIF(NOT PROFILE_METAL)
 IF(NOT PROFILE_SPIRV)
     ADD_DEFINITIONS(-DSUPPORT_PROFILE_SPIRV=0)
@@ -158,7 +155,7 @@ IF(XNA4_VERTEXTEXTURE)
     ADD_DEFINITIONS(-DMOJOSHADER_XNA4_VERTEX_TEXTURES)
 ENDIF(XNA4_VERTEXTEXTURE)
 
-ADD_LIBRARY(mojoshader
+ADD_LIBRARY(mojoshader OBJECT
     mojoshader.c
     mojoshader_common.c
     mojoshader_opengl.c
@@ -174,6 +171,8 @@ ADD_LIBRARY(mojoshader
     profiles/mojoshader_profile_spirv.c
     profiles/mojoshader_profile_common.c
 )
+SET_TARGET_PROPERTIES(mojoshader PROPERTIES POSITION_INDEPENDENT_CODE ON C_VISIBILITY_PRESET hidden)
+TARGET_COMPILE_DEFINITIONS(mojoshader PRIVATE "DECLSPEC=__attribute__((visibility(\"default\")))")
 IF(EFFECT_SUPPORT)
     TARGET_SOURCES(mojoshader PRIVATE
         mojoshader_effects.c
@@ -229,7 +228,7 @@ ENDIF(SDL2)
 
 IF(COMPILER_SUPPORT)
     ADD_EXECUTABLE(finderrors utils/finderrors.c)
-    TARGET_LINK_LIBRARIES(finderrors mojoshader ${SDL2} ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
+    TARGET_LINK_LIBRARIES(finderrors mojoshader ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
     IF(SDL2)
         SET_SOURCE_FILES_PROPERTIES(
             utils/finderrors.c
@@ -257,6 +256,30 @@ IF(COMPILER_SUPPORT)
     TARGET_LINK_LIBRARIES(mojoshader-compiler mojoshader ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
 ENDIF(COMPILER_SUPPORT)
 
+ADD_LIBRARY(mojoshader-static STATIC $<TARGET_OBJECTS:mojoshader>)
+SET_TARGET_PROPERTIES(mojoshader-static PROPERTIES OUTPUT_NAME mojoshader)
+
+ADD_LIBRARY(mojoshader-shared SHARED $<TARGET_OBJECTS:mojoshader>)
+SET_TARGET_PROPERTIES(mojoshader-shared PROPERTIES OUTPUT_NAME mojoshader)
+SET_TARGET_PROPERTIES(mojoshader-shared PROPERTIES VERSION "${MOJOSHADER_VERSION}" SOVERSION 0)
+TARGET_LINK_LIBRARIES(mojoshader-shared ${LIBM})
+
+INCLUDE(GNUInstallDirs)
+INSTALL(
+    TARGETS mojoshader-static mojoshader-shared
+    ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
+    LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
+)
+INSTALL(
+    FILES mojoshader.h mojoshader_effects.h mojoshader_version.h
+    DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/mojoshader"
+)
+CONFIGURE_FILE("debian/mojoshader.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/mojoshader.pc" @ONLY)
+INSTALL(
+  FILES "${CMAKE_CURRENT_BINARY_DIR}/mojoshader.pc"
+  DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+)
+
 # Unit tests...
 IF(COMPILER_SUPPORT)
     ADD_CUSTOM_TARGET(