-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
CMakeLists.txt
65 lines (50 loc) · 1.81 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
cmake_minimum_required(VERSION 3.13.0)
project(GOESP)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
if (NOT WIN32)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=core2 -mtune=native -flto -fno-exceptions")
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
endif()
set(CMAKE_CXX_STANDARD 20)
if (NOT WIN32)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-rtti")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} --no-gnu-unique")
endif()
file(GLOB_RECURSE SOURCES "${CMAKE_SOURCE_DIR}/GOESP/*.cpp")
if (NOT WIN32)
list(REMOVE_ITEM SOURCES "${CMAKE_SOURCE_DIR}/GOESP/imgui/imgui_impl_dx9.cpp")
list(REMOVE_ITEM SOURCES "${CMAKE_SOURCE_DIR}/GOESP/imgui/imgui_impl_win32.cpp")
else()
list(REMOVE_ITEM SOURCES "${CMAKE_SOURCE_DIR}/GOESP/imgui/imgui_impl_opengl3.cpp")
list(REMOVE_ITEM SOURCES "${CMAKE_SOURCE_DIR}/GOESP/imgui/imgui_impl_sdl.cpp")
endif()
add_subdirectory(GOESP/freetype)
if (NOT WIN32)
include_directories(/usr/local/include/ /usr/include/SDL2/ "${CMAKE_SOURCE_DIR}/GOESP/freetype/")
link_directories(/usr/local/lib)
else()
include_directories("${CMAKE_SOURCE_DIR}/GOESP/freetype/")
endif()
add_library(GOESP SHARED ${SOURCES})
if (APPLE)
target_link_options(GOESP INTERFACE "-framework OpenGL")
target_link_libraries(GOESP SDL2 FreeType)
elseif (NOT WIN32)
target_link_options(GOESP PRIVATE LINKER:--no-undefined)
target_link_libraries(GOESP SDL2 GL dl FreeType)
else()
target_link_libraries(GOESP FreeType)
endif()
if (WIN32)
add_compile_definitions(NOMINMAX)
endif()
option(BUILD_TESTS "Build unit tests" OFF)
if (BUILD_TESTS)
enable_testing()
add_subdirectory(Tests)
endif()