mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-14 16:09:06 +07:00
public cmake e2d variables (E2D_INCLUDE_DIRS and E2D_LIBRARIES)
This commit is contained in:
@@ -9,20 +9,6 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
foreach(flags CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_DEBUG)
|
||||
set(${flags} "${${flags}} -D_DEBUG -DNRELEASE")
|
||||
endforeach(flags)
|
||||
|
||||
foreach(flags CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
set(${flags} "${${flags}} -DNDEBUG -D_RELEASE")
|
||||
endforeach(flags)
|
||||
|
||||
#
|
||||
# warning mode
|
||||
#
|
||||
@@ -56,16 +42,36 @@ file(GLOB_RECURSE E2D_SOURCES
|
||||
if(APPLE)
|
||||
file(GLOB_RECURSE E2D_SOURCES_MM
|
||||
sources/enduro2d/*.mm)
|
||||
list(APPEND E2D_SOURCES ${E2D_SOURCES_MM})
|
||||
list(APPEND E2D_SOURCES
|
||||
${E2D_SOURCES_MM})
|
||||
endif()
|
||||
|
||||
#
|
||||
# e2d 3rd party
|
||||
# e2d internal 3rd party
|
||||
#
|
||||
|
||||
file(GLOB_RECURSE E2D_3RDPARTY
|
||||
sources/3rdparty/*.*)
|
||||
|
||||
#
|
||||
# e2d external 3rd party
|
||||
#
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if(APPLE)
|
||||
find_library(Cocoa Cocoa)
|
||||
find_library(IOKit IOKit)
|
||||
find_library(CoreVideo CoreVideo)
|
||||
find_library(Foundation Foundation)
|
||||
endif(APPLE)
|
||||
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(modules/glfw)
|
||||
|
||||
#
|
||||
# e2d library target
|
||||
#
|
||||
@@ -90,13 +96,25 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
CXX_EXTENSIONS NO)
|
||||
|
||||
#
|
||||
# glfw module
|
||||
# e2d public variables
|
||||
#
|
||||
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(modules/glfw)
|
||||
set(E2D_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/headers)
|
||||
|
||||
set(E2D_LIBRARIES
|
||||
enduro2d
|
||||
glfw
|
||||
${OPENGL_gl_LIBRARY}
|
||||
${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND ${E2D_LIBRARIES}
|
||||
${Cocoa}
|
||||
${IOKit}
|
||||
${CoreVideo}
|
||||
${Foundation})
|
||||
endif(APPLE)
|
||||
|
||||
#
|
||||
# subdirectories
|
||||
|
||||
@@ -66,10 +66,10 @@
|
||||
#define E2D_BUILD_MODE_RELEASE 2
|
||||
|
||||
#ifndef E2D_BUILD_MODE
|
||||
# if defined(DEBUG) || defined(_DEBUG) || defined(NRELEASE)
|
||||
# define E2D_BUILD_MODE E2D_BUILD_MODE_DEBUG
|
||||
# elif defined(RELEASE) || defined(_RELEASE) || defined(NDEBUG)
|
||||
# if defined(RELEASE) || defined(_RELEASE) || defined(NDEBUG)
|
||||
# define E2D_BUILD_MODE E2D_BUILD_MODE_RELEASE
|
||||
# else
|
||||
# define E2D_BUILD_MODE E2D_BUILD_MODE_DEBUG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
function(add_e2d_sample NAME)
|
||||
set(SAMPLE_NAME sample_${NAME})
|
||||
|
||||
#
|
||||
# external
|
||||
#
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if(APPLE)
|
||||
find_library(Cocoa Cocoa)
|
||||
find_library(IOKit IOKit)
|
||||
find_library(CoreVideo CoreVideo)
|
||||
find_library(Foundation Foundation)
|
||||
endif(APPLE)
|
||||
|
||||
#
|
||||
# sources
|
||||
#
|
||||
@@ -31,24 +17,10 @@ function(add_e2d_sample NAME)
|
||||
|
||||
add_executable(${SAMPLE_NAME}
|
||||
${SAMPLE_SOURCES})
|
||||
|
||||
target_link_libraries(${SAMPLE_NAME}
|
||||
${E2D_LIBRARIES})
|
||||
target_include_directories(${SAMPLE_NAME}
|
||||
PRIVATE "../headers")
|
||||
|
||||
target_link_libraries(${SAMPLE_NAME}
|
||||
enduro2d
|
||||
glfw
|
||||
${OPENGL_gl_LIBRARY}
|
||||
${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(${SAMPLE_NAME}
|
||||
${Cocoa}
|
||||
${IOKit}
|
||||
${CoreVideo}
|
||||
${Foundation})
|
||||
endif(APPLE)
|
||||
|
||||
PRIVATE ${E2D_INCLUDE_DIRS})
|
||||
set_target_properties(${SAMPLE_NAME} PROPERTIES
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED YES
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
function(add_e2d_tests NAME)
|
||||
set(TESTS_NAME untests_${NAME})
|
||||
|
||||
#
|
||||
# external
|
||||
#
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if(APPLE)
|
||||
find_library(Foundation Foundation)
|
||||
endif(APPLE)
|
||||
|
||||
#
|
||||
# sources
|
||||
#
|
||||
@@ -27,19 +17,10 @@ function(add_e2d_tests NAME)
|
||||
|
||||
add_executable(${TESTS_NAME}
|
||||
${TESTS_SOURCES})
|
||||
|
||||
target_link_libraries(${TESTS_NAME}
|
||||
${E2D_LIBRARIES})
|
||||
target_include_directories(${TESTS_NAME}
|
||||
PRIVATE "../headers")
|
||||
|
||||
target_link_libraries(${TESTS_NAME}
|
||||
enduro2d
|
||||
"${CMAKE_THREAD_LIBS_INIT}")
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(${TESTS_NAME}
|
||||
${Foundation})
|
||||
endif(APPLE)
|
||||
|
||||
PRIVATE ${E2D_INCLUDE_DIRS})
|
||||
set_target_properties(${TESTS_NAME} PROPERTIES
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED YES
|
||||
|
||||
Reference in New Issue
Block a user