-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
51 lines (43 loc) · 2.35 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
cmake_minimum_required(VERSION 3.0)
project(SynthgenParticles)
option(LINK_TO_MSVCRT "Use msvcrt instead of default CRT" OFF)
option(CRINKLER "Use Crinkler" OFF)
set(ADDITIONAL_COMPILER_PARAMETERS "" CACHE STRING "User-specified compiler flags")
if(MSVC)
set(COMMON_PARAMETERS "/MP /EHsc ${ADDITIONAL_COMPILER_PARAMETERS}")
set(COMMON_LINKER_PARAMETERS "")
if(LINK_TO_MSVCRT)
set(COMMON_PARAMETERS "${COMMON_PARAMETERS} /QIfist /arch:IA32")
add_definitions(-DLINK_TO_MSVCRT -D_NO_CRT_STDIO_INLINE)
set(COMMON_LINKER_PARAMETERS "${COMMON_LINKER_PARAMETERS} /NODEFAULTLIB ${CMAKE_SOURCE_DIR}/bin/msvcrt.lib")
endif()
if(CRINKLER)
if(NOT LINK_TO_MSVCRT)
message(FATAL_ERROR "CRINKLER requires LINK_TO_MSVCRT")
endif()
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/bin/Crinkler.exe")
message(FATAL_ERROR "Couldn't find bin/Crinkler.exe")
endif()
set(COMMON_PARAMETERS "${COMMON_PARAMETERS}")
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_SOURCE_DIR}/bin/Crinkler.exe <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>")
set(COMMON_LINKER_PARAMETERS "${COMMON_LINKER_PARAMETERS} /CRINKLER")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "${COMMON_PARAMETERS} /O2xti /GT /GF /Gy /MT /fp:fast")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${COMMON_PARAMETERS} /O1si /GT /GF /GS- /Gy /MT /fp:fast")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${COMMON_PARAMETERS} /O2xti /GT /GF /Gy /MT /fp:fast /Zi /D_DEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${COMMON_PARAMETERS} /Od /MDd /Zi /D_DEBUG /RTC1 /fp:fast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_PARAMETERS}")
if(NOT CRINKLER)
set(CMAKE_CXX_FLAGS_RELEASE "${COMMON_PARAMETERS} /GL")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${COMMON_PARAMETERS} /GL")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${COMMON_PARAMETERS} /GL")
endif()
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${COMMON_LINKER_PARAMETERS} /LTCG")
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} ${COMMON_LINKER_PARAMETERS} /LTCG /DYNAMICBASE:NO /FIXED")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} ${COMMON_LINKER_PARAMETERS} /LTCG")
endif()
find_package(OpenGL REQUIRED)
file(GLOB_RECURSE MY_HEADERS "src/*.h")
file(GLOB_RECURSE MY_SOURCES "src/*.cpp")
add_executable(SynthgenParticles WIN32 ${MY_SOURCES} ${MY_HEADERS})
target_link_libraries(SynthgenParticles ${OPENGL_LIBRARY} winmm.lib)