forked from aras-p/glsl-optimizer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
72 lines (61 loc) · 2.06 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.22)
include_directories(include)
include_directories(src/mesa)
include_directories(src/mapi)
include_directories(src/glsl)
include_directories(src)
option (DEBUG "Enable debugging" FALSE)
if(${DEBUG} MATCHES "on")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1 -DNDEBUG")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O1 -DNDEBUG")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s")
endif()
file(GLOB glcpp-library_sources
src/glsl/glcpp/*.c
src/util/*.c)
add_library(glcpp-library
${glcpp-library_sources})
file(GLOB mesa_sources
src/mesa/program/*.c
src/mesa/main/*.c)
add_library(mesa
${mesa_sources})
file(GLOB glsl_sources
src/glsl/*.cpp
src/glsl/*.c)
file(GLOB glsl_sources_remove
src/glsl/main.cpp
src/glsl/builtin_stubs.cpp)
list(REMOVE_ITEM glsl_sources ${glsl_sources_remove})
add_library(glsl_optimizer ${glsl_sources})
target_link_libraries(glsl_optimizer glcpp-library mesa)
target_include_directories(glsl_optimizer PUBLIC
src)
add_executable(glsl_compiler src/glsl/main.cpp)
target_link_libraries(glsl_compiler glsl_optimizer)
file(GLOB glsl_test_sources tests/*.cpp)
add_executable(glsl_test ${glsl_test_sources})
target_link_libraries(glsl_test glsl_optimizer)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# OSX-specific build requirements
find_library(OpenGL_LIBRARY OpenGL )
target_link_libraries(glsl_test ${OpenGL_LIBRARY})
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
file(GLOB glslopt_sources contrib/glslopt/*.cpp)
add_executable(glslopt ${glslopt_sources})
target_link_libraries(glslopt glsl_optimizer)
#add_executable(glcpp src/glsl/glcpp/glcpp.c)
#target_link_libraries(glcpp glsl_optimizer)
add_library(glsl_optimizer_pic_static STATIC
${glcpp-library_sources}
${mesa_sources}
${glsl_sources})
target_include_directories(glsl_optimizer_pic_static PUBLIC
src)
set_target_properties(glsl_optimizer_pic_static PROPERTIES
POSITION_INDEPENDENT_CODE True
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden)