axmol/samples/Cpp/HelloCpp/CMakeLists.txt

76 lines
2.0 KiB
CMake
Raw Normal View History

2013-11-04 18:48:36 +08:00
set(APP_NAME hellocpp)
2013-11-02 14:41:04 +08:00
if(QT)
set(PLATFORM_SRC
proj.qt/main.cpp
)
elseif(ANDROID)
set(PLATFORM_SRC
proj.android/jni/hellocpp/main.cpp
)
elseif(WIN32)
set(PLATFORM_SRC
proj.win32/main.cpp
)
elseif(APPLE)
if(IOS)
set(PLATFORM_SRC
proj.ios/main.m
proj.ios/AppController.mm
proj.ios/RootViewController.mm
)
else()
set(PLATFORM_SRC
proj.mac/main.m
)
endif()
2013-11-30 14:09:12 +08:00
else()
set(PLATFORM_SRC
proj.linux/main.cpp
)
endif()
2013-11-02 14:41:04 +08:00
set(SAMPLE_SRC
${PLATFORM_SRC}
2013-11-02 14:41:04 +08:00
Classes/AppDelegate.cpp
Classes/HelloWorldScene.cpp
)
# add the executable
2013-11-04 18:48:36 +08:00
add_executable(${APP_NAME}
2013-11-02 14:41:04 +08:00
${SAMPLE_SRC}
)
if(WIN32 AND MSVC)
#get our resources
add_custom_command(TARGET ${APP_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/Resources ${CMAKE_CURRENT_BINARY_DIR})
#get our dlls
add_custom_command(TARGET ${APP_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/../../../external/win32-specific/gles/prebuilt/glew32.dll
${CMAKE_CURRENT_BINARY_DIR})
2013-11-02 16:31:52 +08:00
add_custom_command(TARGET ${APP_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/../../../external/win32-specific/zlib/prebuilt/zlib1.dll
${CMAKE_CURRENT_BINARY_DIR}/Debug)
2013-11-02 16:31:52 +08:00
#Visual Studio Defaults to wrong type
set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
else()
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
set_target_properties(${APP_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
)
endif()
2013-11-02 16:31:52 +08:00
target_link_libraries(${APP_NAME} audio cocos2d)