-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
50 lines (38 loc) · 1.4 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
cmake_minimum_required(VERSION 3.16)
# set the project name and version
project(gb VERSION 1.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_GENERATOR_PLATFORM x64)
# file(GLOB LIB_SOURCES "./lib/*.cpp")
file(GLOB SOURCES "./src/*.cpp")
file(GLOB IMGUI "./src/imgui/*.cpp")
# file(GLOB HQX_S "./hqx/*.c")
# add_subdirectory (hqx)
add_subdirectory(lib ./libgb)
add_subdirectory(hqx)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set (CMAKE_LIBRARY_RUNTIME_DIRECTORY ${CMAKE_BINARY_DIR})
# add_library(gb_lib SHARED ${LIB_SOURCES})
# target_compile_definitions(gb_lib PRIVATE EMULATOR_EXPORTS)
add_executable(gb ${SOURCES} ${IMGUI} "./src/tinyfiledialogs/tinyfiledialogs.c")
find_package(SDL2 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
if(DEFINED SDL2_INCLUDE_DIRS)
target_include_directories(gb PRIVATE ${SDL2_INCLUDE_DIRS})
endif()
# need to properly filter out if vcpkg or not
if (UNIX)
target_link_libraries(gb PRIVATE SDL2)
target_link_libraries(gb PRIVATE pthread)
else()
target_link_libraries(gb PRIVATE SDL2::SDL2 )
endif()
target_include_directories(gb PRIVATE "./lib")
target_link_libraries(gb PRIVATE libgb hqx OpenGL::GL GLEW::GLEW)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
if(MSVC)
target_link_options(gb PUBLIC /entry:mainCRTStartup /subsystem:windows)
endif(MSVC)
endif(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")